Skip to content

Client config reporting — stage 2: full DRIVER_CONFIG report#968

Draft
nikagra wants to merge 5 commits into
scylladb:scylla-4.xfrom
nikagra:feature/driver-config-reporting-phase2
Draft

Client config reporting — stage 2: full DRIVER_CONFIG report#968
nikagra wants to merge 5 commits into
scylladb:scylla-4.xfrom
nikagra:feature/driver-config-reporting-phase2

Conversation

@nikagra

@nikagra nikagra commented Jul 22, 2026

Copy link
Copy Markdown

What

Stage 2 of driver configuration reporting: fills in the full DRIVER_CONFIG JSON report, replacing the stage-1 {"version":1} placeholder. When advanced.client-config-reporting.enabled = true, the control connection now reports the driver's effective configuration as the cross-driver schema shape.

Stacked on #967 (stage 1). This branch is based on the stage-1 branch, so its diff includes the stage-1 commit until #967 merges — review the second commit (feat: populate the full DRIVER_CONFIG report) for stage-2 changes, and merge after #967.

The report

All 11 groups are populated from the default execution profile and the context's policies, rebuilt on each control-connection init (so it reflects the current, possibly reloaded, config):

  • connection / socket / control_pane_settings — timeouts (ms), TCP/socket options. Keys the Java driver has no equivalent for (socket read/write timeout, server-side internal-query USING TIMEOUT) are reported as null.
  • reconnection_policy / retry_policy / speculative_execution_policy — a discriminated object selected by the configured policy class (exponential/constant, standard-error-aware/downgrading-consistency, constant/none), with a custom fallback carrying the user policy's class name.
  • load_balancing_policy — normalized flags for DefaultLoadBalancingPolicy (token_aware, dc_failover, explicit-vs-inferred local_dc, local_rack, ...); custom otherwise.
  • connection_pool / query_defaults / tls — pool sizing + shard-aware port, per-request defaults (page size, consistency, idempotence, client timestamps), and TLS booleans only (never credentials, keystores, or host lists).

Reporting remains fail-safe: any failure while building the report is swallowed; SESSION_ID is still emitted and only the config blob is dropped.

Reconciliation decisions (Java ↔ schema)

  • load_balancing_policy.shufflefalse (Java has no replica-shuffle option).
  • control_pane_settings.system_query_server_side_timeout_msnull (Java's metadata timeout is client-side; it does not emit USING TIMEOUT).
  • Custom policies → {type:"custom", name:<class simple name>} only (no reflective attribute dump in v1).

Testing

  • DefaultDriverConfigReporterTest expanded to 17 tests: the default report shape (golden), each policy discrimination branch, explicit local-dc, server-side timestamps, TLS enabled, socket overrides, unbounded page size, plus the stage-1 gating/fail-safe cases. Report content is asserted against a real config from OptionsMap.driverDefaults().
  • Context package + config-consistency + ProtocolInitHandlerTest green.

Follow-up

  • Integration test against a live ScyllaDB: connect, SELECT client_options['DRIVER_CONFIG'], client_options['SESSION_ID'] FROM system.clients, assert the JSON is schema-valid and SESSION_ID is identical across a session's rows. (Needs a running cluster; not included here.)
  • Confirm the server prerequisite before flipping the flag default on (unknown STARTUP key tolerance + client_options value-length).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 996190fe-0400-40ed-a4c1-0af7d11db0a4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

nikagra and others added 3 commits July 23, 2026 18:42
…plumbing)

Stage 1 of driver configuration reporting: the mechanism to report a client's
effective configuration to ScyllaDB at connection time, so operators can inspect
driver settings (via system.clients.client_options) while investigating incidents.

Gated behind a new option, advanced.client-config-reporting.enabled, which
ships disabled — when off there is zero change on the wire. When enabled:

- SESSION_ID: a dedicated, driver-generated per-session UUID, sent on every
  connection (control and pool) so the server can group a session's
  connections. Independent of the user-settable CLIENT_ID.
- DRIVER_CONFIG: a compact JSON blob, sent only on the control connection.
  Stage 1 emits only {"version":1} (version metadata only); the full
  configuration report follows in stage 2.

