[jdbc-v2] Fixed overriding server settings in JDBC Connection#2829
[jdbc-v2] Fixed overriding server settings in JDBC Connection#2829
Conversation
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
There was a problem hiding this comment.
Pull request overview
This PR targets jdbc-v2 configuration behavior to address unexpected overriding of ClickHouse server settings (notably async_insert) and to validate related behavior via integration tests.
Changes:
- Refactors JDBC URL/property parsing to centralize default configuration in
JdbcConfiguration. - Removes hardcoded default query settings from
ConnectionImpl. - Adds an integration test matrix covering
async_insert,wait_for_async_insert, andwait_end_of_queryinteractions.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcConfiguration.java | Introduces centralized default property creation and updates property-building flow. |
| jdbc-v2/src/main/java/com/clickhouse/jdbc/ConnectionImpl.java | Removes hardcoded default QuerySettings overrides on connection creation. |
| jdbc-v2/src/test/java/com/clickhouse/jdbc/internal/JdbcConfigurationTest.java | Updates expectations to account for newly introduced defaults. |
| jdbc-v2/src/test/java/com/clickhouse/jdbc/StatementTest.java | Adds integration test coverage for async insert-related settings. |
| client-v2/src/main/java/com/clickhouse/client/api/internal/ServerSettings.java | Adds ON/OFF constants for server-setting values. |
| CHANGELOG.md | Adds a 0.9.9 entry describing the fix. |
|
|
@claude review |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
Claude finished @mshustov's task in 3m 49s —— View job Code Review
SummaryThe core fix is correct and well-scoped. Removing the hardcoded Issues[Bug / Flaky Test] assertTrue(count < ASYNC_INSERT_SETTINGS_DP_ROWS,
"Expected count to be < " + ASYNC_INSERT_SETTINGS_DP_ROWS + ", but was: " + count);When if (expectedSelectCount == -1) {
// async: rows may not be visible yet — just verify server returned 0 written_rows
assertEquals(updateCount, 0, "Expected async insert to not report written rows");
// Optionally poll for eventual consistency up to a timeout
}Alternatively, asserting only on [Type Safety] public Connection getJdbcConnection(Map<String, Object> propertiesMap) throws SQLException {All callers pass [Test Coverage Gap] Other test classes still use bare
Consider either:
[Minor] The Copilot reviewer's "Now it let override them" fix was applied, but several other issues remain: [Minor] public static final String ON = "1";
public static final String OFF = "0";Generic boolean-value strings in a class named [Minor] Test doesn't clean up UUID-named tables
What's Done Well
SonarQubeThe "C Maintainability Rating" failure likely targets |




Summary
CHANGELOG.mdasync_insertandwait_end_of_querysettings work accordingly.JDBC doesn't require driver return exact number of rows so no need to fallback to
async_insert=0.This is breaking change for those who rely on such metrics. When async. insert is ON they are not reliable source
of affected row count anymore.
Removing hard-coded settings allows to define any configuration and removes problem with read-only accounts because even if setting matches server one - it is sent anyway. Today only user defined settings will be sent.
Closes: #2652
Closes: #2825
Checklist
Delete items not relevant to your PR: