Repository navigation
Cherry pick #101757 to 26.5: KeeperDispatcher overhaul - #105769
Merged
robot-ch-test-poll1 merged 62 commits intoMay 25, 2026
Merged
Conversation
Split request processing (batching, session management, request/response threads) into a separate `KeeperRequestDispatcher` class, leaving `KeeperDispatcher` as a thin shell for snapshots, session ID assignment, session cleanup, and cluster configuration management. Key interface changes: - `KeeperStateMachine` now takes a `KeeperResponseCallback` instead of a `ResponsesQueue &`, decoupling the state machine from the queue type. - `KeeperServer` constructor takes `KeeperResponseCallback` instead of `ResponsesQueue &`. - `KeeperServer::KeeperRaftServer` moved from .cpp anonymous definition to the header for visibility. - `ZooKeeperResponseCallback` moved to `KeeperCommon.h`, returns `bool` for future flow control. - `shutdown` now takes a `closed_all_connections` parameter. - Consolidated `finishSession` calls into a single `SCOPE_EXIT` in `KeeperTCPHandler`. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…aming New pipelined request dispatcher (`KeeperRequestDispatcher2`) with: - Lock-free `NonblockingBoundedQueue` for request/response flow - `KeeperAppendStream` for ordered Raft entry appends with flow control - Parallel read request batching and execution - Response queue backpressure via `onResponseDeallocated` callback NuRaft submodule bumped for virtual `append_entries_in_bg`, streaming mode support, and `STREAM_FORWARDING_REQUEST` message type. New settings: `use_new_dispatcher`, `max_in_flight_request_batches`, `max_request_queue_bytes_size`, `max_response_queue_bytes_size`, `optimize_read_order`, `dispatch_busy_wait_sleep_us`, `stream_suspect_retry_delay_ms`, `stream_in_flight_drain_timeout_ms`, `max_read_batch_size`, `max_read_batch_bytes_size`, `asio_streaming_mode`. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Remove unused `ErrorCodes::BAD_ARGUMENTS`, `ErrorCodes::ABORTED` from `KeeperRequestDispatcher.cpp`, unused `ProfileEvents` from `KeeperDispatcher.cpp` and `KeeperStateMachine.cpp`. Fix typos in `KeeperRequestDispatcher2.cpp`, `KeeperRequestDispatcher2.h`, and `NonblockingBoundedQueue.h`. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=101757&sha=2bfce0838853d8ec99a83361334a7e0b4f40cd27&name_0=PR&name_1=Style+check Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…nd why does it take 2 hours to get this error
…a crawl for some reason)
…erformance because nuraft is silly, working on it), make it independent from nuraft_streaming_mode (which is useful for other things too)
…equestDispatcher2 -> KeeperRequestDispatcher
Adds a regex filter for the NuRaft shutdown-time message `RaftInstance: session N failed to read rpc header from socket ::1:PORT due to error E, ..., ref count R` to the upgrade-runner allow-list. The message comes from `rpc_session::start` in `contrib/NuRaft/src/asio_service.cxx` when the peer of an accepted RPC connection closes its socket before the acceptor cancels the pending read. In single-node Keeper the peer is a loopback `::1` client, so this fires routinely during shutdown. The already-allow-listed sibling `RaftInstance: failed to accept a rpc connection due to error 125` covers the inverse race (acceptor wins); this one covers the variant where the peer wins and the read returns EOF (or any other transient socket error). Failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=101757&sha=f6f0e80f9529c3ed3fa183d2a0cdf259824e8a58&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29 PR: #101757 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
KeeperDispatcher overhaul
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #101757
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job