Skip to content

CASSJAVA-124: Add GRACEFUL_DISCONNECT support (CEP-59)#2091

Open
Shanzita wants to merge 7 commits into
apache:4.xfrom
Shanzita:cep-59
Open

CASSJAVA-124: Add GRACEFUL_DISCONNECT support (CEP-59)#2091
Shanzita wants to merge 7 commits into
apache:4.xfrom
Shanzita:cep-59

Conversation

@Shanzita
Copy link
Copy Markdown

Summary

Implements client-side support for CEP-59 (Graceful
Disconnect - In-Band Connection Draining) in the Java driver.

When a Cassandra node shuts down, it emits a
GRACEFUL_DISCONNECT event to subscribed connections. The
driver:

  • Stops sending new requests on the affected connection
  • Drains in-flight requests to completion
  • Reconnects automatically

Changes

  • Handle GRACEFUL_DISCONNECT in InFlightHandler to trigger
    graceful drain
  • Register for GRACEFUL_DISCONNECT on both control and data
    connections
  • Detect server support from SUPPORTED response in
    ChannelFactory
  • Add advanced.connection.graceful-disconnect-enabled
    config option (default true)
  • Add GRACEFUL_DISCONNECTS metric enums for node and session
    level
  • Unit tests for InFlightHandler and ControlConnection

Testing

  • Tested end-to-end against Rishabh's server branch
    (omniCoder77/cassandra:feature/cep-59/metrics)
  • 200 queries with 0 errors during nodetool drain
  • Config disabled test: GRACEFUL_DISCONNECT not registered
    when disabled
  • All 3534 existing unit tests pass with 0 regressions

Depends on: native-protocol 1.5.3-SNAPSHOT
(SiyaoIsHiding/native-protocol:cep-59)
JIRA: CASSJAVA-124

SiyaoIsHiding and others added 7 commits May 27, 2026 17:00
  - Handle GRACEFUL_DISCONNECT event in InFlightHandler to drain in-flight requests
  - Register for GRACEFUL_DISCONNECT on both control and data connections
  - Add graceful-disconnect-enabled config option (default true)
  - Detect server support from SUPPORTED response in ChannelFactory
  - Add GRACEFUL_DISCONNECTS metric enums
  - Add unit tests for InFlightHandler and ControlConnection
  - Clean up WIP debug logging

  Co-authored-by: Jane He <jane.he@datastax.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.

2 participants