Skip to content

feat: make executeQuery ResultSet streaming block size configurable via ojp.resultset.rowsPerBlock#509

Merged
rrobetti merged 2 commits into
mainfrom
copilot/add-configurable-resultset-block-size
May 14, 2026
Merged

feat: make executeQuery ResultSet streaming block size configurable via ojp.resultset.rowsPerBlock#509
rrobetti merged 2 commits into
mainfrom
copilot/add-configurable-resultset-block-size

Conversation

Copilot AI commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the hardcoded ROWS_PER_RESULT_SET_DATA_BLOCK = 100 constant in the server-side query streaming path with a configurable server property ojp.resultset.rowsPerBlock, while preserving existing behaviour by defaulting to 100.

Fixes #[link to issue if applicable]

Changes

New property

Property Env var Type Default Valid range
ojp.resultset.rowsPerBlock OJP_RESULTSET_ROWSPERBLOCK int 100 1–10000

Values outside 1–10000 are rejected and the default is used instead.

Files changed

ojp-grpc-commons

  • CommonConstants.java – added DEFAULT_RESULTSET_ROWS_PER_BLOCK alias and RESULTSET_ROWS_PER_BLOCK_PROPERTY key constant.

ojp-server

  • ServerConfiguration.java – new resultsetRowsPerBlock field initialised via the new getBoundedIntProperty helper (validates min=1, max=10000), getter, and startup log line.
  • ResultSetHelper.javahandleResultSet now reads context.getServerConfiguration().getResultsetRowsPerBlock() instead of the constant. Javadoc updated.

ojp-jdbc-driver

  • ResultSet.javagetRow() fixed to accumulate completedBlocksRowCount as blocks are received instead of multiplying blockCount × ROWS_PER_RESULT_SET_DATA_BLOCK. This makes getRow() return correct absolute row numbers for any block size.

Tests

  • ServerConfigurationTest.java – 8 new tests: default value (100), custom value, min boundary (1), max boundary (10000), below-min (0→default), above-max (10001→default), negative (−1→default), invalid string (→default).
  • ResultSetHelperBlockSizeTest.java – 7 new unit tests: default block size, block < result size, block == result size, block > result size, non-multiple block size, empty result set, block size 1 (one row per message), and labels-only-in-first-block.

Documentation

  • ojp-server-configuration.md – new "ResultSet Streaming Settings" section with property table and tuning guidance.
  • ojp-server-example.propertiesojp.resultset.rowsPerBlock=100 entry with comment.

Acceptance criteria met

  • No hardcoded 100 remains in the query streaming path (the constant ROWS_PER_RESULT_SET_DATA_BLOCK is kept as the default source-of-truth value only).
  • Users can tune rows per result block without code changes.
  • Existing behaviour is unchanged by default.
  • Invalid values fall back to the default with a warning log.
  • Streaming delivers all rows correctly for any block size.

Copilot AI and others added 2 commits May 14, 2026 07:21
…ia ojp.resultset.rowsPerBlock

Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/15b7519d-cf95-4640-ba65-9152519356d8

Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
…impler next() mock, better assertions

Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/15b7519d-cf95-4640-ba65-9152519356d8

Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI requested a review from rrobetti May 14, 2026 07:26
@rrobetti rrobetti marked this pull request as ready for review May 14, 2026 09:09
@rrobetti rrobetti merged commit 861430f into main May 14, 2026
53 checks passed
@rrobetti rrobetti deleted the copilot/add-configurable-resultset-block-size branch May 14, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants