Skip to content

Commit

Permalink
Set decimal 1GB default LOB prefetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-A-McMahon committed Dec 4, 2024
1 parent 4b2ec1f commit ca14f5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/main/java/oracle/r2dbc/impl/OracleReactiveJdbcAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -648,15 +648,13 @@ private static void configureJdbcDefaults(OracleDataSource oracleDataSource) {
setPropertyIfAbsent(oracleDataSource,
OracleConnection.CONNECTION_PROPERTY_IMPLICIT_STATEMENT_CACHE_SIZE, "25");

// Prefetch LOB values by default. The database's maximum supported
// prefetch size, 1GB, is configured by default. This is done so that
// Row.get(...) can map LOB values into ByteBuffer/String without a
// blocking database call. If the entire value is prefetched, then JDBC
// won't need to fetch the remainder from the database when the entire is
// value requested as a ByteBuffer or String.
// Prefetch LOB values by default. This allows Row.get(...) to map most LOB
// values into ByteBuffer/String without a blocking database call to fetch
// the remaining bytes. 1GB is configured by default, as this is close to
// the maximum allowed by the Autonomous Database service.
setPropertyIfAbsent(oracleDataSource,
OracleConnection.CONNECTION_PROPERTY_DEFAULT_LOB_PREFETCH_SIZE,
"1073741824");
"1000000000");

// TODO: Disable the result set cache? This is needed to support the
// SERIALIZABLE isolation level, which requires result set caching to be
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/oracle/r2dbc/impl/OracleLargeObjectsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,8 @@ public void run() {
+ " PRIMARY KEY(id))"));

// Insert two rows of LOBs larger than 1MB
byte[] bytes = new byte[lobSize];
byte[] bytes = getBytes(lobSize);
ByteBuffer blobValue = ByteBuffer.wrap(bytes);
Arrays.fill(bytes, (byte)'a');
String clobValue = new String(bytes, US_ASCII);
awaitUpdate(List.of(1,1), connection.createStatement(
"INSERT INTO testLobPrefetch (blobValue, clobValue)"
Expand Down

0 comments on commit ca14f5c

Please sign in to comment.