From d77f2b8e6f3d880badedcb81df3f9575d46c3ba7 Mon Sep 17 00:00:00 2001 From: Dave Cramer Date: Mon, 24 Feb 2020 10:19:19 -0500 Subject: [PATCH] Revert "feat: implementation of adaptive fetching (#1707)" This reverts commit 5bb5f409b8372e4be86c14a00309ab60b8e17ed8. --- README.md | 3 - docs/documentation/head/connect.md | 25 - .../java/org/postgresql/PGConnection.java | 15 - .../main/java/org/postgresql/PGProperty.java | 31 - .../main/java/org/postgresql/PGStatement.java | 15 - .../java/org/postgresql/core/PGStream.java | 44 - .../org/postgresql/core/QueryExecutor.java | 85 +- .../postgresql/core/v3/QueryExecutorImpl.java | 115 +- .../adaptivefetch/AdaptiveFetchQueryInfo.java | 40 - .../AdaptiveFetchQueryMonitoring.java | 197 --- .../postgresql/ds/common/BaseDataSource.java | 24 - .../org/postgresql/jdbc/PgConnection.java | 10 - .../java/org/postgresql/jdbc/PgResultSet.java | 96 +- .../java/org/postgresql/jdbc/PgStatement.java | 19 +- .../AdaptiveFetchQueryMonitoringTest.java | 1087 ----------------- .../postgresql/test/jdbc2/Jdbc2TestSuite.java | 2 - .../test/jdbc42/AdaptiveFetchSizeTest.java | 308 ----- .../test/jdbc42/Jdbc42TestSuite.java | 1 - 18 files changed, 17 insertions(+), 2100 deletions(-) delete mode 100644 pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryInfo.java delete mode 100644 pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoring.java delete mode 100644 pgjdbc/src/test/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoringTest.java delete mode 100644 pgjdbc/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java diff --git a/README.md b/README.md index 6901d2133d..5f8e7bb415 100644 --- a/README.md +++ b/README.md @@ -153,9 +153,6 @@ In addition to the standard connection parameters the driver supports a number o | reWriteBatchedInserts | Boolean | false | Enable optimization to rewrite and collapse compatible INSERT statements that are batched. | | escapeSyntaxCallMode | String | select | Specifies how JDBC escape call syntax is transformed into underlying SQL (CALL/SELECT), for invoking procedures or functions (requires server version >= 11), possible values: select, callIfNoReturn, call | | maxResultBuffer | String | null | Specifies size of result buffer in bytes, which can't be exceeded during reading result set. Can be specified as particular size (i.e. "100", "200M" "2G") or as percent of max heap memory (i.e. "10p", "20pct", "50percent") | -| adaptiveFetch | Boolean | false | Specifies if number of rows fetched in ResultSet by each fetch iteration should be dynamic. Number of rows will be calculated by dividing maxResultBuffer size into max row size observed so far. Requires declaring maxResultBuffer and defaultRowFetchSize for first iteration. -| adaptiveFetchMinimum | Integer | 0 | Specifies minimum number of rows, which can be calculated by adaptiveFetch. Number of rows used by adaptiveFetch cannot go below this value. -| adaptiveFetchMaximum | Integer | -1 | Specifies maximum number of rows, which can be calculated by adaptiveFetch. Number of rows used by adaptiveFetch cannot go above this value. Any negative number set as adaptiveFetchMaximum is used by adaptiveFetch as infinity number of rows. ## Contributing For information on how to contribute to the project see the [Contributing Guidelines](CONTRIBUTING.md) diff --git a/docs/documentation/head/connect.md b/docs/documentation/head/connect.md index 9217319a76..98b31f8c20 100644 --- a/docs/documentation/head/connect.md +++ b/docs/documentation/head/connect.md @@ -508,31 +508,6 @@ Connection conn = DriverManager.getConnection(url); By default, maxResultBuffer is not set (is null), what means that reading of results gonna be performed without limits. -* **adaptiveFetch** = boolean - - Specifies if number of rows, fetched in `ResultSet` by one fetch with trip to the database, should be dynamic. - Using dynamic number of rows, computed by adaptive fetch, allows to use most of the buffer declared in `maxResultBuffer` property. - Number of rows would be calculated by dividing `maxResultBuffer` size into max row size observed so far, rounded down. - First fetch will have number of rows declared in `defaultRowFetchSize`. - Number of rows can be limited by `adaptiveFetchMinimum` and `adaptiveFetchMaximum`. - Requires declaring of `maxResultBuffer` and `defaultRowFetchSize` to work. - - By default, adaptiveFetch is false. - -* **adaptiveFetchMinimum** = int - - Specifies the lowest number of rows which can be calculated by `adaptiveFetch`. - Requires `adaptiveFetch` set to true to work. - - By default, minimum of rows calculated by `adaptiveFetch` is 0. - -* **adaptiveFetchMaximum** = int - - Specifies the highest number of rows which can be calculated by `adaptiveFetch`. - Requires `adaptiveFetch` set to true to work. - - By default, maximum of rows calculated by `adaptiveFetch` is -1, which is understood as infinite. - ## Unix sockets diff --git a/pgjdbc/src/main/java/org/postgresql/PGConnection.java b/pgjdbc/src/main/java/org/postgresql/PGConnection.java index 4c75bdc36c..6f700c526a 100644 --- a/pgjdbc/src/main/java/org/postgresql/PGConnection.java +++ b/pgjdbc/src/main/java/org/postgresql/PGConnection.java @@ -313,19 +313,4 @@ public interface PGConnection { * @since 42.2.6 */ String getParameterStatus(String parameterName); - - /** - * Method to turn on/off adaptive fetch for connection. Existing statements and resultSets won't - * be affected by change here. - * - * @param adaptiveFetch desired state of adaptive fetch. - */ - void setAdaptiveFetch(boolean adaptiveFetch); - - /** - * Method to get state of adaptive fetch for connection. - * - * @return state of adaptive fetch (turned on or off) - */ - boolean getAdaptiveFetch(); } diff --git a/pgjdbc/src/main/java/org/postgresql/PGProperty.java b/pgjdbc/src/main/java/org/postgresql/PGProperty.java index ef42729ec0..bac39d10f6 100644 --- a/pgjdbc/src/main/java/org/postgresql/PGProperty.java +++ b/pgjdbc/src/main/java/org/postgresql/PGProperty.java @@ -22,37 +22,6 @@ */ public enum PGProperty { - /** - * Specifies if number of rows fetched in ResultSet by one fetch with trip to the database should - * be dynamic. Number of rows would be calculated by dividing maxResultBuffer size into max row - * size observed so far, rounded down. First fetch will have number of rows declared in - * defaultRowFetchSize. Number of rows can be limited by adaptiveFetchMinimum and - * adaptiveFetchMaximum. Requires declaring of maxResultBuffer and defaultRowFetchSize to work. - * Default value is false. - */ - ADAPTIVE_FETCH( - "adaptiveFetch", - "false", - "Specifies if number of rows fetched in ResultSet should be adaptive to maxResultBuffer and max row size."), - - /** - * Specifies the highest number of rows which can be calculated by adaptiveFetch. Requires - * adaptiveFetch set to true to work. Default value is -1 (used as infinity). - */ - ADAPTIVE_FETCH_MAXIMUM( - "adaptiveFetchMaximum", - "-1", - "Specifies minimum number of rows used by adaptive fetch."), - - /** - * Specifies the lowest number of rows which can be calculated by adaptiveFetch. Requires - * adaptiveFetch set to true to work. Default value is 0. - */ - ADAPTIVE_FETCH_MINIMUM( - "adaptiveFetchMinimum", - "0", - "Specifies maximum number of rows used by adaptive fetch."), - /** * When using the V3 protocol the driver monitors changes in certain server configuration * parameters that should not be touched by end users. The {@code client_encoding} setting is set diff --git a/pgjdbc/src/main/java/org/postgresql/PGStatement.java b/pgjdbc/src/main/java/org/postgresql/PGStatement.java index 1c2114d2f8..cbe3b2e86a 100644 --- a/pgjdbc/src/main/java/org/postgresql/PGStatement.java +++ b/pgjdbc/src/main/java/org/postgresql/PGStatement.java @@ -79,19 +79,4 @@ public interface PGStatement { * @since build 302 */ int getPrepareThreshold(); - - /** - * Method to turn on/off adaptive fetch for statement. Existing resultSets won't be affected by - * change here. - * - * @param adaptiveFetch desired state of adaptive fetch. - */ - void setAdaptiveFetch(boolean adaptiveFetch); - - /** - * Method to get state of adaptive fetch for statement. - * - * @return state of adaptive fetch (turned on or off) - */ - boolean getAdaptiveFetch(); } diff --git a/pgjdbc/src/main/java/org/postgresql/core/PGStream.java b/pgjdbc/src/main/java/org/postgresql/core/PGStream.java index b77598727d..1637bfae03 100644 --- a/pgjdbc/src/main/java/org/postgresql/core/PGStream.java +++ b/pgjdbc/src/main/java/org/postgresql/core/PGStream.java @@ -58,8 +58,6 @@ public class PGStream implements Closeable, Flushable { private long maxResultBuffer = -1; private long resultBufferByteCount = 0; - private int maxRowSize = -1; - /** * Constructor: Connect to the PostgreSQL back end and return a stream connection. * @@ -479,8 +477,6 @@ public Tuple receiveTupleV3() throws IOException, OutOfMemoryError, SQLException int nf = receiveInteger2(); //size = messageSize - 4 bytes of message size - 2 bytes of field count - 4 bytes for each column length int dataToReadSize = messageSize - 4 - 2 - 4 * nf; - setMaxRowSize(dataToReadSize); - byte[][] answer = new byte[nf][]; increaseByteCounter(dataToReadSize); @@ -647,46 +643,6 @@ public void setMaxResultBuffer(String value) throws PSQLException { maxResultBuffer = PGPropertyMaxResultBufferParser.parseProperty(value); } - /** - * Method to get MaxResultBuffer from PGStream. - * - * @return size of MaxResultBuffer - */ - public long getMaxResultBuffer() { - return maxResultBuffer; - } - - /** - * The idea behind this method is to keep in maxRowSize the size of biggest read data row. As - * there may be many data rows send after each other for a query, then value in maxRowSize would - * contain value noticed so far, because next data rows and their sizes are not read for that - * moment. We want it increasing, because the size of the biggest among data rows will be used - * during computing new adaptive fetch size for the query. - * - * @param rowSize new value to be set as maxRowSize - */ - public void setMaxRowSize(int rowSize) { - if (rowSize > maxRowSize) { - maxRowSize = rowSize; - } - } - - /** - * Method to get actual max row size noticed so far. - * - * @return value of max row size - */ - public int getMaxRowSize() { - return maxRowSize; - } - - /** - * Method to clear value of max row size noticed so far. - */ - public void clearMaxRowSize() { - maxRowSize = -1; - } - /** * Method to clear count of byte buffer. */ diff --git a/pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java b/pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java index d8958b1e78..b5c97244dc 100644 --- a/pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java +++ b/pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java @@ -145,25 +145,6 @@ public interface QueryExecutor extends TypeTransferModeRegistry { void execute(Query query, ParameterList parameters, ResultHandler handler, int maxRows, int fetchSize, int flags) throws SQLException; - /** - * Execute a Query with adaptive fetch, passing results to a provided ResultHandler. - * - * @param query the query to execute; must be a query returned from calling - * {@link #wrap(List)} on this QueryExecutor object. - * @param parameters the parameters for the query. Must be non-null if the query - * takes parameters. Must be a parameter object returned by - * {@link org.postgresql.core.Query#createParameterList()}. - * @param handler a ResultHandler responsible for handling results generated by this query - * @param maxRows the maximum number of rows to retrieve - * @param fetchSize if QUERY_FORWARD_CURSOR is set, the preferred number of rows to retrieve - * before suspending - * @param flags a combination of QUERY_* flags indicating how to handle the query. - * @param adaptiveFetch state of adaptiveFetch to use during execution - * @throws SQLException if query execution fails - */ - void execute(Query query, ParameterList parameters, ResultHandler handler, int maxRows, - int fetchSize, int flags, boolean adaptiveFetch) throws SQLException; - /** * Execute several Query, passing results to a provided ResultHandler. * @@ -184,37 +165,15 @@ void execute(Query query, ParameterList parameters, ResultHandler handler, int m void execute(Query[] queries, ParameterList[] parameterLists, BatchResultHandler handler, int maxRows, int fetchSize, int flags) throws SQLException; - /** - * Execute several Query with adaptive fetch, passing results to a provided ResultHandler. - * - * @param queries the queries to execute; each must be a query returned from calling - * {@link #wrap(List)} on this QueryExecutor object. - * @param parameterLists the parameter lists for the queries. The parameter lists correspond 1:1 - * to the queries passed in the queries array. Each must be non- - * null if the corresponding query takes parameters, and must be a parameter - * object returned by {@link org.postgresql.core.Query#createParameterList()} created by - * the corresponding query. - * @param handler a ResultHandler responsible for handling results generated by this query - * @param maxRows the maximum number of rows to retrieve - * @param fetchSize if QUERY_FORWARD_CURSOR is set, the preferred number of rows to retrieve - * before suspending - * @param flags a combination of QUERY_* flags indicating how to handle the query. - * @param adaptiveFetch state of adaptiveFetch to use during execution - * @throws SQLException if query execution fails - */ - void execute(Query[] queries, ParameterList[] parameterLists, BatchResultHandler handler, int maxRows, - int fetchSize, int flags, boolean adaptiveFetch) throws SQLException; - /** * Fetch additional rows from a cursor. * * @param cursor the cursor to fetch from * @param handler the handler to feed results to * @param fetchSize the preferred number of rows to retrieve before suspending - * @param adaptiveFetch state of adaptiveFetch to use during fetching * @throws SQLException if query execution fails */ - void fetch(ResultCursor cursor, ResultHandler handler, int fetchSize, boolean adaptiveFetch) throws SQLException; + void fetch(ResultCursor cursor, ResultHandler handler, int fetchSize) throws SQLException; /** * Create an unparameterized Query object suitable for execution by this QueryExecutor. The @@ -507,46 +466,4 @@ Object createQueryKey(String sql, boolean escapeProcessing, boolean isParameteri Map getParameterStatuses(); String getParameterStatus(String parameterName); - - /** - * Method to get fetch size computed by adaptive fetch size for given query. - * - * @param adaptiveFetch state of adaptive fetch, which should be used during retrieving - * @param cursor Cursor used by resultSet, containing query, have to be able to cast to - * Portal class. - * @return fetch size computed by adaptive fetch size for given query passed inside cursor - */ - int getAdaptiveFetchSize(boolean adaptiveFetch, ResultCursor cursor); - - /** - * Method to get state of adaptive fetch inside QueryExecutor. - * - * @return state of adaptive fetch inside QueryExecutor - */ - boolean getAdaptiveFetch(); - - /** - * Method to set state of adaptive fetch inside QueryExecutor. - * - * @param adaptiveFetch desired state of adaptive fetch - */ - void setAdaptiveFetch(boolean adaptiveFetch); - - /** - * Method to add query to adaptive fetch monitoring inside QueryExecutor. - * - * @param adaptiveFetch state of adaptive fetch used during adding query - * @param cursor Cursor used by resultSet, containing query, have to be able to cast to - * Portal class. - */ - void addQueryToAdaptiveFetchMonitoring(boolean adaptiveFetch, ResultCursor cursor); - - /** - * Method to remove query from adaptive fetch monitoring inside QueryExecutor - * - * @param adaptiveFetch state of adaptive fetch used during removing query - * @param cursor Cursor used by resultSet, containing query, have to be able to cast to - * Portal class. - */ - void removeQueryFromAdaptiveFetchMonitoring(boolean adaptiveFetch, ResultCursor cursor); } diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java b/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java index 4fd7c46698..ab06a88ba7 100644 --- a/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java +++ b/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java @@ -33,7 +33,6 @@ import org.postgresql.core.TransactionState; import org.postgresql.core.Tuple; import org.postgresql.core.Utils; -import org.postgresql.core.v3.adaptivefetch.AdaptiveFetchQueryMonitoring; import org.postgresql.core.v3.replication.V3ReplicationProtocol; import org.postgresql.jdbc.AutoSave; import org.postgresql.jdbc.BatchResultHandler; @@ -129,15 +128,10 @@ public class QueryExecutorImpl extends QueryExecutorBase { */ private final CommandCompleteParser commandCompleteParser = new CommandCompleteParser(); - private final AdaptiveFetchQueryMonitoring adaptiveFetchQueryMonitoring; - public QueryExecutorImpl(PGStream pgStream, String user, String database, int cancelSignalTimeout, Properties info) throws SQLException, IOException { super(pgStream, user, database, cancelSignalTimeout, info); - long maxResultBuffer = pgStream.getMaxResultBuffer(); - this.adaptiveFetchQueryMonitoring = new AdaptiveFetchQueryMonitoring(maxResultBuffer, info); - this.allowEncodingChanges = PGProperty.ALLOW_ENCODING_CHANGES.getBoolean(info); this.cleanupSavePoints = PGProperty.CLEANUP_SAVEPOINTS.getBoolean(info); this.replicationProtocol = new V3ReplicationProtocol(this, pgStream); @@ -282,11 +276,6 @@ private int updateQueryMode(int flags) { public synchronized void execute(Query query, ParameterList parameters, ResultHandler handler, int maxRows, int fetchSize, int flags) throws SQLException { - execute(query, parameters, handler, maxRows, fetchSize, flags, false); - } - - public synchronized void execute(Query query, ParameterList parameters, ResultHandler handler, - int maxRows, int fetchSize, int flags, boolean adaptiveFetch) throws SQLException { waitOnLock(); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, " simple execute, handler={0}, maxRows={1}, fetchSize={2}, flags={3}", @@ -314,14 +303,14 @@ public synchronized void execute(Query query, ParameterList parameters, ResultHa handler = sendQueryPreamble(handler, flags); autosave = sendAutomaticSavepoint(query, flags); sendQuery(query, (V3ParameterList) parameters, maxRows, fetchSize, flags, - handler, null, adaptiveFetch); + handler, null); if ((flags & QueryExecutor.QUERY_EXECUTE_AS_SIMPLE) != 0) { // Sync message is not required for 'Q' execution as 'Q' ends with ReadyForQuery message // on its own } else { sendSync(); } - processResults(handler, flags, adaptiveFetch); + processResults(handler, flags); estimatedReceiveBufferBytes = 0; } catch (PGBindException se) { // There are three causes of this error, an @@ -339,7 +328,7 @@ public synchronized void execute(Query query, ParameterList parameters, ResultHa // transaction in progress? // sendSync(); - processResults(handler, flags, adaptiveFetch); + processResults(handler, flags); estimatedReceiveBufferBytes = 0; handler .handleError(new PSQLException(GT.tr("Unable to bind parameter values for statement."), @@ -473,12 +462,6 @@ && getTransactionState() == TransactionState.FAILED public synchronized void execute(Query[] queries, ParameterList[] parameterLists, BatchResultHandler batchHandler, int maxRows, int fetchSize, int flags) throws SQLException { - execute(queries, parameterLists, batchHandler, maxRows, fetchSize, flags, false); - } - - public synchronized void execute(Query[] queries, ParameterList[] parameterLists, - BatchResultHandler batchHandler, int maxRows, int fetchSize, int flags, boolean adaptiveFetch) - throws SQLException { waitOnLock(); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, " batch execute {0} queries, handler={1}, maxRows={2}, fetchSize={3}, flags={4}", @@ -511,7 +494,7 @@ public synchronized void execute(Query[] queries, ParameterList[] parameterLists parameters = SimpleQuery.NO_PARAMETERS; } - sendQuery(query, parameters, maxRows, fetchSize, flags, handler, batchHandler, adaptiveFetch); + sendQuery(query, parameters, maxRows, fetchSize, flags, handler, batchHandler); if (handler.getException() != null) { break; @@ -525,7 +508,7 @@ public synchronized void execute(Query[] queries, ParameterList[] parameterLists } else { sendSync(); } - processResults(handler, flags, adaptiveFetch); + processResults(handler, flags); estimatedReceiveBufferBytes = 0; } } catch (IOException e) { @@ -1421,7 +1404,7 @@ private void flushIfDeadlockRisk(Query query, boolean disallowBatching, */ private void sendQuery(Query query, V3ParameterList parameters, int maxRows, int fetchSize, int flags, ResultHandler resultHandler, - BatchResultHandler batchHandler, boolean adaptiveFetch) throws IOException, SQLException { + BatchResultHandler batchHandler) throws IOException, SQLException { // Now the query itself. Query[] subqueries = query.getSubqueries(); SimpleParameterList[] subparams = parameters.getSubparams(); @@ -1436,9 +1419,6 @@ private void sendQuery(Query query, V3ParameterList parameters, int maxRows, int // If we saw errors, don't send anything more. if (resultHandler.getException() == null) { - if (fetchSize != 0) { - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, query); - } sendOneQuery((SimpleQuery) query, (SimpleParameterList) parameters, maxRows, fetchSize, flags); } @@ -1462,9 +1442,6 @@ private void sendQuery(Query query, V3ParameterList parameters, int maxRows, int if (subparams != null) { subparam = subparams[i]; } - if (fetchSize != 0) { - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, subquery); - } sendOneQuery((SimpleQuery) subquery, subparam, maxRows, fetchSize, flags); } } @@ -2048,11 +2025,6 @@ private void processDeadPortals() throws IOException { } protected void processResults(ResultHandler handler, int flags) throws IOException { - processResults(handler, flags, false); - } - - protected void processResults(ResultHandler handler, int flags, boolean adaptiveFetch) - throws IOException { boolean noResults = (flags & QueryExecutor.QUERY_NO_RESULTS) != 0; boolean bothRowsAndStatus = (flags & QueryExecutor.QUERY_BOTH_ROWS_AND_STATUS) != 0; @@ -2168,13 +2140,6 @@ protected void processResults(ResultHandler handler, int flags, boolean adaptive SimpleQuery currentQuery = executeData.query; Portal currentPortal = executeData.portal; - if (currentPortal != null) { - // Existence of portal defines if query was using fetching. - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, currentQuery, pgStream.getMaxRowSize()); - } - pgStream.clearMaxRowSize(); - Field[] fields = currentQuery.getFields(); if (fields != null && tuples == null) { // When no results expected, pretend an empty resultset was returned @@ -2201,17 +2166,6 @@ protected void processResults(ResultHandler handler, int flags, boolean adaptive SimpleQuery currentQuery = executeData.query; Portal currentPortal = executeData.portal; - if (currentPortal != null) { - //Existence of portal defines if query was using fetching. - - //Command executed, adaptive fetch size can be removed for this query, max row size can be cleared - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, currentQuery); - //Update to change fetch size for other fetch portals of this query - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, currentQuery, pgStream.getMaxRowSize()); - } - pgStream.clearMaxRowSize(); - if (status.startsWith("SET")) { String nativeSql = currentQuery.getNativeQuery().nativeSql; // Scan only the first 1024 characters to @@ -2480,8 +2434,8 @@ private void skipMessage() throws IOException { pgStream.skip(len - 4); } - public synchronized void fetch(ResultCursor cursor, ResultHandler handler, int fetchSize, - boolean adaptiveFetch) throws SQLException { + public synchronized void fetch(ResultCursor cursor, ResultHandler handler, int fetchSize) + throws SQLException { waitOnLock(); final Portal portal = (Portal) cursor; @@ -2504,7 +2458,7 @@ public void handleCommandStatus(String status, long updateCount, long insertOID) sendExecute(portal.getQuery(), portal, fetchSize); sendSync(); - processResults(handler, 0, adaptiveFetch); + processResults(handler, 0); estimatedReceiveBufferBytes = 0; } catch (IOException e) { abort(); @@ -2516,57 +2470,6 @@ public void handleCommandStatus(String status, long updateCount, long insertOID) handler.handleCompletion(); } - @Override - public int getAdaptiveFetchSize(boolean adaptiveFetch, ResultCursor cursor) { - try { - if (cursor instanceof Portal) { - return adaptiveFetchQueryMonitoring - .getFetchSizeForQuery(adaptiveFetch, ((Portal) cursor).getQuery()); - } - } catch (Exception ex) { - LOGGER.log(Level.WARNING, - "Exception returned during getting adaptive fetch size from QueryExecutorImpl:\n {0}", - ex.getMessage()); - } - return -1; - } - - @Override - public void setAdaptiveFetch(boolean adaptiveFetch) { - this.adaptiveFetchQueryMonitoring.setAdaptiveFetch(adaptiveFetch); - } - - @Override - public boolean getAdaptiveFetch() { - return this.adaptiveFetchQueryMonitoring.getAdaptiveFetch(); - } - - @Override - public void addQueryToAdaptiveFetchMonitoring(boolean adaptiveFetch, ResultCursor cursor) { - try { - if (cursor instanceof Portal) { - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, ((Portal) cursor).getQuery()); - } - } catch (Exception ex) { - LOGGER.log(Level.WARNING, - "Exception returned during adding query to Adaptive Fetch Monitoring inside QueryExecutorImpl:\n {0}", - ex.getMessage()); - } - } - - @Override - public void removeQueryFromAdaptiveFetchMonitoring(boolean adaptiveFetch, ResultCursor cursor) { - try { - if (cursor instanceof Portal) { - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, ((Portal) cursor).getQuery()); - } - } catch (Exception ex) { - LOGGER.log(Level.WARNING, - "Exception returned during removing query from Adaptive Fetch Monitoring inside QueryExecutorImpl:\n {0}", - ex.getMessage()); - } - } - /* * Receive the field descriptions from the back end. */ diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryInfo.java b/pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryInfo.java deleted file mode 100644 index 7ae09734ad..0000000000 --- a/pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2020, PostgreSQL Global Development Group - * See the LICENSE file in the project root for more information. - */ - -package org.postgresql.core.v3.adaptivefetch; - -public class AdaptiveFetchQueryInfo { - - //holds information about adaptive fetch size for query - private int size = -1; - //number of queries in execution using that query info - private int counter = 0; - //max row size saved for query so far - private int maxRowSize = -1; - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - public int getCounter() { - return counter; - } - - public void setCounter(int counter) { - this.counter = counter; - } - - public int getMaxRowSize() { - return maxRowSize; - } - - public void setMaxRowSize(int maxRowSize) { - this.maxRowSize = maxRowSize; - } -} diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoring.java b/pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoring.java deleted file mode 100644 index a8db379a9b..0000000000 --- a/pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoring.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2020, PostgreSQL Global Development Group - * See the LICENSE file in the project root for more information. - */ - -package org.postgresql.core.v3.adaptivefetch; - -import org.postgresql.PGProperty; -import org.postgresql.core.Query; - -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -/** - * The main purpose of this class is to handle adaptive fetching process. Adaptive fetching is used - * to compute fetch size to fully use size defined by maxResultBuffer. Computing is made by dividing - * maxResultBuffer size by max row result size noticed so far. Each query have separate adaptive - * fetch size computed, but same queries have it shared. If adaptive fetch is turned on, first fetch - * is going to be made with defaultRowFetchSize, next fetching of resultSet will be made with - * computed adaptive fetch size. If adaptive fetch is turned on during fetching, then first fetching - * made by ResultSet will be made with defaultRowFetchSize, next will use computed adaptive fetch - * size. Property adaptiveFetch need properties defaultRowFetchSize and maxResultBuffer to work. - */ -public class AdaptiveFetchQueryMonitoring { - - private final Map adaptiveFetchInfoMap; - private boolean adaptiveFetch = false; - private int minimumAdaptiveFetchSize = 0; - private int maximumAdaptiveFetchSize = -1; - private long maxResultBufferSize = -1; - - public AdaptiveFetchQueryMonitoring(long maxResultBufferSize, Properties info) - throws SQLException { - this.adaptiveFetchInfoMap = new HashMap(); - - this.adaptiveFetch = PGProperty.ADAPTIVE_FETCH.getBoolean(info); - this.minimumAdaptiveFetchSize = PGProperty.ADAPTIVE_FETCH_MINIMUM.getInt(info); - this.maximumAdaptiveFetchSize = PGProperty.ADAPTIVE_FETCH_MAXIMUM.getInt(info); - - this.maxResultBufferSize = maxResultBufferSize; - } - - /** - * Method to add query to being monitored and computing adaptive fetch size. - * - * @param adaptiveFetch state of adaptive fetch, which should be used during adding query - * @param query query to be monitored - */ - public void addNewQuery(boolean adaptiveFetch, Query query) { - if (adaptiveFetch && maxResultBufferSize != -1) { - String sql = query.getNativeSql().trim(); - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = adaptiveFetchInfoMap.get(sql); - if (adaptiveFetchQueryInfo == null) { - adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - } - adaptiveFetchQueryInfo.setCounter(adaptiveFetchQueryInfo.getCounter() + 1); - - adaptiveFetchInfoMap.put(sql, adaptiveFetchQueryInfo); - } - } - - /** - * Method to update adaptive fetch size for given query. - * - * @param adaptiveFetch state of adaptive fetch, which should be used during updating fetch size - * for query - * @param query query to be updated - * @param maxRowSize max row size used during updating information about adaptive fetch size - * for given query - */ - public void updateQueryFetchSize(boolean adaptiveFetch, Query query, int maxRowSize) { - if (adaptiveFetch && maxResultBufferSize != -1) { - String sql = query.getNativeSql().trim(); - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = adaptiveFetchInfoMap.get(sql); - if (adaptiveFetchQueryInfo != null) { - int adaptiveMaxRowSize = adaptiveFetchQueryInfo.getMaxRowSize(); - if (adaptiveMaxRowSize < maxRowSize && maxRowSize > 0) { - int newFetchSize = (int) (maxResultBufferSize / maxRowSize); - newFetchSize = adjustFetchSize(newFetchSize); - - adaptiveFetchQueryInfo.setMaxRowSize(maxRowSize); - adaptiveFetchQueryInfo.setSize(newFetchSize); - - adaptiveFetchInfoMap.put(sql, adaptiveFetchQueryInfo); - } - } - } - } - - /** - * Method to get adaptive fetch size for given query. - * - * @param adaptiveFetch state of adaptive fetch, which should be used during getting fetch size - * for query - * @param query query to which we want get adaptive fetch size - * @return adaptive fetch size for query or -1 if size doesn't exist/adaptive fetch state is false - */ - public int getFetchSizeForQuery(boolean adaptiveFetch, Query query) { - if (adaptiveFetch && maxResultBufferSize != -1) { - String sql = query.getNativeSql().trim(); - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = adaptiveFetchInfoMap.get(sql); - if (adaptiveFetchQueryInfo != null) { - return adaptiveFetchQueryInfo.getSize(); - } - } - return -1; - } - - /** - * Method to remove query information from monitoring. - * - * @param adaptiveFetch state of adaptive fetch, which should be used during removing fetch size - * for query - * @param query query to be removed from monitoring - */ - public void removeQuery(boolean adaptiveFetch, Query query) { - if (adaptiveFetch && maxResultBufferSize != -1) { - String sql = query.getNativeSql().trim(); - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = adaptiveFetchInfoMap.get(sql); - if (adaptiveFetchQueryInfo != null) { - adaptiveFetchQueryInfo.setCounter(adaptiveFetchQueryInfo.getCounter() - 1); - - if (adaptiveFetchQueryInfo.getCounter() < 1) { - adaptiveFetchInfoMap.remove(sql); - } else { - adaptiveFetchInfoMap.put(sql, adaptiveFetchQueryInfo); - } - } - } - } - - /** - * Method to set maximum and minimum constraints on given value. - * - * @param actualSize value which should be the computed fetch size - * @return value which meet the constraints - */ - private int adjustFetchSize(int actualSize) { - int size = adjustMaximumFetchSize(actualSize); - size = adjustMinimumFetchSize(size); - return size; - } - - /** - * Method to set minimum constraint on given value. - * - * @param actualSize value which should be the computed fetch size - * @return value which meet the minimum constraint - */ - private int adjustMinimumFetchSize(int actualSize) { - if (minimumAdaptiveFetchSize == 0) { - return actualSize; - } - if (minimumAdaptiveFetchSize > actualSize) { - return minimumAdaptiveFetchSize; - } else { - return actualSize; - } - } - - /** - * Method to set maximum constraint on given value. - * - * @param actualSize value which should be the computed fetch size - * @return value which meet the maximum constraint - */ - private int adjustMaximumFetchSize(int actualSize) { - if (maximumAdaptiveFetchSize == -1) { - return actualSize; - } - if (maximumAdaptiveFetchSize < actualSize) { - return maximumAdaptiveFetchSize; - } else { - return actualSize; - } - } - - /** - * Method to get state of adaptive fetch. - * - * @return state of adaptive fetch - */ - public boolean getAdaptiveFetch() { - return adaptiveFetch; - } - - /** - * Method to set state of adaptive fetch. - * - * @param adaptiveFetch desired state of adaptive fetch - */ - public void setAdaptiveFetch(boolean adaptiveFetch) { - this.adaptiveFetch = adaptiveFetch; - } -} diff --git a/pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java b/pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java index 0ddf0c73c3..cc5d30215e 100644 --- a/pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java +++ b/pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java @@ -1519,30 +1519,6 @@ public void setMaxResultBuffer(String maxResultBuffer) { PGProperty.MAX_RESULT_BUFFER.set(properties, maxResultBuffer); } - public boolean getAdaptiveFetch() { - return PGProperty.ADAPTIVE_FETCH.getBoolean(properties); - } - - public void setAdaptiveFetch(boolean adaptiveFetch) { - PGProperty.ADAPTIVE_FETCH.set(properties, adaptiveFetch); - } - - public int getAdaptiveFetchMaximum() { - return PGProperty.ADAPTIVE_FETCH_MAXIMUM.getIntNoCheck(properties); - } - - public void setAdaptiveFetchMaximum(int adaptiveFetchMaximum) { - PGProperty.ADAPTIVE_FETCH_MAXIMUM.set(properties, adaptiveFetchMaximum); - } - - public int getAdaptiveFetchMinimum() { - return PGProperty.ADAPTIVE_FETCH_MINIMUM.getIntNoCheck(properties); - } - - public void setAdaptiveFetchMinimum(int adaptiveFetchMinimum) { - PGProperty.ADAPTIVE_FETCH_MINIMUM.set(properties, adaptiveFetchMinimum); - } - //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.1" public java.util.logging.Logger getParentLogger() { return Logger.getLogger("org.postgresql"); diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java index c2905908d8..72e9639480 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java @@ -1823,14 +1823,4 @@ public final String getParameterStatus(String parameterName) { return queryExecutor.getParameterStatus(parameterName); } - @Override - public boolean getAdaptiveFetch() { - return queryExecutor.getAdaptiveFetch(); - } - - @Override - public void setAdaptiveFetch(boolean adaptiveFetch) { - queryExecutor.setAdaptiveFetch(adaptiveFetch); - } - } diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java index a10065869d..d626b63274 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java @@ -118,8 +118,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS private Tuple rowBuffer = null; // updateable rowbuffer protected int fetchSize; // Current fetch size (might be 0). - protected int lastUsedFetchSize; // Fetch size used during last fetch - protected boolean adaptiveFetch = false; protected ResultCursor cursor; // Cursor for fetching additional data. private Map columnNameIndexMap; // Speed up findColumn by caching lookups @@ -140,7 +138,7 @@ public ResultSetMetaData getMetaData() throws SQLException { PgResultSet(Query originalQuery, BaseStatement statement, Field[] fields, List tuples, ResultCursor cursor, int maxRows, int maxFieldSize, int rsType, int rsConcurrency, - int rsHoldability, boolean adaptiveFetch) throws SQLException { + int rsHoldability) throws SQLException { // Fail-fast on invalid null inputs if (tuples == null) { throw new NullPointerException("tuples must be non-null"); @@ -159,10 +157,6 @@ public ResultSetMetaData getMetaData() throws SQLException { this.maxFieldSize = maxFieldSize; this.resultsettype = rsType; this.resultsetconcurrency = rsConcurrency; - this.adaptiveFetch = adaptiveFetch; - - //Constructor doesn't have fetch size and can't be sure if fetch size was used so initial value would be the number of rows - this.lastUsedFetchSize = tuples.size(); } public java.net.URL getURL(int columnIndex) throws SQLException { @@ -821,13 +815,6 @@ public boolean isLast() throws SQLException { // Work out how many rows maxRows will let us fetch. int fetchRows = fetchSize; - int adaptiveFetchRows = connection.getQueryExecutor() - .getAdaptiveFetchSize(adaptiveFetch, cursor); - - if (adaptiveFetchRows != -1) { - fetchRows = adaptiveFetchRows; - } - if (maxRows != 0) { if (fetchRows == 0 || rowOffset + fetchRows > maxRows) { // Fetch would exceed maxRows, limit it. @@ -836,11 +823,7 @@ public boolean isLast() throws SQLException { } // Do the actual fetch. - connection.getQueryExecutor() - .fetch(cursor, new CursorResultHandler(), fetchRows, adaptiveFetch); - - //After fetch, update last used fetch size (could be useful during adaptive fetch). - lastUsedFetchSize = fetchRows; + connection.getQueryExecutor().fetch(cursor, new CursorResultHandler(), fetchRows); // Now prepend our one saved row and move to it. rows.add(0, thisRow); @@ -1595,50 +1578,6 @@ boolean isUpdateable() throws SQLException { return updateable; } - /** - * Method to turn on/off adaptive fetch for ResultSet. - * - * @param adaptiveFetch desired state of adaptive fetch. - * @throws SQLException exception returned if ResultSet is closed - */ - public void setAdaptiveFetch(boolean adaptiveFetch) throws SQLException { - checkClosed(); - updateQueryInsideAdaptiveFetchMonitoring(adaptiveFetch); - this.adaptiveFetch = adaptiveFetch; - } - - /** - * Method to update adaptive fetch monitoring during changing state of adaptive fetch inside - * ResultSet. Update inside AdaptiveFetchMonitoring is required to collect data about max result - * row length for that query to compute adaptive fetch size. - * - * @param newAdaptiveFetch new state of adaptive fetch - */ - private void updateQueryInsideAdaptiveFetchMonitoring(boolean newAdaptiveFetch) { - boolean localAdaptiveFetch = this.adaptiveFetch; - - if (localAdaptiveFetch == false && newAdaptiveFetch == true) { - //If we are here, that means we want to be added to adaptive fetch. - connection.getQueryExecutor().addQueryToAdaptiveFetchMonitoring(Boolean.TRUE, cursor); - } - - if (localAdaptiveFetch == true && newAdaptiveFetch == false) { - //If we are here, that means we want to be removed from adaptive fetch. - connection.getQueryExecutor().removeQueryFromAdaptiveFetchMonitoring(Boolean.TRUE, cursor); - } - } - - /** - * Method to get state of adaptive fetch for resultSet. - * - * @return state of adaptive fetch (turned on or off) - * @throws SQLException exception returned if ResultSet is closed - */ - public boolean getAdaptiveFetch() throws SQLException { - checkClosed(); - return adaptiveFetch; - } - /** * Cracks out the table name and schema (if it exists) from a fully qualified table name. * @@ -1855,23 +1794,7 @@ public void setFetchSize(int rows) throws SQLException { public int getFetchSize() throws SQLException { checkClosed(); - if (adaptiveFetch) { - return lastUsedFetchSize; - } else { - return fetchSize; - } - } - - /** - * Method to get fetch size used during last fetch. Returned value can be useful if using adaptive - * fetch. - * - * @return fetch size used during last fetch. - * @throws SQLException exception returned if ResultSet is closed - */ - public int getLastUsedFetchSize() throws SQLException { - checkClosed(); - return lastUsedFetchSize; + return fetchSize; } @Override @@ -1895,13 +1818,6 @@ public boolean next() throws SQLException { rowOffset += rows.size(); // We are discarding some data. int fetchRows = fetchSize; - int adaptiveFetchRows = connection.getQueryExecutor() - .getAdaptiveFetchSize(adaptiveFetch, cursor); - - if (adaptiveFetchRows != -1) { - fetchRows = adaptiveFetchRows; - } - if (maxRows != 0) { if (fetchRows == 0 || rowOffset + fetchRows > maxRows) { // Fetch would exceed maxRows, limit it. @@ -1910,11 +1826,7 @@ public boolean next() throws SQLException { } // Execute the fetch and update this resultset. - connection.getQueryExecutor() - .fetch(cursor, new CursorResultHandler(), fetchRows, adaptiveFetch); - - //After fetch, update last used fetch size (could be useful for adaptive fetch). - lastUsedFetchSize = fetchRows; + connection.getQueryExecutor().fetch(cursor, new CursorResultHandler(), fetchRows); currentRow = 0; diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java index 4469afef7e..00c089c3a4 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java @@ -137,8 +137,6 @@ public class PgStatement implements Statement, BaseStatement { protected int maxFieldSize = 0; - protected boolean adaptiveFetch = false; - PgStatement(PgConnection c, int rsType, int rsConcurrency, int rsHoldability) throws SQLException { this.connection = c; @@ -147,7 +145,6 @@ public class PgStatement implements Statement, BaseStatement { concurrency = rsConcurrency; setFetchSize(c.getDefaultFetchSize()); setPrepareThreshold(c.getPrepareThreshold()); - setAdaptiveFetch(c.getAdaptiveFetch()); this.rsHoldability = rsHoldability; } @@ -155,7 +152,7 @@ public ResultSet createResultSet(Query originalQuery, Field[] fields, List tuples) protected void transformQueriesAndParameters() throws SQLException { } - @Override - public void setAdaptiveFetch(boolean adaptiveFetch) { - this.adaptiveFetch = adaptiveFetch; - } - - @Override - public boolean getAdaptiveFetch() { - return adaptiveFetch; - } - } diff --git a/pgjdbc/src/test/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoringTest.java b/pgjdbc/src/test/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoringTest.java deleted file mode 100644 index 68c4c73969..0000000000 --- a/pgjdbc/src/test/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoringTest.java +++ /dev/null @@ -1,1087 +0,0 @@ -/* - * Copyright (c) 2020, PostgreSQL Global Development Group - * See the LICENSE file in the project root for more information. - */ - -package org.postgresql.core.v3.adaptivefetch; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import org.postgresql.PGProperty; -import org.postgresql.core.ParameterList; -import org.postgresql.core.Query; -import org.postgresql.core.SqlCommand; - -import org.junit.Before; -import org.junit.Test; - -import java.lang.reflect.Field; -import java.sql.SQLException; -import java.util.Map; -import java.util.Properties; - -/** - * Unit tests for AdaptiveFetchQueryMonitoring class. - */ -public class AdaptiveFetchQueryMonitoringTest { - - private AdaptiveFetchQueryMonitoring adaptiveFetchQueryMonitoring; - private int size; - - //string containing variable names in AdaptiveFetchQueryMonitoring class - private static String infoMapVariableName = "adaptiveFetchInfoMap"; - private static String minimumSizeVariableName = "minimumAdaptiveFetchSize"; - private static String maximumSizeVariableName = "maximumAdaptiveFetchSize"; - private static String adaptiveFetchVariableName = "adaptiveFetch"; - private static String maxBufferSizeVariableName = "maxResultBufferSize"; - - /** - * Simple setup to create new AdaptiveFetchQueryMonitoring with buffer size 1000. - */ - @Before - public void setUp() throws SQLException { - Properties properties = new Properties(); - size = 1000; - adaptiveFetchQueryMonitoring = new AdaptiveFetchQueryMonitoring(size, properties); - } - - /** - * Tests for calling constructor with empty properties (just asserts after setUp). - */ - @Test - public void testConstructorDefault() throws NoSuchFieldException, IllegalAccessException { - assertNotNull(getInfoMapVariable()); - assertEquals(size, getMaxBufferVariable()); - assertEquals(false, getAdaptiveFetchVariable()); - assertEquals(0, getMinimumSizeVariable()); - assertEquals(-1, getMaximumSizeVariable()); - } - - /** - * Test for calling constructor with information about adaptiveFetch property. - */ - @Test - public void testConstructorWithAdaptiveFetch() - throws SQLException, NoSuchFieldException, IllegalAccessException { - Properties properties = new Properties(); - boolean expectedValue = true; - PGProperty.ADAPTIVE_FETCH.set(properties, expectedValue); - - adaptiveFetchQueryMonitoring = new AdaptiveFetchQueryMonitoring(size, properties); - - assertNotNull(getInfoMapVariable()); - assertEquals(size, getMaxBufferVariable()); - assertEquals(expectedValue, getAdaptiveFetchVariable()); - assertEquals(0, getMinimumSizeVariable()); - assertEquals(-1, getMaximumSizeVariable()); - } - - /** - * Test for calling constructor with information about adaptiveFetchMinimum property. - */ - @Test - public void testConstructorWithMinimumSize() - throws SQLException, NoSuchFieldException, IllegalAccessException { - Properties properties = new Properties(); - int expectedValue = 100; - PGProperty.ADAPTIVE_FETCH_MINIMUM.set(properties, expectedValue); - - adaptiveFetchQueryMonitoring = new AdaptiveFetchQueryMonitoring(size, properties); - - assertNotNull(getInfoMapVariable()); - assertEquals(size, getMaxBufferVariable()); - assertEquals(false, getAdaptiveFetchVariable()); - assertEquals(expectedValue, getMinimumSizeVariable()); - assertEquals(-1, getMaximumSizeVariable()); - } - - /** - * Test for calling constructor with information about adaptiveFetchMaximum property. - */ - @Test - public void testConstructorWithMaximumSize() - throws SQLException, NoSuchFieldException, IllegalAccessException { - Properties properties = new Properties(); - int expectedValue = 100; - PGProperty.ADAPTIVE_FETCH_MAXIMUM.set(properties, expectedValue); - - adaptiveFetchQueryMonitoring = new AdaptiveFetchQueryMonitoring(size, properties); - - assertNotNull(getInfoMapVariable()); - assertEquals(size, getMaxBufferVariable()); - assertEquals(false, getAdaptiveFetchVariable()); - assertEquals(0, getMinimumSizeVariable()); - assertEquals(expectedValue, getMaximumSizeVariable()); - } - - /** - * Test for calling constructor with information about adaptiveFetch, adaptiveFetchMinimum and - * adaptiveFetchMaximum properties. - */ - @Test - public void testConstructorWithAllProperties() - throws SQLException, NoSuchFieldException, IllegalAccessException { - Properties properties = new Properties(); - boolean expectedAdaptiveFetchValue = false; - int expectedMinimumSizeValue = 70; - int expectedMaximumSizeValue = 130; - PGProperty.ADAPTIVE_FETCH.set(properties, expectedAdaptiveFetchValue); - PGProperty.ADAPTIVE_FETCH_MINIMUM.set(properties, expectedMinimumSizeValue); - PGProperty.ADAPTIVE_FETCH_MAXIMUM.set(properties, expectedMaximumSizeValue); - - adaptiveFetchQueryMonitoring = new AdaptiveFetchQueryMonitoring(size, properties); - - assertNotNull(getInfoMapVariable()); - assertEquals(size, getMaxBufferVariable()); - assertEquals(expectedAdaptiveFetchValue, getAdaptiveFetchVariable()); - assertEquals(expectedMinimumSizeValue, getMinimumSizeVariable()); - assertEquals(expectedMaximumSizeValue, getMaximumSizeVariable()); - } - - - /** - * Test for calling addNewQuery method. - */ - @Test - public void testAddingSingleQuery() throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = true; - - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - Map map = getInfoMapVariable(); - - assertEquals(1, map.size()); - assertNotNull(map.get(expectedQuery)); - } - - /** - * Test for calling addNewQuery method, but adaptiveFetch is set to false. - */ - @Test - public void testAddingSingleQueryWithoutAdaptiveFetch() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = false; - - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - Map map = getInfoMapVariable(); - - assertEquals(0, map.size()); - assertNull(map.get(expectedQuery)); - } - - /** - * Test for calling addNewQuery method twice with the same query. The query should be added only - * once, with counter set as 2. - */ - @Test - public void testAddingSameQueryTwoTimes() throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = true; - - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - Map map = getInfoMapVariable(); - - assertEquals(1, map.size()); - assertNotNull(map.get(expectedQuery)); - assertEquals(2, map.get(expectedQuery).getCounter()); - } - - /** - * Test for calling addNewQuery method twice with the same query, but with adaptiveFetch is set to - * false. The query shouldn't be added. - */ - @Test - public void testAddingSameQueryTwoTimesWithoutAdaptiveFetch() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = false; - - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - Map map = getInfoMapVariable(); - - assertEquals(0, map.size()); - assertNull(map.get(expectedQuery)); - } - - /** - * Test for calling addNewQuery method twice with different queries. Both queries should be - * added. - */ - @Test - public void testAddingTwoDifferentQueries() throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - String expectedQuery2 = "test-query-2"; - boolean adaptiveFetch = true; - - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery2)); - - Map map = getInfoMapVariable(); - - assertEquals(2, map.size()); - assertNotNull(map.get(expectedQuery)); - assertEquals(1, map.get(expectedQuery).getCounter()); - assertNotNull(map.get(expectedQuery2)); - assertEquals(1, map.get(expectedQuery).getCounter()); - } - - /** - * Test for calling addNewQuery method twice with different queries, but adeptiveFetch is set to - * false. Both queries shouldn't be added. - */ - @Test - public void testAddingTwoDifferentQueriesWithoutAdaptiveFetch() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - String expectedQuery2 = "test-query-2"; - boolean adaptiveFetch = false; - - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - adaptiveFetchQueryMonitoring.addNewQuery(adaptiveFetch, new MockUpQuery(expectedQuery2)); - - Map map = getInfoMapVariable(); - - assertEquals(0, map.size()); - assertNull(map.get(expectedQuery)); - } - - /** - * Test for calling getAdaptiveFetch method with value true. - */ - @Test - public void testGettingAdaptiveFetchIfTrue() - throws NoSuchFieldException, IllegalAccessException { - boolean expectedResult = true; - - setAdaptiveFetchVariable(expectedResult); - - assertEquals(expectedResult, adaptiveFetchQueryMonitoring.getAdaptiveFetch()); - } - - /** - * Test for calling getAdaptiveFetch method with value false. - */ - @Test - public void testGettingAdaptiveFetchIfFalse() - throws NoSuchFieldException, IllegalAccessException { - boolean expectedResult = false; - - setAdaptiveFetchVariable(expectedResult); - - assertEquals(expectedResult, adaptiveFetchQueryMonitoring.getAdaptiveFetch()); - } - - /** - * Test for calling getFetchSizeForQuery method for not existing query. Should return value -1. - */ - @Test - public void testGettingFetchSizeForNotExistingQuery() { - String expectedQuery = "test-query"; - boolean adaptiveFetch = true; - - int resultSize = adaptiveFetchQueryMonitoring - .getFetchSizeForQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(-1, resultSize); - } - - /** - * Test for calling getFetchSizeForQuery method for not existing query, but adaptiveFetch is set - * to false. Should return value -1. - */ - @Test - public void testGettingFetchSizeForNotExistingQueryIfAdaptiveFetchFalse() { - String expectedQuery = "test-query"; - boolean adaptiveFetch = false; - - int resultSize = adaptiveFetchQueryMonitoring - .getFetchSizeForQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(-1, resultSize); - } - - /** - * Test for calling getFetchSizeForQuery method for existing query. Should return set fetch size - * for the query. - */ - @Test - public void testGettingFetchSizeForExistingQuery() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = true; - - Map map = getInfoMapVariable(); - - int expectedSize = 500; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(expectedSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - int resultSize = adaptiveFetchQueryMonitoring - .getFetchSizeForQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(expectedSize, resultSize); - } - - /** - * Test for calling getFetchSizeForQuery method for existing query, but adaptiveFetch is set to - * false. Should return value -1. - */ - @Test - public void testGettingFetchSizeForExistingQueryIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = false; - - Map map = getInfoMapVariable(); - - int newSize = 500; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(newSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - int resultSize = adaptiveFetchQueryMonitoring - .getFetchSizeForQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(-1, resultSize); - } - - /** - * Test for calling removeQuery method for not existing query. Should nothing happen. - */ - @Test - public void testRemovingNotExistingQuery() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = true; - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - Map map = getInfoMapVariable(); - - assertEquals(0, map.size()); - } - - /** - * Test for calling removeQuery method for not existing query, but adaptiveFetch is set false. - * Should nothing happen. - */ - @Test - public void testRemovingNotExistingQueryIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = false; - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - Map map = getInfoMapVariable(); - - assertEquals(0, map.size()); - } - - /** - * Test for calling removeQuery method for existing query. The query should be removed from the - * map inside AdaptiveFetchQueryMonitoring. - */ - @Test - public void testRemovingExistingQuery() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = true; - - Map map = getInfoMapVariable(); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setCounter(1); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - assertEquals(1, map.size()); - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(0, map.size()); - assertNull(map.get(expectedQuery)); - } - - /** - * Test for calling removeQuery method for existing query, but adaptiveFetch is set false. The - * query shouldn't be removed. - */ - @Test - public void testRemovingExistingQueryIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = false; - - Map map = getInfoMapVariable(); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setCounter(1); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - assertEquals(1, map.size()); - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(1, map.size()); - assertNotNull(map.get(expectedQuery)); - assertEquals(1, map.get(expectedQuery).getCounter()); - } - - /** - * Test for calling removeQuery method for existing query with counter set to 2. After first call, - * query shouldn't be removed, but counter set to 1. After second call, query should be removed. - */ - @Test - public void testRemovingExistingQueryWithLargeCounter() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = true; - - Map map = getInfoMapVariable(); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setCounter(2); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(1, map.size()); - assertNotNull(map.get(expectedQuery)); - assertEquals(1, map.get(expectedQuery).getCounter()); - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(0, map.size()); - assertNull(map.get(expectedQuery)); - } - - /** - * Test for calling removeQuery method for existing query with counter set to 2, but with - * adaptiveFetch set false. After both calls query should be removed and counter shouldn't - * change. - */ - @Test - public void testRemovingExistingQueryWithLargeCounterIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query"; - boolean adaptiveFetch = false; - - Map map = getInfoMapVariable(); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setCounter(2); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(1, map.size()); - assertNotNull(map.get(expectedQuery)); - assertEquals(2, map.get(expectedQuery).getCounter()); - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - assertEquals(1, map.size()); - assertNotNull(map.get(expectedQuery)); - assertEquals(2, map.get(expectedQuery).getCounter()); - } - - /** - * Test for calling removeQuery method for existing query with more queries put in the map. Only - * query used in method call should be removed, other shouldn't change. - */ - @Test - public void testRemovingExistingQueryWithMoreQueriesMonitored() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - String expectedQuery2 = "test-query-2"; - String expectedQuery3 = "test-query-3"; - boolean adaptiveFetch = true; - - Map map = getInfoMapVariable(); - - int expectedCounter1 = 1; - int expectedCounter2 = 37; - int expectedCounter3 = 14; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo1 = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo1.setCounter(expectedCounter1); - map.put(expectedQuery, adaptiveFetchQueryInfo1); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo2 = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo2.setCounter(expectedCounter2); - map.put(expectedQuery2, adaptiveFetchQueryInfo2); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo3 = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo3.setCounter(expectedCounter3); - map.put(expectedQuery3, adaptiveFetchQueryInfo3); - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - AdaptiveFetchQueryInfo resultInfo1 = map.get(expectedQuery); - AdaptiveFetchQueryInfo resultInfo2 = map.get(expectedQuery2); - AdaptiveFetchQueryInfo resultInfo3 = map.get(expectedQuery3); - - assertEquals(2, map.size()); - assertNull(resultInfo1); - assertNotNull(resultInfo2); - assertEquals(adaptiveFetchQueryInfo2, resultInfo2); - assertEquals(expectedCounter2, resultInfo2.getCounter()); - assertNotNull(resultInfo3); - assertEquals(adaptiveFetchQueryInfo3, resultInfo3); - assertEquals(expectedCounter3, resultInfo3.getCounter()); - } - - /** - * Test for calling removeQuery method for existing query with more queries put in the map, but - * adaptiveFetch is set false. Queries shouldn't change - */ - @Test - public void testRemovingExistingQueryWithMoreQueriesMonitoredIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - String expectedQuery2 = "test-query-2"; - String expectedQuery3 = "test-query-3"; - boolean adaptiveFetch = false; - - Map map = getInfoMapVariable(); - - int expectedCounter1 = 1; - int expectedCounter2 = 37; - int expectedCounter3 = 14; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo1 = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo1.setCounter(expectedCounter1); - map.put(expectedQuery, adaptiveFetchQueryInfo1); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo2 = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo2.setCounter(expectedCounter2); - map.put(expectedQuery2, adaptiveFetchQueryInfo2); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo3 = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo3.setCounter(expectedCounter3); - map.put(expectedQuery3, adaptiveFetchQueryInfo3); - - adaptiveFetchQueryMonitoring.removeQuery(adaptiveFetch, new MockUpQuery(expectedQuery)); - - AdaptiveFetchQueryInfo resultInfo1 = map.get(expectedQuery); - AdaptiveFetchQueryInfo resultInfo2 = map.get(expectedQuery2); - AdaptiveFetchQueryInfo resultInfo3 = map.get(expectedQuery3); - - assertEquals(3, map.size()); - assertNotNull(resultInfo1); - assertEquals(adaptiveFetchQueryInfo1, resultInfo1); - assertEquals(expectedCounter1, resultInfo1.getCounter()); - assertNotNull(resultInfo2); - assertEquals(adaptiveFetchQueryInfo2, resultInfo2); - assertEquals(expectedCounter2, resultInfo2.getCounter()); - assertNotNull(resultInfo3); - assertEquals(adaptiveFetchQueryInfo3, resultInfo3); - assertEquals(expectedCounter3, resultInfo3.getCounter()); - } - - /** - * Test for calling setAdaptiveFetch method with true value. - */ - @Test - public void testSettingAdaptiveFetchAsTrue() - throws NoSuchFieldException, IllegalAccessException { - boolean expectedAdaptiveFetch = true; - - adaptiveFetchQueryMonitoring.setAdaptiveFetch(expectedAdaptiveFetch); - - boolean resultAdaptiveFetch = getAdaptiveFetchVariable(); - - assertEquals(expectedAdaptiveFetch, resultAdaptiveFetch); - } - - /** - * Test for calling setAdaptiveFetch method with false value. - */ - @Test - public void testSettingAdaptiveFetchAsFalse() - throws NoSuchFieldException, IllegalAccessException { - boolean expectedAdaptiveFetch = false; - - adaptiveFetchQueryMonitoring.setAdaptiveFetch(expectedAdaptiveFetch); - - boolean resultAdaptiveFetch = getAdaptiveFetchVariable(); - - assertEquals(expectedAdaptiveFetch, resultAdaptiveFetch); - } - - /** - * Test for calling updateQueryFetchSize method. Method should update a value for a query. - */ - @Test - public void testUpdatingAdaptiveFetchSize() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - boolean adaptiveFetch = true; - - Map map = getInfoMapVariable(); - - int rowSize = 33; - int startSize = size / rowSize - 15; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - - assertNotNull(resultInfo); - assertEquals(size / rowSize, resultInfo.getSize()); - } - - /** - * Test for calling updateQueryFetchSize method, but adaptiveFetch is set false. Method shouldn't - * update any values. - */ - @Test - public void testUpdatingAdaptiveFetchSizeIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - boolean adaptiveFetch = false; - - Map map = getInfoMapVariable(); - - int rowSize = 33; - int startSize = size / rowSize - 15; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - - assertNotNull(resultInfo); - assertEquals(startSize, resultInfo.getSize()); - } - - /** - * Test for calling updateQueryFetchSize method for not existing query. Method shouldn't update - * any values. - */ - @Test - public void testUpdatingAdaptiveFetchSizeForNotExistingQuery() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - String expectedQuery2 = "test-query-2"; - boolean adaptiveFetch = true; - - Map map = getInfoMapVariable(); - - int rowSize = 33; - int startSize = size / rowSize - 15; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery2, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - AdaptiveFetchQueryInfo resultInfo2 = map.get(expectedQuery2); - - assertNull(resultInfo); - assertNotNull(resultInfo2); - assertEquals(adaptiveFetchQueryInfo, resultInfo2); - assertEquals(startSize, resultInfo2.getSize()); - assertEquals(1, map.size()); - } - - /** - * Test for calling updateQueryFetchSize method for not existing query, but adaptiveFetch is set - * false. Method shouldn't update any values. - */ - @Test - public void testUpdatingAdaptiveFetchSizeForNotExistingQueryIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - String expectedQuery2 = "test-query-2"; - boolean adaptiveFetch = false; - - Map map = getInfoMapVariable(); - - int rowSize = 33; - int startSize = size / rowSize - 15; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery2, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - AdaptiveFetchQueryInfo resultInfo2 = map.get(expectedQuery2); - - assertNull(resultInfo); - assertNotNull(resultInfo2); - assertEquals(adaptiveFetchQueryInfo, resultInfo2); - assertEquals(startSize, resultInfo2.getSize()); - assertEquals(1, map.size()); - } - - /** - * Test for calling updateQueryFetchSize method in a situation when there are more queries saved - * in a map. The method should only change value for query used in a call. - */ - @Test - public void testUpdatingAdaptiveFetchSizeWithMoreQueriesInMap() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - String expectedQuery2 = "test-query-2"; - boolean adaptiveFetch = true; - - Map map = getInfoMapVariable(); - - int rowSize = 33; - int startSize = size / rowSize - 15; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo2 = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo2.setSize(startSize); - map.put(expectedQuery2, adaptiveFetchQueryInfo2); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - AdaptiveFetchQueryInfo resultInfo2 = map.get(expectedQuery2); - - assertNotNull(resultInfo); - assertEquals(adaptiveFetchQueryInfo, resultInfo); - assertEquals(size / rowSize, resultInfo.getSize()); - assertNotNull(resultInfo2); - assertEquals(adaptiveFetchQueryInfo2, resultInfo2); - assertEquals(startSize, resultInfo2.getSize()); - assertEquals(2, map.size()); - } - - /** - * Test for calling updateQueryFetchSize method in a situation when there are more queries saved - * in a map, but adaptiveFetch is set false. The method shouldn't change any values. - */ - @Test - public void testUpdatingAdaptiveFetchSizeWithMoreQueriesInMapIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - String expectedQuery2 = "test-query-2"; - boolean adaptiveFetch = false; - - Map map = getInfoMapVariable(); - - int rowSize = 33; - int startSize = size / rowSize - 15; - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo2 = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo2.setSize(startSize); - map.put(expectedQuery2, adaptiveFetchQueryInfo2); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - AdaptiveFetchQueryInfo resultInfo2 = map.get(expectedQuery2); - - assertNotNull(resultInfo); - assertEquals(adaptiveFetchQueryInfo, resultInfo); - assertEquals(startSize, resultInfo.getSize()); - assertNotNull(resultInfo2); - assertEquals(adaptiveFetchQueryInfo2, resultInfo2); - assertEquals(startSize, resultInfo2.getSize()); - assertEquals(2, map.size()); - } - - /** - * Test for calling updateQueryFetchSize method with value to make computed value below minimum - * value. The method should update a query to have value of minimum. - */ - @Test - public void testUpdatingAdaptiveFetchSizeWithMinimumSize() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - boolean adaptiveFetch = true; - - int rowSize = size + 1000; - int startSize = 2; - int expectedSize = 10; - - setMinimumSizeVariable(expectedSize); - - Map map = getInfoMapVariable(); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - - assertNotNull(resultInfo); - assertEquals(expectedSize, resultInfo.getSize()); - } - - /** - * Test for calling updateQueryFetchSize method with value to make computed value below minimum - * value, but adaptiveFetch is set false. The method shouldn't update size for a query. - */ - @Test - public void testUpdatingAdaptiveFetchSizeWithMinimumSizeIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - boolean adaptiveFetch = false; - - int rowSize = size + 1000; - int startSize = 2; - int expectedSize = 10; - - setMinimumSizeVariable(expectedSize); - - Map map = getInfoMapVariable(); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - - assertNotNull(resultInfo); - assertEquals(startSize, resultInfo.getSize()); - } - - /** - * Test for calling updateQueryFetchSize method with value to make computed value above maximum - * value. The method should update a query to have value of maximum. - */ - @Test - public void testUpdatingAdaptiveFetchSizeWithMaximumSize() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - boolean adaptiveFetch = true; - - int rowSize = 1; - int startSize = 2; - int expectedSize = size / rowSize - 20; - - setMaximumSizeVariable(expectedSize); - - Map map = getInfoMapVariable(); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - - assertNotNull(resultInfo); - assertEquals(expectedSize, resultInfo.getSize()); - } - - /** - * Test for calling updateQueryFetchSize method with value to make computed value below maximum - * value, but adaptiveFetch is set false. The method shouldn't update size for a query. - */ - @Test - public void testUpdatingAdaptiveFetchSizeWithMaximumSizeIfAdaptiveFetchFalse() - throws NoSuchFieldException, IllegalAccessException { - String expectedQuery = "test-query-1"; - boolean adaptiveFetch = false; - - int rowSize = 1; - int startSize = 2; - int expectedSize = size / rowSize - 20; - - setMaximumSizeVariable(expectedSize); - - Map map = getInfoMapVariable(); - - AdaptiveFetchQueryInfo adaptiveFetchQueryInfo = new AdaptiveFetchQueryInfo(); - adaptiveFetchQueryInfo.setSize(startSize); - map.put(expectedQuery, adaptiveFetchQueryInfo); - - adaptiveFetchQueryMonitoring - .updateQueryFetchSize(adaptiveFetch, new MockUpQuery(expectedQuery), rowSize); - - AdaptiveFetchQueryInfo resultInfo = map.get(expectedQuery); - - assertNotNull(resultInfo); - assertEquals(startSize, resultInfo.getSize()); - } - - //here are methods for retrieving values from adaptiveFetchQueryMonitoring without calling methods - - private Map getInfoMapVariable() - throws IllegalAccessException, NoSuchFieldException { - Field field = adaptiveFetchQueryMonitoring.getClass().getDeclaredField(infoMapVariableName); - field.setAccessible(true); - return (Map) field.get(adaptiveFetchQueryMonitoring); - } - - private int getMinimumSizeVariable() throws NoSuchFieldException, IllegalAccessException { - Field field = adaptiveFetchQueryMonitoring.getClass().getDeclaredField(minimumSizeVariableName); - field.setAccessible(true); - return (Integer) field.get(adaptiveFetchQueryMonitoring); - } - - private int getMaximumSizeVariable() throws NoSuchFieldException, IllegalAccessException { - Field field = adaptiveFetchQueryMonitoring.getClass().getDeclaredField(maximumSizeVariableName); - field.setAccessible(true); - return (Integer) field.get(adaptiveFetchQueryMonitoring); - } - - private boolean getAdaptiveFetchVariable() throws NoSuchFieldException, IllegalAccessException { - Field field = adaptiveFetchQueryMonitoring.getClass() - .getDeclaredField(adaptiveFetchVariableName); - field.setAccessible(true); - return (Boolean) field.get(adaptiveFetchQueryMonitoring); - } - - private long getMaxBufferVariable() throws NoSuchFieldException, IllegalAccessException { - Field field = adaptiveFetchQueryMonitoring.getClass() - .getDeclaredField(maxBufferSizeVariableName); - field.setAccessible(true); - return (Long) field.get(adaptiveFetchQueryMonitoring); - } - - private void setMinimumSizeVariable(int value) - throws NoSuchFieldException, IllegalAccessException { - Field field = adaptiveFetchQueryMonitoring.getClass().getDeclaredField(minimumSizeVariableName); - field.setAccessible(true); - field.set(adaptiveFetchQueryMonitoring, value); - } - - private void setMaximumSizeVariable(int value) - throws NoSuchFieldException, IllegalAccessException { - Field field = adaptiveFetchQueryMonitoring.getClass() - .getDeclaredField(maxBufferSizeVariableName); - field.setAccessible(true); - field.set(adaptiveFetchQueryMonitoring, value); - } - - private void setAdaptiveFetchVariable(boolean value) - throws NoSuchFieldException, IllegalAccessException { - Field field = adaptiveFetchQueryMonitoring.getClass() - .getDeclaredField(adaptiveFetchVariableName); - field.setAccessible(true); - field.set(adaptiveFetchQueryMonitoring, value); - } - - private void setMaxBufferVariable(long value) - throws NoSuchFieldException, IllegalAccessException { - Field field = adaptiveFetchQueryMonitoring.getClass() - .getDeclaredField(maxBufferSizeVariableName); - field.setAccessible(true); - field.set(adaptiveFetchQueryMonitoring, value); - } - - /** - * Class to mock object with Query interface. As AdaptiveFetchQueryMonitoring is using only - * getNativeSql method from Query interface, other shouldn't be called. - */ - private class MockUpQuery implements Query { - - public String sql; - - MockUpQuery(String sql) { - this.sql = sql; - } - - @Override - public ParameterList createParameterList() { - throw new WrongMethodCallException("Method shouldn't be called."); - } - - @Override - public String toString(ParameterList parameters) { - throw new WrongMethodCallException("Method shouldn't be called."); - } - - @Override - public String getNativeSql() { - return this.sql; - } - - @Override - public SqlCommand getSqlCommand() { - throw new WrongMethodCallException("Method shouldn't be called."); - } - - @Override - public void close() { - throw new WrongMethodCallException("Method shouldn't be called."); - } - - @Override - public boolean isStatementDescribed() { - throw new WrongMethodCallException("Method shouldn't be called."); - } - - @Override - public boolean isEmpty() { - throw new WrongMethodCallException("Method shouldn't be called."); - } - - @Override - public int getBatchSize() { - throw new WrongMethodCallException("Method shouldn't be called."); - } - - @Override - public Map getResultSetColumnNameIndexMap() { - throw new WrongMethodCallException("Method shouldn't be called."); - } - - @Override - public Query[] getSubqueries() { - throw new WrongMethodCallException("Method shouldn't be called."); - } - } - - /** - * An exception used when method shouldn't be called in MockUpQuery class. - */ - private class WrongMethodCallException extends RuntimeException { - - WrongMethodCallException(String msg) { - super(msg); - } - - } - -} diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java index 1092f80597..653512f820 100644 --- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java +++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java @@ -13,7 +13,6 @@ import org.postgresql.core.ReturningParserTest; import org.postgresql.core.UTF8EncodingTest; import org.postgresql.core.v3.V3ParameterListTests; -import org.postgresql.core.v3.adaptivefetch.AdaptiveFetchQueryMonitoringTest; import org.postgresql.jdbc.DeepBatchedInsertStatementTest; import org.postgresql.jdbc.NoColumnMetadataIssue1613Test; import org.postgresql.jdbc.PgSQLXMLTest; @@ -41,7 +40,6 @@ */ @RunWith(Suite.class) @Suite.SuiteClasses({ - AdaptiveFetchQueryMonitoringTest.class, ANTTest.class, ArrayTest.class, BatchedInsertReWriteEnabledTest.class, diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java deleted file mode 100644 index 5fd3e38757..0000000000 --- a/pgjdbc/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 2020, PostgreSQL Global Development Group - * See the LICENSE file in the project root for more information. - */ - -package org.postgresql.test.jdbc42; - -import static org.junit.Assert.assertEquals; - -import org.postgresql.PGConnection; -import org.postgresql.PGProperty; -import org.postgresql.jdbc.PreferQueryMode; -import org.postgresql.test.TestUtil; - -import org.junit.After; -import org.junit.Assume; -import org.junit.Test; - -import java.lang.management.ManagementFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Properties; - -/** - * Integration tests for adaptive fetch process. - */ -public class AdaptiveFetchSizeTest { - - private Connection connection; - private PreparedStatement statement; - private ResultSet resultSet; - - private String table = "test_adaptive_fetch"; - private String columns = "value VARCHAR"; - - /** - * Method to drop table and close connection. - */ - @After - public void tearDown() throws SQLException { - if (connection != null && !connection.isClosed()) { - connection.setAutoCommit(true); - if (resultSet != null) { - resultSet.close(); - } - if (statement != null) { - statement.close(); - } - TestUtil.dropTable(connection, table); - TestUtil.closeDB(connection); - } - } - - /** - * First integration test. First is created table with rows sizes like 4 x 35B, 1 x 40B, 45 x 30B. - * Next fetching is happening. First fetch is using default fetch size, so it returns 4 rows. - * After reading 4 rows, new fetch size is computed. As biggest rows size so far was 35B, then - * 300/35B = 8 rows. Second fetch is done with 8 rows. First row in this fetch has size 40B, which - * gonna change fetch size to 7 rows (300/40B = 7), next fetch reads won't change size and 7 will - * be used to the end. - * To check if this works correctly checked is: - * - if first 4 rows from result set have fetch size as 4; - * - if next 8 rows from result set have fetch size as 8; - * - if next 38 rows from result set have fetch size as 7; - * - check if all 50 rows were read. - */ - @Test - public void testAdaptiveFetching() throws SQLException { - int startFetchSize = 4; - int expectedFirstSize = 8; - int expectedSecondSize = 7; - int expectedCounter = 50; - int resultCounter = 0; - - Properties properties = new Properties(); - PGProperty.DEFAULT_ROW_FETCH_SIZE.set(properties, startFetchSize); - PGProperty.MAX_RESULT_BUFFER.set(properties, "300"); - PGProperty.ADAPTIVE_FETCH.set(properties, true); - - openConnectionAndCreateTable(properties); - - for (int i = 0; i != expectedCounter; i++) { - if (i == 4) { - addStringWithSize(40); - } else { - addStringWithSize(35); - } - } - - executeFetchingQuery(); - - for (int i = 0; i != 4; i++) { - resultSet.next(); - resultCounter++; - assertEquals(startFetchSize, resultSet.getFetchSize()); - } - for (int i = 0; i != 8; i++) { - resultSet.next(); - resultCounter++; - assertEquals(expectedFirstSize, resultSet.getFetchSize()); - } - while (resultSet.next()) { - resultCounter++; - assertEquals(expectedSecondSize, resultSet.getFetchSize()); - } - - assertEquals(expectedCounter, resultCounter); - } - - /** - * Second integration test. The main purpose of this set is to check if minimum size was used - * during adaptive fetching. To a table are added 50 rows with sizes: 1x270B, 49x10B. First fetch - * is done with default size 4. As first row from result set have size 270B, then computed size - * should be 1 (300/270 = 1), however minimum size set to 10 should make that next fetch should be - * done with size 10. After this fetch size shouldn't change to the end. - * To check if this works correctly checked is: - * - if first 4 rows from result set have fetch size as 4; - * - if next 46 rows from result set have fetch size as 10; - * - check if all 50 rows were read. - */ - @Test - public void testAdaptiveFetchingWithMinimumSize() throws SQLException { - int startFetchSize = 4; - int expectedSize = 10; - int expectedCounter = 50; - int resultCounter = 0; - - Properties properties = new Properties(); - PGProperty.DEFAULT_ROW_FETCH_SIZE.set(properties, startFetchSize); - PGProperty.MAX_RESULT_BUFFER.set(properties, "300"); - PGProperty.ADAPTIVE_FETCH.set(properties, true); - PGProperty.ADAPTIVE_FETCH_MINIMUM.set(properties, expectedSize); - - openConnectionAndCreateTable(properties); - - for (int i = 0; i != expectedCounter; i++) { - if (i == 0) { - addStringWithSize(270); - } else { - addStringWithSize(10); - } - } - - executeFetchingQuery(); - - for (int i = 0; i != 4; i++) { - resultSet.next(); - resultCounter++; - assertEquals(startFetchSize, resultSet.getFetchSize()); - } - while (resultSet.next()) { - resultCounter++; - assertEquals(expectedSize, resultSet.getFetchSize()); - } - - assertEquals(expectedCounter, resultCounter); - } - - /** - * Third integration test. The main purpose of this set is to check if maximum size was used - * during adaptive fetching. To a table are added 50 rows with sizes: 4x10B, 46x30B. First fetch - * is done with default size 4. As first fetch have only rows with size 10B, then computed fetch - * size should be 30 (300/10 = 30), however maximum size set to 10 should make that next fetch - * should be done with size 10 (in other situation next rows will exceed size of maxResultBuffer). - * After this fetch size shouldn't change to the end. - * To check if this works correctly checked is: - * - if first 4 rows from result set have fetch size as 4; - * - if next 46 rows from result set have fetch size as 10; - * - check if all 50 rows were read. - */ - @Test - public void testAdaptiveFetchingWithMaximumSize() throws SQLException { - int startFetchSize = 4; - int expectedSize = 10; - int expectedCounter = 50; - int resultCounter = 0; - - Properties properties = new Properties(); - PGProperty.DEFAULT_ROW_FETCH_SIZE.set(properties, startFetchSize); - PGProperty.MAX_RESULT_BUFFER.set(properties, "300"); - PGProperty.ADAPTIVE_FETCH.set(properties, true); - PGProperty.ADAPTIVE_FETCH_MAXIMUM.set(properties, expectedSize); - - openConnectionAndCreateTable(properties); - - for (int i = 0; i != expectedCounter; i++) { - if (i < 4) { - addStringWithSize(10); - } else { - addStringWithSize(30); - } - } - - executeFetchingQuery(); - - for (int i = 0; i != 4; i++) { - resultSet.next(); - resultCounter++; - assertEquals(startFetchSize, resultSet.getFetchSize()); - } - while (resultSet.next()) { - resultCounter++; - assertEquals(expectedSize, resultSet.getFetchSize()); - } - - assertEquals(expectedCounter, resultCounter); - } - - /** - * Third integration test. The main purpose of this set is to do fetching with maximum possible - * buffer. To a table are added 1000 rows with sizes 10B each. First fetch is done with default - * size 4, then second fetch should have size computed on maxResultBuffer, most probably that - * second fetch would be the last. - * To check if this works correctly checked is: - * - if first 4 rows from result set have fetch size as 4; - * - if next 996 rows from result set have fetch size computed with using max size of - * maxResultBuffer; - * - check if all 1000 rows were read. - */ - @Test - public void testAdaptiveFetchingWithMoreData() throws SQLException { - int startFetchSize = 4; - int expectedCounter = 1000; - int resultCounter = 0; - int expectedSize = (int) ( - (long) (0.90 * ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax()) / 10); - - Properties properties = new Properties(); - PGProperty.DEFAULT_ROW_FETCH_SIZE.set(properties, startFetchSize); - PGProperty.MAX_RESULT_BUFFER.set(properties, "90p"); - PGProperty.ADAPTIVE_FETCH.set(properties, true); - - openConnectionAndCreateTable(properties); - - for (int i = 0; i != expectedCounter; i++) { - addStringWithSize(10); - } - - executeFetchingQuery(); - - for (int i = 0; i != 4; i++) { - resultSet.next(); - resultCounter++; - assertEquals(startFetchSize, resultSet.getFetchSize()); - } - while (resultSet.next()) { - resultCounter++; - assertEquals(expectedSize, resultSet.getFetchSize()); - } - - assertEquals(expectedCounter, resultCounter); - } - - /** - * Method to execute query, which gonna be fetched. Sets auto commit to false to make fetching - * happen. - */ - private void executeFetchingQuery() throws SQLException { - connection.setAutoCommit(false); - - statement = connection.prepareStatement("SELECT * FROM " + table); - resultSet = statement.executeQuery(); - } - - /** - * Method to insert string with given size to a table. - * - * @param size desired size of a string to be inserted in the table - */ - private void addStringWithSize(int size) throws SQLException { - StringBuilder sb = new StringBuilder(size + 2); - sb.append("'"); - for (int i = 0; i != size; i++) { - sb.append('H'); - } - sb.append("'"); - String insert = TestUtil.insertSQL(table, "value", sb.toString()); - TestUtil.execute(insert, connection); - } - - /** - * Method to open connection, check if fetch can be performed and create table. - * - * @param properties Properties to be used during opening connection. - */ - private void openConnectionAndCreateTable(Properties properties) throws SQLException { - connection = TestUtil.openDB(properties); - //After opening connection we should check if will be possible to do a fetch - checkIfFetchTestCanBePerformed(connection); - TestUtil.createTable(connection, table, columns); - } - - /** - * Method to check if a fetch can be performed - PreferQueryMode is not set to Simple. - * - * @param connection Connection to be checked. - */ - private void checkIfFetchTestCanBePerformed(Connection connection) throws SQLException { - PGConnection pgConnection = connection.unwrap(PGConnection.class); - PreferQueryMode preferQueryMode = - pgConnection == null ? PreferQueryMode.EXTENDED : pgConnection.getPreferQueryMode(); - Assume.assumeTrue("Fetching tests can't be performed in simple mode", - preferQueryMode != PreferQueryMode.SIMPLE); - } - -} diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42TestSuite.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42TestSuite.java index 6b471c38ac..3d444fd015 100644 --- a/pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42TestSuite.java +++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42TestSuite.java @@ -11,7 +11,6 @@ @RunWith(Suite.class) @SuiteClasses({ - AdaptiveFetchSizeTest.class, CustomizeDefaultFetchSizeTest.class, GetObject310InfinityTests.class, GetObject310Test.class,