Skip to content

Commit

Permalink
[DM-41951] Set auto commit to false
Browse files Browse the repository at this point in the history
This seems to be holding a lot of memory up on the server by holding
open a transaction, but we don't need a transaction just for SELECTs.
  • Loading branch information
cbanek committed Dec 8, 2023
1 parent 8e11126 commit 4b78a50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/opencadc/tap/impl/QServQueryRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ private void doIt()
// and restrict to forward only so that client memory usage is minimal since
// we are only interested in reading the ResultSet once

connection.setAutoCommit(false);
pstmt = connection.prepareStatement(sql);
pstmt.setFetchSize(1000);
pstmt.setFetchDirection(ResultSet.FETCH_FORWARD);
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/org/opencadc/tap/impl/ResultStoreImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ public class ResultStoreImpl implements ResultStore {
public URL put(final ResultSet resultSet,
final TableWriter<ResultSet> resultSetTableWriter)
throws IOException {
OutputStream os;
os = getOutputStream();
OutputStream os = getOutputStream();
resultSetTableWriter.write(resultSet, os);
os.close();
return getURL();
Expand All @@ -113,8 +112,7 @@ public URL put(final ResultSet resultSet,
@Override
public URL put(Throwable throwable, TableWriter tableWriter)
throws IOException {
OutputStream os;
os = getOutputStream();
OutputStream os = getOutputStream();
tableWriter.write(throwable, os);
os.close();
return getURL();
Expand All @@ -124,8 +122,7 @@ public URL put(Throwable throwable, TableWriter tableWriter)
public URL put(final ResultSet resultSet,
final TableWriter<ResultSet> resultSetTableWriter,
final Integer integer) throws IOException {
OutputStream os;
os = getOutputStream();
OutputStream os = getOutputStream();

if (integer == null) {
resultSetTableWriter.write(resultSet, os);
Expand Down

0 comments on commit 4b78a50

Please sign in to comment.