Skip to content

Commit

Permalink
[DM-41951] Set auto commit to false on jdbc connection
Browse files Browse the repository at this point in the history
This might be holding open a transaction on the connection, making
memory go out of control.  The default here is true.
  • Loading branch information
cbanek committed Dec 8, 2023
1 parent 733299e commit 2f0692e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tap/src/main/java/ca/nrc/cadc/sample/QueryRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ private void doIt()
// manually control transaction, make fetch size (client batch size) small,
// 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
2 changes: 1 addition & 1 deletion tap/src/main/java/ca/nrc/cadc/sample/ResultStoreImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private OutputStream getOutputStream() {
BlobId blobId = BlobId.of(bucket, filename);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("application/x-votable+xml").build();
Blob blob = storage.create(blobInfo);
return Channels.newOutputStream(blob.writer());
return Channels.newOutputStream(blob.writer())
}

private URL getURL() throws MalformedURLException {
Expand Down

0 comments on commit 2f0692e

Please sign in to comment.