[pgjdbc/pgjdbc] 5bb5f4: feat: implementation of adaptive fetching(#1707)

Поиск
Список
Период
Сортировка
Искать

[pgjdbc/pgjdbc] 5bb5f4: feat: implementation of adaptive fetching(#1707)

От:
adrklos <noreply@github.com>
Дата:
  Branch: refs/heads/master
  Home:   https://github.com/pgjdbc/pgjdbc
  Commit: 5bb5f409b8372e4be86c14a00309ab60b8e17ed8
      https://github.com/pgjdbc/pgjdbc/commit/5bb5f409b8372e4be86c14a00309ab60b8e17ed8
  Author: adrklos 
  Date:   2020-02-24 (Mon, 24 Feb 2020)

  Changed paths:
    M README.md
    M docs/documentation/head/connect.md
    M pgjdbc/src/main/java/org/postgresql/PGConnection.java
    M pgjdbc/src/main/java/org/postgresql/PGProperty.java
    M pgjdbc/src/main/java/org/postgresql/PGStatement.java
    M pgjdbc/src/main/java/org/postgresql/core/PGStream.java
    M pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java
    M pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
    A pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryInfo.java
    A pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoring.java
    M pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java
    M pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
    M pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
    M pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java
    A pgjdbc/src/test/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoringTest.java
    M pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java
    A pgjdbc/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java
    M pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42TestSuite.java

  Log Message:
  -----------
  feat: implementation of adaptive fetching (#1707)

* feat: implementation of adaptive fetching

Implementation of adaptive fetching logic during process of fetching result set.
Change adds three new properties used with adaptive fetching:
- adaptiveFetch - use to enable/disable work of adaptive fetching
- adaptiveFetchMinimum - use to define minimum size computed during adaptive fetching
- adaptiveFetchMaximum - use to define maximum size computed during adaptive fetching
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.
Additionally, resultSet have new method - getLastUsedFetchSize to get fetch size used during
last fetching. If adaptive fetching is turned on, then getFetchSize will return lastUsedFetchSize.
Property adaptiveFetch need properties defaultRowFetchSize and maxResultBuffer to work.

Commit to add:
- unit tests for AdaptiveFetchQueryMonitoring class;
- some style fixes (removing extra spaces, simpler code in setMaxRowSize method in PGStream class).

Commit to add:
- integration tests for adaptive fetching process;
- change casting to from primitive types to Wrapper classes in AdaptiveFetchQueryMonitoringTest.

Change in AdaptiveFetchSizeTest:
- is using PreparedStatement during tests now;
- added assume to check if preferQueryMode is not Simple;
- new method to open connection and creating table to remove code repetitiveness.

Commit to add explanation about adaptive fetching process in AdaptiveFetchQueryMonitoring class.




FAQ