Driver config reporting — stage 2: full DRIVER_CONFIG report - #968
Driver config reporting — stage 2: full DRIVER_CONFIG report#968nikagra wants to merge 2 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe driver now reports expanded default-profile configuration through control-connection Sequence Diagram(s)sequenceDiagram
participant StartupOptionsBuilder
participant ProtocolInitHandler
participant FeatureStore
participant DriverConfigReporter
StartupOptionsBuilder->>ProtocolInitHandler: provide stable SESSION_ID
ProtocolInitHandler->>FeatureStore: read sharding information
ProtocolInitHandler->>DriverConfigReporter: build control-connection DRIVER_CONFIG
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Comment |
ffe0609 to
9a2f6ca
Compare
9a2f6ca to
c6f7ca3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@core/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.java`:
- Around line 1178-1187: Make the reporting documentation backend-neutral across
DefaultDriverOption, TypedDriverOption, and reference.conf: replace
ScyllaDB-only wording with server-side terminology or explicitly document both
storage paths, system.clients for ScyllaDB and system_views.clients for
Cassandra 4.1. Update all three affected sites consistently without changing the
reporting behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ab5c16aa-71fa-4f9a-9659-654b6920ae50
📒 Files selected for processing (12)
core/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.javacore/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.javacore/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.javacore/src/main/resources/reference.confcore/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelFactoryTestBase.javacore/src/test/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandlerTest.javacore/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingSimulacronIT.java
c6f7ca3 to
24062e9
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (4)
core/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.java (1)
51-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueContract extension is consistent with implementation and callers.
The new
scyllaDbparam and its "only meaningful withreportDriverConfig" contract matchDefaultDriverConfigReporter.populateStartupOptionsandProtocolInitHandler's caller.One minor note for the future: this interface now has two adjacent
booleanparameters (reportDriverConfig,scyllaDb), which is a classic call-site readability/mix-up risk (e.g.populateStartupOptions(opts, true, false)reads ambiguously without named-parameter comments, as seen in the test file). Not blocking, but if a third flag is ever added, consider a small options value object instead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.java` around lines 51 - 57, The comment identifies no required code change; the current scyllaDb parameter and contract are consistent with the implementation and callers. Leave DriverConfigReporter.populateStartupOptions and its call sites unchanged, and only consider introducing an options value object if another boolean flag is added later.core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java (1)
194-210: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCentralize the ScyllaDB predicate. Both this startup path and
CassandraSchemaQueries.shouldApplyUsingTimeout()key off the sameshardingInfo != nullsignal; a shared helper would keep control-plane reporting and schema-query behavior in sync.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java` around lines 194 - 210, Centralize the ScyllaDB detection based on getShardingInfo() != null in a shared helper, then update ProtocolInitHandler’s startup reporting and CassandraSchemaQueries.shouldApplyUsingTimeout() to use it. Preserve the existing featureStore population flow and behavior while ensuring both paths rely on the same predicate.core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java (1)
136-145: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
controlno longer exercises the control-connection path.Both calls pass
reportDriverConfig=false, so the map namedcontrolis identical topool. Passingtruefor the control map keeps the test name honest and additionally proves the session id is stable when the config blob is built.♻️ Suggested tweak
- reporter.populateStartupOptions(control, false, false); + reporter.populateStartupOptions(control, /* reportDriverConfig= */ true, false); reporter.populateStartupOptions(pool, false, false);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java` around lines 136 - 145, Update should_use_a_stable_session_id_across_connections so the control map calls reporter.populateStartupOptions with reportDriverConfig=true, while keeping the pool call false and preserving the session ID equality assertion.integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java (1)
145-169: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winStage-2 payload assertion is copy-pasted across both integration tests. Both classes carry an identical
assertDriverConfigPayload(same Javadoc, same checks); every future stage-2 assertion has to be added twice and will silently drift otherwise.
integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java#L145-L169: move this helper into a shared test utility (e.g. a package-privateDriverConfigReportAssertionsclass in this package) and call it from here.integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingSimulacronIT.java#L125-L149: delete the local copy and call the shared helper instead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java` around lines 145 - 169, Extract the duplicated assertDriverConfigPayload helper into a package-private shared DriverConfigReportAssertions test utility, preserving its existing JSON parsing and stage-2 validation checks. In integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java lines 145-169, replace the local helper with a call to the shared utility; in integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingSimulacronIT.java lines 125-149, delete the local copy and call the same utility.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java`:
- Around line 194-210: Centralize the ScyllaDB detection based on
getShardingInfo() != null in a shared helper, then update ProtocolInitHandler’s
startup reporting and CassandraSchemaQueries.shouldApplyUsingTimeout() to use
it. Preserve the existing featureStore population flow and behavior while
ensuring both paths rely on the same predicate.
In
`@core/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.java`:
- Around line 51-57: The comment identifies no required code change; the current
scyllaDb parameter and contract are consistent with the implementation and
callers. Leave DriverConfigReporter.populateStartupOptions and its call sites
unchanged, and only consider introducing an options value object if another
boolean flag is added later.
In
`@core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java`:
- Around line 136-145: Update should_use_a_stable_session_id_across_connections
so the control map calls reporter.populateStartupOptions with
reportDriverConfig=true, while keeping the pool call false and preserving the
session ID equality assertion.
In
`@integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java`:
- Around line 145-169: Extract the duplicated assertDriverConfigPayload helper
into a package-private shared DriverConfigReportAssertions test utility,
preserving its existing JSON parsing and stage-2 validation checks. In
integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java
lines 145-169, replace the local helper with a call to the shared utility; in
integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingSimulacronIT.java
lines 125-149, delete the local copy and call the same utility.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5db2451e-3027-4740-bf80-230694676062
📒 Files selected for processing (15)
core/pom.xmlcore/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.javacore/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.javacore/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.javacore/src/main/resources/reference.confcore/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelFactoryTestBase.javacore/src/test/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandlerTest.javacore/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.javacore/src/test/resources/config/driver-config-report-v1.schema.jsonintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingSimulacronIT.javapom.xml
🚧 Files skipped from review as they are similar to previous changes (5)
- core/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelFactoryTestBase.java
- core/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.java
- core/src/main/resources/reference.conf
- core/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.java
- core/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.java
24062e9 to
d6ac737
Compare
|
@coderabbitai Thanks for the review — dispositions for the nitpicks, all pushed into the amended stage-2 commit:
Unrelated to the nitpicks but included in the same push: a TLS reporting correctness fix — |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Relevant files =="
fd -t f . core/src/main integration-tests/src/test | rg 'DefaultDriverConfigReporter|DriverConfigReporting|SslEngineFactory|ProtocolInitHandler'
echo
echo "== Updated stable-session test and config reporting calls =="
rg -n -C 5 'should_use_a_stable_session_id_across_connections|populateStartupOptions\s*\(' \
core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java \
core/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.java \
core/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.java \
core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java
echo
echo "== Shared integration assertion helper and callers =="
rg -n -C 4 'class DriverConfigReportingAssertions|assertDriverConfigPayload\s*\(' \
integration-tests/src/test/java/com/datastax/oss/driver/core/config
echo
echo "== TLS hostname-verification reporting and SSL factory contract =="
rg -n -C 5 'hostname-verification|requireHostnameValidation\s*\(' \
core/src/main/java core/src/test/javaLength of output: 40821
✏️ Learnings added
You are interacting with an AI system. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java (1)
129-138: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftProve that the reporting row is the control connection.
This verifies cardinality, not identity: a regression that emits
DRIVER_CONFIGon one pool connection and omits it on the control connection still passes. Add a reliable control-connection marker/correlation before validating the payload, as the Simulacron test already does.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java` around lines 129 - 138, Update the reporting-row assertions in DriverConfigReportingCcmIT to correlate the DRIVER_CONFIG row with the control connection using the same reliable marker or correlation mechanism as the existing Simulacron test. Validate that the identified row is the control connection before calling assertDriverConfigPayload, while preserving the existing single-row cardinality check.core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java (1)
321-352: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider single-argument override helpers to cut the
reporterWith(...)boilerplate.The 7-arg
reporterWith(defaults(map -> {}), mock(ExponentialReconnectionPolicy.class), mock(DefaultRetryPolicy.class), mock(NoSpeculativeExecutionPolicy.class), mock(DefaultLoadBalancingPolicy.class), mock(TimestampGenerator.class), Optional.empty())call is repeated ~15 times across this file, varying in exactly one argument. Thin wrappers (or a small builder) would make each test's intent obvious.♻️ Sketch
private DefaultDriverConfigReporter reporterWithReconnection(ReconnectionPolicy p) { return reporterWith( defaults(map -> {}), p, mock(DefaultRetryPolicy.class), mock(NoSpeculativeExecutionPolicy.class), mock(DefaultLoadBalancingPolicy.class), mock(TimestampGenerator.class), Optional.empty()); } // likewise reporterWithRetry / reporterWithSpecEx / reporterWithLb / reporterWithSsl🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java` around lines 321 - 352, Reduce repeated seven-argument setup in DefaultDriverConfigReporterTest by adding thin single-argument reporterWith helper methods for the varying policy/configuration dependencies, including reconnection policy and the analogous retry, speculative execution, load-balancing, and SSL cases. Update the affected tests, such as should_report_constant_reconnection_policy and should_report_custom_reconnection_policy, to use the appropriate helper while preserving their existing mocks and assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@core/src/test/resources/config/driver-config-report-v1.schema.json`:
- Around line 779-801: Update the consistency enum in the schema near the
consistency and serial-consistency properties to accept SERIAL and LOCAL_SERIAL
alongside the existing request consistency values. Keep the serial-consistency
property unchanged.
In
`@integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingAssertions.java`:
- Around line 29-43: Configure the shared OBJECT_MAPPER used by
assertDriverConfigPayload to enable
DeserializationFeature.FAIL_ON_TRAILING_TOKENS, ensuring readTree rejects valid
JSON followed by extra tokens while preserving the existing payload assertions.
---
Nitpick comments:
In
`@core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java`:
- Around line 321-352: Reduce repeated seven-argument setup in
DefaultDriverConfigReporterTest by adding thin single-argument reporterWith
helper methods for the varying policy/configuration dependencies, including
reconnection policy and the analogous retry, speculative execution,
load-balancing, and SSL cases. Update the affected tests, such as
should_report_constant_reconnection_policy and
should_report_custom_reconnection_policy, to use the appropriate helper while
preserving their existing mocks and assertions.
In
`@integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java`:
- Around line 129-138: Update the reporting-row assertions in
DriverConfigReportingCcmIT to correlate the DRIVER_CONFIG row with the control
connection using the same reliable marker or correlation mechanism as the
existing Simulacron test. Validate that the identified row is the control
connection before calling assertDriverConfigPayload, while preserving the
existing single-row cardinality check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 74f644f4-90dd-478c-b6ac-fecd6b72bac0
📒 Files selected for processing (20)
core/pom.xmlcore/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.javacore/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.javacore/src/main/java/com/datastax/oss/driver/api/core/ssl/ProgrammaticSslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/api/core/ssl/SslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.javacore/src/main/java/com/datastax/oss/driver/internal/core/ssl/DefaultSslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/internal/core/ssl/SniSslEngineFactory.javacore/src/main/resources/reference.confcore/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelFactoryTestBase.javacore/src/test/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandlerTest.javacore/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.javacore/src/test/resources/config/driver-config-report-v1.schema.jsonintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingAssertions.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingSimulacronIT.javapom.xml
🚧 Files skipped from review as they are similar to previous changes (4)
- core/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.java
- core/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.java
- core/src/main/resources/reference.conf
- core/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.java
d6ac737 to
5e69715
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java (1)
194-203: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCentralize the ScyllaDB detection check
getShardingInfo() != nullis used here and again inCassandraSchemaQueries.shouldApplyUsingTimeout(). A shared helper would keep driver-config reporting andUSING TIMEOUTgating aligned if the detection logic changes later.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java` around lines 194 - 203, Centralize the ScyllaDB detection currently implemented by getShardingInfo() != null into a shared helper, then update the ProtocolInitHandler flow and CassandraSchemaQueries.shouldApplyUsingTimeout() to use it. Preserve the existing featureStore null handling and ensure both driver-config reporting and USING TIMEOUT gating rely on the same detection logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java`:
- Around line 194-203: Centralize the ScyllaDB detection currently implemented
by getShardingInfo() != null into a shared helper, then update the
ProtocolInitHandler flow and CassandraSchemaQueries.shouldApplyUsingTimeout() to
use it. Preserve the existing featureStore null handling and ensure both
driver-config reporting and USING TIMEOUT gating rely on the same detection
logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: af57b7b6-6e4e-44fd-9609-e06c113aa08b
📒 Files selected for processing (20)
core/pom.xmlcore/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.javacore/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.javacore/src/main/java/com/datastax/oss/driver/api/core/ssl/ProgrammaticSslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/api/core/ssl/SslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.javacore/src/main/java/com/datastax/oss/driver/internal/core/ssl/DefaultSslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/internal/core/ssl/SniSslEngineFactory.javacore/src/main/resources/reference.confcore/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelFactoryTestBase.javacore/src/test/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandlerTest.javacore/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.javacore/src/test/resources/config/driver-config-report-v1.schema.jsonintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingAssertions.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingSimulacronIT.javapom.xml
🚧 Files skipped from review as they are similar to previous changes (4)
- core/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.java
- core/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.java
- core/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.java
- core/src/main/resources/reference.conf
Fills in the full DRIVER_CONFIG JSON report in the approved v2
cross-driver schema shape, replacing the stage-1 {"version":1}
placeholder. All groups are populated from Configuration and
Policies on each control-connection init.
Adds public getters to DCAwareRoundRobinPolicy and
RackAwareRoundRobinPolicy needed to report node-location-preference
and dc-failover, and makes PagingOptimizingLoadBalancingPolicy
implement ChainableLoadBalancingPolicy so the reporter can unwrap the
LB policy Cluster.Manager wraps at runtime.
Adds a JSON-Schema conformance test suite (mirroring the 4.x sibling
PR scylladb#968): the normative schema is shipped as a test resource and
validated via com.networknt:json-schema-validator (pinned to 1.5.x,
the last line still targeting Java 8), covering every discriminated-
union branch and optional group the 3.x reporter can emit, plus a
negative test proving additionalProperties=false is enforced.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fills in the full DRIVER_CONFIG JSON report in the approved v2
cross-driver schema shape, replacing the stage-1 {"version":1}
placeholder. All groups are populated from Configuration and
Policies on each control-connection init.
Adds public getters to DCAwareRoundRobinPolicy and
RackAwareRoundRobinPolicy needed to report node-location-preference
and dc-failover, and makes PagingOptimizingLoadBalancingPolicy
implement ChainableLoadBalancingPolicy so the reporter can unwrap the
LB policy Cluster.Manager wraps at runtime.
Adds a JSON-Schema conformance test suite (mirroring the 4.x sibling
PR scylladb#968): the normative schema is shipped as a test resource and
validated via com.networknt:json-schema-validator (pinned to 1.5.x,
the last line still targeting Java 8), covering every discriminated-
union branch and optional group the 3.x reporter can emit, plus a
negative test proving additionalProperties=false is enforced.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fills in the full DRIVER_CONFIG JSON report in the approved v2
cross-driver schema shape, replacing the stage-1 {"version":1}
placeholder. All groups are populated from Configuration and
Policies on each control-connection init.
Adds public getters to DCAwareRoundRobinPolicy and
RackAwareRoundRobinPolicy needed to report node-location-preference
and dc-failover, and makes PagingOptimizingLoadBalancingPolicy
implement ChainableLoadBalancingPolicy so the reporter can unwrap the
LB policy Cluster.Manager wraps at runtime.
Adds a JSON-Schema conformance test suite (mirroring the 4.x sibling
PR scylladb#968): the normative schema is shipped as a test resource and
validated via com.networknt:json-schema-validator (pinned to 1.5.x,
the last line still targeting Java 8), covering every discriminated-
union branch and optional group the 3.x reporter can emit, plus a
negative test proving additionalProperties=false is enforced.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fills in the full DRIVER_CONFIG JSON report in the approved v2
cross-driver schema shape, replacing the stage-1 {"version":1}
placeholder. All groups are populated from Configuration and Policies
when the report is built, i.e. once per Cluster as it initializes.
Adds public getters to DCAwareRoundRobinPolicy and
RackAwareRoundRobinPolicy needed to report node-location-preference
and dc-failover, and makes PagingOptimizingLoadBalancingPolicy
implement ChainableLoadBalancingPolicy so the reporter can unwrap the
LB policy Cluster.Manager wraps at runtime.
Adds a JSON-Schema conformance test suite (mirroring the 4.x sibling
PR scylladb#968): the normative schema is shipped as a test resource and
validated via com.networknt:json-schema-validator (pinned to 1.5.x,
the last line still targeting Java 8), covering every discriminated-
union branch and optional group the 3.x reporter can emit, plus a
negative test proving additionalProperties=false is enforced.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
5e69715 to
cfda714
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java (1)
930-966: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffConsider a small builder for the reporter fixtures.
The 7-argument and 8-argument
reporterWithcalls repeat across about twenty tests, and each call varies only one argument. A builder that starts from the default policy set and overrides one collaborator would remove that repetition and make each test state its single variable.Example shape:
private final class ReporterBuilder { private DriverExecutionProfile profile = defaults(map -> {}); private ReconnectionPolicy reconnection = mock(ExponentialReconnectionPolicy.class); // ... remaining collaborators with the same defaults as defaultsReporter() ReporterBuilder reconnection(ReconnectionPolicy p) { this.reconnection = p; return this; } DefaultDriverConfigReporter build() { /* wire the mock context */ } }Each test then reads
builder().reconnection(mock(ConstantReconnectionPolicy.class)).build().🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java` around lines 930 - 966, Refactor the repeated reporter fixture setup around the overloaded reporterWith methods into a small ReporterBuilder that initializes the same defaults as defaultsReporter() and exposes fluent overrides for individual collaborators, including the programmatic local datacenter. Update the affected tests to build reporters by overriding only the variable under test, while preserving the existing mock context wiring and behavior.core/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.java (1)
152-152: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider package-private visibility for
buildJson.
DefaultDriverConfigReporterTestis in the same package,com.datastax.oss.driver.internal.core.context. Package-private visibility therefore supports the test override without adding a subclass extension point that the javadoc must then qualify with thread-safety caveats.♻️ Proposed change
- protected String buildJson(boolean scyllaDb) { + String buildJson(boolean scyllaDb) {If a production subclass hook is intended, keep
protectedand disregard this suggestion.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.java` at line 152, Change the buildJson method in DefaultDriverConfigReporter from protected to package-private visibility, allowing DefaultDriverConfigReporterTest to override it within the same package without exposing a production subclass extension point.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@core/src/main/java/com/datastax/oss/driver/api/core/config/OptionsMap.java`:
- Line 403: Restore opt-in driver configuration reporting by setting
TypedDriverOption.DRIVER_CONFIG_REPORTING_ENABLED to false in OptionsMap. Update
DriverConfigReportingSimulacronIT at lines 53-60 and 145-160 to assert and
enable reporting explicitly as needed, and update upgrade_guide/README.md lines
40-44 to document that reporting is disabled by default.
In
`@core/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.java`:
- Around line 23-33: Change driver-config reporting defaults from enabled to
disabled across OptionsMap.fillWithDriverDefaults and
DefaultDriverConfigReporter, then update the corresponding documentation and
tests to reflect false as the default. Preserve explicit opt-in behavior,
ensuring default sessions do not send the DRIVER_CONFIG startup option.
In
`@integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.java`:
- Around line 133-142: Update the assertions in DriverConfigReportingCcmIT to
identify the DRIVER_CONFIG row by matching its connection local address and port
against the control connection, using the existing control-connection details
and clientOptions helpers. Preserve the single-row and payload assertions, but
ensure a pooled connection cannot satisfy the test.
In `@upgrade_guide/README.md`:
- Around line 42-44: Update the fenced configuration block in the README to
specify the HOCON language identifier, changing the opening fence to use hocon
while preserving the existing configuration content.
---
Nitpick comments:
In
`@core/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.java`:
- Line 152: Change the buildJson method in DefaultDriverConfigReporter from
protected to package-private visibility, allowing
DefaultDriverConfigReporterTest to override it within the same package without
exposing a production subclass extension point.
In
`@core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java`:
- Around line 930-966: Refactor the repeated reporter fixture setup around the
overloaded reporterWith methods into a small ReporterBuilder that initializes
the same defaults as defaultsReporter() and exposes fluent overrides for
individual collaborators, including the programmatic local datacenter. Update
the affected tests to build reporters by overriding only the variable under
test, while preserving the existing mock context wiring and behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e40d8974-45a6-4285-bc5b-2d6d30c334dc
📒 Files selected for processing (26)
core/pom.xmlcore/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.javacore/src/main/java/com/datastax/oss/driver/api/core/config/OptionsMap.javacore/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.javacore/src/main/java/com/datastax/oss/driver/api/core/ssl/ProgrammaticSslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/api/core/ssl/SslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverContext.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/DriverConfigReporter.javacore/src/main/java/com/datastax/oss/driver/internal/core/context/StartupOptionsBuilder.javacore/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.javacore/src/main/java/com/datastax/oss/driver/internal/core/ssl/DefaultSslEngineFactory.javacore/src/main/java/com/datastax/oss/driver/internal/core/ssl/SniSslEngineFactory.javacore/src/main/resources/reference.confcore/src/test/java/com/datastax/dse/driver/internal/core/context/DseStartupOptionsBuilderTest.javacore/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelFactoryTestBase.javacore/src/test/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandlerTest.javacore/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.javacore/src/test/java/com/datastax/oss/driver/internal/core/context/StartupOptionsBuilderTest.javacore/src/test/resources/config/driver-config-report-v1.schema.jsonintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingAssertions.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingCcmIT.javaintegration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingSimulacronIT.javapom.xmlupgrade_guide/README.md
🚧 Files skipped from review as they are similar to previous changes (13)
- core/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.java
- core/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.java
- core/src/main/java/com/datastax/oss/driver/internal/core/ssl/DefaultSslEngineFactory.java
- core/src/main/java/com/datastax/oss/driver/api/core/ssl/ProgrammaticSslEngineFactory.java
- integration-tests/src/test/java/com/datastax/oss/driver/core/config/DriverConfigReportingAssertions.java
- core/src/main/java/com/datastax/oss/driver/internal/core/metadata/schema/queries/CassandraSchemaQueries.java
- core/pom.xml
- core/src/main/java/com/datastax/oss/driver/internal/core/ssl/SniSslEngineFactory.java
- core/src/main/java/com/datastax/oss/driver/api/core/ssl/SslEngineFactory.java
- core/src/test/resources/config/driver-config-report-v1.schema.json
- pom.xml
- core/src/main/resources/reference.conf
- core/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelFactoryTestBase.java
cfda714 to
312b522
Compare
|
Dispositions for the two nitpicks:
|
|
On the two nitpicks from the last CodeRabbit pass: |
312b522 to
10ebb4b
Compare
SESSION_ID identifies a driver session so the server can group all of its connections. It is an innate driver behavior with no configuration option to turn it off, so it does not belong to the configuration reporter: move it to StartupOptionsBuilder.build(), next to CLIENT_ID, where it lands in the session-wide startup options that every connection's STARTUP is copied from. That makes it unconditional (previously it was gated behind advanced.driver-config-reporting.enabled), stable for the whole session (DefaultDriverContext builds the startup options exactly once, via a LazyReference), and independent of any reporting failure — Uuids.random() cannot throw, and CLIENT_ID already made the same call, so no fail-safe is needed on this path. With SESSION_ID gone, the reporter only ever contributes to the control connection, so populateStartupOptions(map, reportDriverConfig) becomes populateControlConnectionOptions(map) and ProtocolInitHandler consults it only for that connection instead of for every one. No functional change to DRIVER_CONFIG itself. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…on time (stage 2)
Replaces the stage-1 {"version":1} placeholder with the full DRIVER_CONFIG
report: the effective configuration of the driver's default execution profile
plus the context's policies, serialized to the cross-driver JSON schema shape.
Groups: connection, socket, control-plane, reconnection-policy, retry-policy,
speculative-execution-policy (omitted when there is none), load-balancing-policy,
node-location-preference, connection-pool, query-defaults and tls.
The report is rebuilt on every control-connection init, so it always reflects
the current (possibly runtime-reloaded) configuration. Policy groups use
exact-class discrimination rather than instanceof, so a user subclass of a
built-in is reported as {type:"custom", name:<class>} instead of being
misreported as the unmodified built-in. Keys the Java driver has no equivalent
for are omitted rather than emitted as null.
advanced.driver-config-reporting.enabled now ships enabled, per the cross-driver
review. Turning it off suppresses only DRIVER_CONFIG; SESSION_ID rides on every
connection regardless.
control-plane.system-queries.timeout.server-side-ms is reported only against
ScyllaDB, where CassandraSchemaQueries adds a USING TIMEOUT clause to schema
queries, making advanced.metadata.schema.request-timeout a genuine server-side
timeout on that backend. ProtocolInitHandler derives that signal from the
feature store's sharding info and passes it to the reporter.
Two fail-safes keep reporting from ever breaking a connection:
- Any failure while building the report is swallowed and logged at WARN. The
catch covers InternalError as well, since customPolicy() calls
getClass().getSimpleName() on arbitrary user policy objects, which has a
documented JDK edge case; it deliberately does not catch bare Error, so
OutOfMemoryError/StackOverflowError still surface.
- The report is capped at 32KiB (the limit the other ScyllaDB drivers apply).
STARTUP option values are written with an unchecked 16-bit length prefix, so
an oversized value would corrupt the frame and fail the handshake; parts of
the report come from unbounded user-supplied values (datacenter and rack
names, consistency levels, custom policy class names), so the limit has to be
enforced where the report is built.
tls.enabled is read from the low-level SslHandlerFactory, the reference
ChannelFactory installs the SSL handler from, rather than from
getSslEngineFactory(): an override of
DefaultDriverContext.buildSslHandlerFactory() (the documented expert extension
point) supplies no engine factory, and that session is still encrypted.
tls.hostname-verification comes from a new
SslEngineFactory.isHostnameValidationRequired() accessor rather than from
advanced.ssl-engine-factory.hostname-validation, which only governs the
built-in factory — a context supplied through SessionBuilder.withSslContext()
would otherwise be mis-reported as validating. The accessor is diagnostic only
and does not affect newSslEngine; its conservative false default avoids
over-reporting a security control an arbitrary custom factory may not perform.
Every emitted document is validated in DefaultDriverConfigReporterTest against
the normative v1 JSON Schema, shipped verbatim as a test resource.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
10ebb4b to
853c735
Compare
There was a problem hiding this comment.
Pull request overview
Implements full driver configuration reporting on control-connection startup while sending a stable session identifier on every connection.
Changes:
- Serializes default-profile settings and policies into
DRIVER_CONFIG. - Enables reporting by default and adds ScyllaDB/TLS-specific diagnostics.
- Expands schema, unit, and integration coverage.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
upgrade_guide/README.md |
Documents reporting behavior. |
pom.xml |
Manages schema-validator version. |
integration-tests/.../DriverConfigReportingSimulacronIT.java |
Tests startup frames. |
integration-tests/.../DriverConfigReportingCcmIT.java |
Tests server-stored options. |
integration-tests/.../DriverConfigReportingAssertions.java |
Shares payload assertions. |
core/src/test/resources/config/driver-config-report-v1.schema.json |
Adds normative schema. |
core/src/test/.../StartupOptionsBuilderTest.java |
Tests session identifiers. |
core/src/test/.../DefaultDriverConfigReporterTest.java |
Tests report content and conformance. |
core/src/test/.../ProtocolInitHandlerTest.java |
Tests reporting plumbing. |
core/src/test/.../ChannelFactoryTestBase.java |
Updates reporter fixture. |
core/src/test/.../DseStartupOptionsBuilderTest.java |
Covers DSE session identifiers. |
core/src/main/resources/reference.conf |
Enables and documents reporting. |
core/src/main/.../SniSslEngineFactory.java |
Reports hostname validation. |
core/src/main/.../DefaultSslEngineFactory.java |
Exposes validation state. |
core/src/main/.../CassandraSchemaQueries.java |
Documents backend detection. |
core/src/main/.../StartupOptionsBuilder.java |
Adds stable SESSION_ID. |
core/src/main/.../DriverConfigReporter.java |
Refines reporter contract. |
core/src/main/.../DefaultDriverContext.java |
Documents startup-option lifetime. |
core/src/main/.../DefaultDriverConfigReporter.java |
Builds the full report. |
core/src/main/.../ProtocolInitHandler.java |
Reports from control connections. |
core/src/main/.../SslEngineFactory.java |
Adds diagnostic accessor. |
core/src/main/.../ProgrammaticSslEngineFactory.java |
Reports programmatic validation. |
core/src/main/.../TypedDriverOption.java |
Updates option documentation. |
core/src/main/.../OptionsMap.java |
Changes reporting default. |
core/src/main/.../DefaultDriverOption.java |
Documents the full report. |
core/pom.xml |
Adds test schema validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| n.put( | ||
| "delay-ms", | ||
| config.getDuration(DefaultDriverOption.SPECULATIVE_EXECUTION_DELAY).toMillis()); |
| } else if (policy.getClass() == ConstantReconnectionPolicy.class) { | ||
| n.put("type", "constant"); | ||
| n.put("delay-ms", config.getDuration(DefaultDriverOption.RECONNECTION_BASE_DELAY).toMillis()); |
| if (config.isDefined(DefaultDriverOption.SOCKET_LINGER_INTERVAL)) { | ||
| ObjectNode linger = OBJECT_MAPPER.createObjectNode(); | ||
| linger.put("interval-s", config.getInt(DefaultDriverOption.SOCKET_LINGER_INTERVAL)); | ||
| n.set("linger", linger); | ||
| } |
| } | ||
| // pageSize <= 0 means paging is unbounded: the "page" group is omitted entirely (the schema | ||
| // has no "unbounded" sentinel). | ||
| n.put("consistency", config.getString(DefaultDriverOption.REQUEST_CONSISTENCY)); |
What ☑️
Stage 2 (the payload) of driver configuration reporting: replaces the stage-1
{"version":1}placeholder with the fullDRIVER_CONFIGreport — the effective configurationof the driver's default execution profile plus the context's policies, serialized to the
cross-driver JSON schema shape.
This is phase 2 of 2. Stage 1 (#967) landed the plumbing and is merged; this branch is rebased
directly onto
scylla-4.x, so there is no stage-1 noise in the diff. Two commits, split per@sylwiaszunejko's review:
refactor: send SESSION_ID from StartupOptionsBuilder on every connection— movesSESSION_IDout of the reporter, making it unconditional, and narrows the reporter's hook to
populateControlConnectionOptions. No functional change toDRIVER_CONFIG. Green on its own.feat: report the full driver configuration ... (stage 2)— everything else: the reportitself, the ScyllaDB signal, the size cap, the TLS fixes, the default-on flip, schema fixture, docs.
Gated behind
advanced.driver-config-reporting.enabled, which now ships enabled (flipped inthis branch per @dkropachev's cross-driver review). Turning it off suppresses only the
DRIVER_CONFIGblob —SESSION_IDrides on every connection unconditionally, independently of thisflag, so "off" is not "zero change on the wire".
The report 🧩
Built from the default execution profile + the context's policies, and rebuilt on every
control-connection init, so it always reflects the current (possibly runtime-reloaded) config.
Groups:
connection,socket,control-plane,reconnection-policy,retry-policy,speculative-execution-policy(omitted when there is none),load-balancing-policy,node-location-preference,connection-pool,query-defaults,tls.Invariants:
SESSION_IDis still emitted on every connection and only the config blob is dropped. The catch was widened to
also cover
InternalError—customPolicy()callsgetClass().getSimpleName()on arbitraryuser policy objects, which has a documented JDK 8 edge case (
InternalError: Malformed class name); it deliberately does not catch bareError, soOutOfMemoryError/StackOverflowErrorstill surface.
MAX_DRIVER_CONFIG_LENGTH), matching gocql fix: release pre-acquired stream IDs #964 and csharp-driver Bump ch.qos.logback:logback-classic from 1.2.3 to 1.3.12 #262.Not just cross-driver parity:
STARTUPoption values go throughByteBufPrimitiveCodec.writeString, which writes a 16-bit length prefix viaByteBuf.writeShortwith no bounds check, so a value over 65535 bytes silently truncates the prefix modulo 65536
while still appending the whole body — a corrupt frame and a failed handshake, and not something
the
try/catchabove can save, since nothing throws. Parts of the report are user-supplied andunbounded (DC/rack names, consistency levels, custom policy class names), so without this the
"reporting must never prevent a connection" invariant simply wasn't true. Over the limit ⇒ WARN and
omit
DRIVER_CONFIG; measured on the UTF-8 encoded bytes, since that is what the prefix counts.entirely, never emitted as
null.Backend-specific: server-side timeout 🐍
control-plane.system-queries.timeout.client-side-msis always reported;server-side-msisreported only against ScyllaDB, where
CassandraSchemaQueriesadds aUSING TIMEOUTclause toschema queries, making
advanced.metadata.schema.request-timeouta genuine server-side timeout on thatbackend (omitted on generic Cassandra). This is driven by a new
scyllaDbsignal derived on thecontrol connection from the feature store's sharding info — the same proxy check
CassandraSchemaQueries.shouldApplyUsingTimeout()already uses.Spec conformance 📐
Every emitted document validates against the normative JSON Schema in the design doc (v1): all
required groups and keys present, correct types,
additionalProperties:falserespected everywhere,and the omission principle followed. This is enforced, not just asserted — the v1 schema is
shipped verbatim as a test resource and every representative report is validated against it in
DefaultDriverConfigReporterTest(see Testing below).Three fields diverge from the design doc's per-driver mapping tables — which are explicitly
non-normative (they only document where each driver reads a value, not the schema). In every case
the emitted value is schema-valid and more accurate for this driver:
load-balancing-policy.shuffle = true— the java row saysfalse (n/a). Java's built-inpolicies shuffle replicas unconditionally (
BasicLoadBalancingPolicy.shuffleHead, no config todisable it), so
trueis the truthful value.load-balancing-policy.latency-awareness— the java row saysfalse (n/a). Java has nolatency-percentile ordering, so this maps to the closest real signal: slow-replica avoidance
(
basic.load-balancing-policy.slow-replica-avoidance, defaulttrue; alwaysfalseforBasicLoadBalancingPolicy, which has no such mechanism).node-location-preferenceis emitted — the java row says omit ("no session-level API"). Javadoes have a session-level DC/rack preference (
basic.load-balancing-policy.local-datacenter/.local-rackandSessionBuilder.withLocalDatacenter), and the group's own description says apreference sourced from the load-balancing policy should be reported here. Programmatic value
wins over config, mirroring
OptionalLocalDcHelper.Minor, also schema-valid:
rack-autois reused for the explicit-rack / inferred-DC case (there isno "explicit rack, inferred DC" variant in the schema);
consistencyis passed through verbatim.Changes ✍️
DefaultDriverConfigReporter— fills in all configuration groups from the default profile +context policies. Policy groups use exact-class discrimination (not
instanceof), so a usersubclass of a built-in falls through to
{type:"custom", name:<class>}instead of beingmisreported as the unmodified built-in.
SESSION_IDdecoupled from the flag.SESSION_ID_KEYand the lazily generated per-sessionUuids.random()now live inStartupOptionsBuilder.build()next toCLIENT_ID_KEY, so onestable value lands in every connection's
STARTUPwith no config gate and no fail-safe needed(
Uuids.random()cannot throw;CLIENT_IDalready made the same call).DriverConfigReporter—populateStartupOptions(map, reportDriverConfig, scyllaDb)becamepopulateControlConnectionOptions(map, scyllaDb); the reporter is now consulted only for thecontrol connection, and never for pool connections (pinned by a
verify(..., never())test).reference.conf,OptionsMap.fillWithDriverDefaults,DefaultDriverOptionjavadoc, and the in-code fallbackgetBoolean(OPTION, true)all agree.MapBasedDriverConfigLoaderTest.should_fill_default_profile_like_reference_fileis the guard thatreference.confandOptionsMapstay in lockstep.ProtocolInitHandler— derives thescyllaDbsignal from the feature store's sharding infoand passes it through to the reporter on the
STARTUPstep.CassandraSchemaQueries— comment noting the shared sharding-info proxy check.tls.enabledreadsgetSslHandlerFactory(), notgetSslEngineFactory()— per@sylwiaszunejko's review. The handler factory is the reference
ChannelFactoryinstalls the SSLhandler from, and
DefaultDriverContext.buildSslHandlerFactory()is the documented expertextension point (e.g. Netty's native OpenSSL): an override of it supplies no engine factory, so
reading the engine factory reported such a session as plaintext when it is in fact encrypted.
SslEngineFactory.isHostnameValidationRequired()— newdefaultmethod (so existingimplementations keep compiling) overridden by the built-in
DefaultSslEngineFactory/SniSslEngineFactory/ProgrammaticSslEngineFactory. A diagnostic-only accessor that sourcestls.hostname-verification; it does not affectnewSslEngine, and its conservativefalsedefaultavoids over-reporting a security control an arbitrary custom factory may not actually perform —
which is also why it stays on the engine factory rather than moving with
enabled: host namevalidation is a property of the JDK
SSLEngine, unreadable through an opaque handler factory. Thisis what the report reflects rather than
advanced.ssl-engine-factory.hostname-validation, whichonly governs the built-in factory — a context supplied through
SessionBuilder.withSslContext(...)would otherwise be mis-reported as validating.
upgrade_guide/README.md— new### 4.19.2.1section documenting both startup options and howto turn the configuration report off.
reference.conf/DefaultDriverOption/TypedDriverOptionjavadoc updated to describe the fullreport.
com.networknt:json-schema-validatordependency (pom.xml/core/pom.xml) and the normative v1 schema shipped as a test resource(
core/src/test/resources/config/driver-config-report-v1.schema.json).Testing 🔨
Unit tests 💻
DefaultDriverConfigReporterTest— 51 tests: default report shape, every policy-discriminationbranch (including exact-class-vs-subclass "custom" fallback via real anonymous subclasses),
explicit/inferred DC and rack, programmatic-vs-config DC precedence, server-side timestamps, TLS,
socket overrides, unbounded page size, the ScyllaDB-only
server-side-ms, plus enable-gating andthe fail-safe cases (incl. the
InternalErrorpath, an over-limit report being dropped and ajust-under-limit one still sent, and a custom
SslHandlerFactorywith no engine factory reportingtls.enabled=true/hostname-verification=false). Coverage now also includesschema conformance: each representative report is validated against the shipped normative v1
JSON Schema (
core/src/test/resources/config/driver-config-report-v1.schema.json) viacom.networknt:json-schema-validator, and a negative test confirms the validator actually rejectsan out-of-schema document (
additionalProperties:false).ProtocolInitHandlerTest— 20 tests: thescyllaDbSTARTUPplumbing with sharding infopresent/absent, plus the "reporter never consulted for a pool connection" check.
ChannelFactoryTestBase— updated for the new reporter signature.Integration tests 📡
DriverConfigReportingCcmIT(ScyllaDB ≥ 2026.1 or Cassandra ≥ 4.1) — reads back theserver's stored
client_options, assertsSESSION_IDon all of this session's connections(scoped by the id value, since
SESSION_IDis now unconditional and the CCM cluster is shared withthe other parallelizable ITs), and asserts
DRIVER_CONFIGon exactly one connection which ismatched by address and port against the control connection's channel — so the "control connection
only" claim cannot be satisfied by a pooled connection. The payload is then parsed and the
always-present, backend-agnostic
load-balancing-policygroup asserted (not just key presence).DriverConfigReportingSimulacronIT— 3 tests over the actual recordedSTARTUPframes:reporting on, reporting off (
SESSION_IDstill sent,DRIVER_CONFIGnowhere), and the shippeddefault. The control connection is identified independently, by its
REGISTERframe.DriverConfigReportingAssertions— shared helper both ITs use for the payload check (validJSON,
version == 1as an integer, and the always-presentload-balancing-policygroup), so anempty or stage-1-only payload can't slip through a mere key-presence check.
Run locally, all green:
DriverConfigReportingSimulacronIT3/3, andDriverConfigReportingCcmITlive against CCM ScyllaDB 2026.1.9 and Cassandra 4.1.10. The backend-gated field behaves
end-to-end:
control-plane.system-queries.timeout.server-side-msis present on ScyllaDB andabsent on Cassandra, and the payload round-trips intact through both
system.clients(ScyllaDB)and
system_views.clients(Cassandra) with no value-length truncation.The report on the wire 📄
Verified by a live
tsharkcapture of theSTARTUPframes on the loopback interface against asingle-node ScyllaDB 2026.1.0 (CCM), protocol v4, with the driver's default configuration —
including the now-default
advanced.driver-config-reporting.enabled = true, i.e. no reportingoverride at all.
SESSION_IDrides on every connection;DRIVER_CONFIGis sent only on the controlconnection. In each capture the control connection is the one that also sends a
REGISTER.Sample 1: control-connection
STARTUP(DRIVER_CONFIG+SESSION_ID)Note
Both
DRIVER_CONFIGandSESSION_IDare present.tsharktruncates the 909-byteDRIVER_CONFIGstring in its CLI display (
String [truncated]:); the complete value is shown right below the frame.The complete
DRIVER_CONFIGvalue carried on the frame above (909 bytes on the wire), pretty-printed:{ "version": 1, "connection": { "connect": { "timeout-ms": 5000 } }, "socket": { "tcp-no-delay": true, "keep-alive": false, "reuse-address": false }, "control-plane": { "system-queries": { "timeout": { "client-side-ms": 5000, "server-side-ms": 20000 } }, "schema-agreement": { "timeout-ms": 10000 } }, "reconnection-policy": { "type": "exponential", "base-ms": 1000, "max-ms": 60000 }, "retry-policy": { "type": "standard-error-aware" }, "load-balancing-policy": { "type": "default", "token-aware": true, "shuffle": true, "dc-failover": false, "latency-awareness": true }, "node-location-preference": { "type": "dc-auto" }, "connection-pool": { "type": "host", "desired-connections-count": 1, "connection": { "max-requests": 1024 }, "shard-aware": { "enabled": true } }, "query-defaults": { "page": { "size": 5000 }, "consistency": "LOCAL_ONE", "serial-consistency": "SERIAL", "idempotence": false, "client-timestamps": true, "request": { "timeout-ms": 2000 } }, "tls": { "enabled": false, "hostname-verification": false } }Sample 2: pool-connection
STARTUP(SESSION_IDonly)Note
Only
SESSION_IDis present, and it is the same value as the control connection's above (theper-session singleton).
DRIVER_CONFIGis control-connection-only.Sample 3: control-connection
STARTUP(reporting disabled)Note
DRIVER_CONFIGis gone, butSESSION_IDis still there — it is an innate startup option, notpart of configuration reporting, so turning the flag off is not "zero change on the wire". This is
a separate capture with
advanced.driver-config-reporting.enabled = false; the map drops from 9keys to 8 and the frame from 1283 to 357 bytes, exactly matching the pool frame in Sample 2.
Note
These captures are against ScyllaDB, so
control-plane.system-queries.timeoutcarries"server-side-ms": 20000(theUSING TIMEOUTvalue). Against generic Cassandra that singlekey is omitted; everything else is identical.
Follow-up ⏭️
default-on flip is intentional (@dkropachev's cross-driver review); reasoning is on the threads.
rows for
shuffle,latency-awarenessandnode-location-preferenceare stale relative to thisimplementation (see Spec conformance above), and it specifies no size limit even though all
three drivers now enforce 32KiB — that belongs in the normative spec.
DriverBlockHoundIntegrationITis JDK 14+ only and was not run locally. With reporting on bydefault the report is now built on a Netty event loop; reasoned safe (no SSL factory resolution or
IO with the default config, and Jackson is in-memory), but worth watching in CI.
🤖 Generated with Claude Code