-
Notifications
You must be signed in to change notification settings - Fork 616
[client-v2, jdbc-v2] queryID auto-generation #2673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update or ping for review. Thank you for your contributions! |
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
| * @param supplier | ||
| * @return | ||
| */ | ||
| public Builder queryIdGenerator(Supplier<String> supplier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be renamed to setQueryIdGenerator
jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcConfiguration.java
Outdated
Show resolved
Hide resolved
client-v2/src/main/java/com/clickhouse/client/api/internal/HttpAPIClientHelper.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
| throw new ClientException("Insert request failed after attempts: " + (maxRetries + 1) + " - Duration: " + durationSince(startTime), lastException); | ||
| }; | ||
|
|
||
| String errMsg = requestExMsg("Insert", retries, durationSince(startTime).toMillis(), requestSettings.getQueryId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off-by-one error in retry attempt count message
Low Severity
After exhausting all retries, requestExMsg receives retries instead of retries + 1. The retry loop iterates from i = 0 to i <= retries, making retries + 1 total attempts. Inside the loop, (i + 1) correctly represents the 1-indexed attempt number. However, after the loop, passing retries causes the error message to report one fewer attempt than actually made. The previous code correctly used (maxRetries + 1).
Additional Locations (2)
|


Summary
queryIdto exception so it is easier to match fail on client and serverServerExceptioncode and query ID are propagated toSQLExceptioncom.clickhouse.jdbc.DriverProperties#QUERY_ID_GENERATORto let set ID generator from JDBC.Closes #2642
Checklist
Delete items not relevant to your PR:
Note
Introduces configurable query ID handling and surfaces it across APIs for better traceability.
Builder.setQueryIdGeneratorand auto-assignsqueryIdforquery/insertwhen not set; error messages now include attempt, duration, andqueryId.ServerExceptionand baseClickHouseExceptionnow carryqueryId; HTTP error parsing/wrapping includesqueryId(HttpAPIClientHelper.readError/wrapException).queryIdviaRecords#getQueryId()andOperationMetrics.DriverProperties#QUERY_ID_GENERATOR;StatementImpl/WriterStatementImplgenerate/setqueryId;JdbcConfigurationplumbs generator.queryIdgeneration/propagation and server error code mapping; minor doc string fix ("through").Written by Cursor Bugbot for commit a75daea. This will update automatically on new commits. Configure here.