Both entries are produced by a new DriverConfigReporter, invoked per connection
from ProtocolInitHandler and evaluated fresh (so toggling the flag at runtime
takes effect on new connections). Reporting is fail-safe: any failure while
building the report is swallowed and never breaks connection initialization.

The config option is registered consistently across DefaultDriverOption,
TypedDriverOption, OptionsMap.driverDefaults() and reference.conf, and is
covered by a Simulacron IT asserting the STARTUP payload.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fills in DefaultDriverConfigReporter with all configuration groups of the
cross-driver schema, replacing the stage-1 {"version":1} placeholder:

- connection, socket, control_pane_settings: mapped from the default profile
  (timeouts in ms; keys with no Java equivalent — read/write timeout,
  server-side internal-query timeout — reported as null).
- reconnection_policy / retry_policy / speculative_execution_policy: a
  discriminated object chosen by the configured policy class, with a "custom"
  fallback carrying the class name for user policies.
- load_balancing_policy: normalized flags for DefaultLoadBalancingPolicy
  (token-aware, dc-failover, explicit/inferred local dc, ...), "custom"
  otherwise.
- connection_pool, query_defaults, tls: pool sizing / shard-aware port,
  per-request defaults (page size, consistency, idempotence, client
  timestamps), and TLS booleans only (never credentials or hosts).

Values are read from the default execution profile and the context's policy
accessors on each control-connection init, so the report reflects the current
(possibly reloaded) configuration. Building remains fail-safe.

Adds unit coverage for the default report shape and each policy discrimination
branch, driven by OptionsMap.driverDefaults().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ClientConfigReportingCcmIT is the real-server counterpart of the Simulacron
test: it starts ScyllaDB via CCM, connects with client config reporting
enabled, and reads back system.clients.client_options to assert what the
server actually stored:

- SESSION_ID is present on every one of the session's connections, with a
  single shared value;
- DRIVER_CONFIG is stored for exactly one connection (the control connection),
  identified independently as the connection carrying it.

Verified against ScyllaDB 2026.1.9: the server accepts the extra STARTUP keys
and stores the full DRIVER_CONFIG report intact (no length truncation), and
transient protocol-version negotiation attempts leave no rows in
system.clients. Scylla-only via @BackendRequirement; runs in the parallelizable
CCM suite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nikagra
nikagra force-pushed the feature/driver-config-reporting-phase2 branch from 9335dac to 7c6eb1a Compare July 23, 2026 16:43
nikagra and others added 2 commits July 23, 2026 21:31
ClientConfigReportingCcmIT reads system.clients.client_options, a column
that only exists on newer ScyllaDB releases. On the LTS-PRIOR lane
(Scylla 2025.1.14) the column is absent, so the SELECT fails with
InvalidQueryException: "Unrecognized name client_options", failing the
"Scylla ITs (LTS-PRIOR, 11, parallelizable)" check (the test carries
@category(ParallelizableTests.class), so only that lane runs it).

Add a minInclusive="2026.1.0" bound to the existing @BackendRequirement
so the test is skipped on versions without the column and still runs on
2026.1+ (LTS-LATEST 2026.1.9 and LATEST already pass).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ER_CONFIG report

Code review of the stage-2 (full report) work surfaced several correctness bugs:

- node-location-preference ignored SessionBuilder.withLocalDatacenter(), only
  checking the config option, and silently dropped an explicitly-configured
  rack when no DC was set (now reported as rack-auto instead of being lost).
- Policy discrimination used instanceof against non-final built-in classes,
  so DcInferringLoadBalancingPolicy (a real, documented policy) was
  misreported as "default", and any user subclass of a built-in
  reconnection/retry/speculative-execution/load-balancing policy was
  misreported as the unmodified built-in instead of "custom". Switched all
  four to exact-class checks; DcInferringLoadBalancingPolicy now gets its own
  "dc-inferring" type.
- customPolicy() reported an empty name for anonymous policy classes; falls
  back to the binary class name now.
- CLIENT_CONFIG_REPORTING_ENABLED's javadoc/reference.conf comment still
  described the stage-1 {"version":1}-only placeholder.
- Corrected a stale rationale comment in ClientConfigReportingSimulacronIT.

Added test coverage for each fix, and documented (rather than worked around)
remaining known limitations: single-execution-profile scoping and
LazyReference init-ordering assumptions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant