From 2f0692e02c34fe9f5dcc0f5608bfffc1a9ecb0bf Mon Sep 17 00:00:00 2001 From: Christine Banek Date: Tue, 5 Dec 2023 15:43:15 -0700 Subject: [PATCH] [DM-41951] Set auto commit to false on jdbc connection This might be holding open a transaction on the connection, making memory go out of control. The default here is true. --- tap/src/main/java/ca/nrc/cadc/sample/QueryRunner.java | 2 +- tap/src/main/java/ca/nrc/cadc/sample/ResultStoreImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tap/src/main/java/ca/nrc/cadc/sample/QueryRunner.java b/tap/src/main/java/ca/nrc/cadc/sample/QueryRunner.java index 8c1892e..5b8dd21 100644 --- a/tap/src/main/java/ca/nrc/cadc/sample/QueryRunner.java +++ b/tap/src/main/java/ca/nrc/cadc/sample/QueryRunner.java @@ -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); diff --git a/tap/src/main/java/ca/nrc/cadc/sample/ResultStoreImpl.java b/tap/src/main/java/ca/nrc/cadc/sample/ResultStoreImpl.java index 0298e23..b7ea6c0 100644 --- a/tap/src/main/java/ca/nrc/cadc/sample/ResultStoreImpl.java +++ b/tap/src/main/java/ca/nrc/cadc/sample/ResultStoreImpl.java @@ -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 {