Skip to content

Cherry pick #101757 to 26.5: KeeperDispatcher overhaul - #105769

Merged
robot-ch-test-poll1 merged 62 commits into
backport/26.5/101757from
cherrypick/26.5/101757
May 25, 2026
Merged

robot-ch-test-poll1 merged 62 commits into
backport/26.5/101757from
cherrypick/26.5/101757

Conversation

@robot-ch-test-poll1

Copy link
Copy Markdown
Contributor

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-pick locally.
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:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

al13n321 and others added 30 commits April 7, 2026 15:45
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
…erformance because nuraft is silly, working on it), make it independent from nuraft_streaming_mode (which is useful for other things too)
al13n321 and others added 25 commits May 15, 2026 17:38
…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]>
@robot-ch-test-poll1 robot-ch-test-poll1 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request labels May 25, 2026
@robot-ch-test-poll1
robot-ch-test-poll1 merged commit b1669e1 into backport/26.5/101757 May 25, 2026
@robot-ch-test-poll1
robot-ch-test-poll1 deleted the cherrypick/26.5/101757 branch May 25, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants