Repository navigation
Fix Keeper termination on get /keeper/availability_zone with quorum_reads=true - #104663
Conversation
…_reads=true The skip for `keeper_availability_zone_path` in `Get` and `ListRecursive` `preprocess` returned early without producing a `ZNONODE` delta for an unconfigured AZ, so `processImpl<false>` then called `onStorageInconsistency` and the request poisoned the raft log on restart. Drop the skip; the regular `uncommitted_state.getNode` path returns `ZNONODE` when AZ is unconfigured and keeps returning the node with stat when it is configured.
|
Changes make sense. Can you tell me why are you running Keeper with quorum reads? |
|
Workflow [PR], commit [8fa0424] Summary: ✅ AI ReviewSummaryThis PR removes the Findings❌ Blockers
Tests
Final VerdictStatus: Minimum required actions:
|
| if (zk_request.path == Coordination::keeper_api_feature_flags_path | ||
| || zk_request.path == Coordination::keeper_config_path | ||
| || zk_request.path == Coordination::keeper_availability_zone_path) | ||
| || zk_request.path == Coordination::keeper_config_path) |
There was a problem hiding this comment.
ListRecursive still skips preprocess for keeper_config_path, but unlike Get there is no dedicated /keeper/config branch in processImpl.
With quorum_reads=true, ListRecursive /keeper/config goes through the RAFT commit path, misses container.find in processImpl<false>, and then reaches onStorageInconsistency (the same termination pattern this PR fixes for /keeper/availability_zone).
Can we either remove keeper_config_path from this skip list for ListRecursive, or add explicit /keeper/config handling in ListRecursive::processImpl so it returns a normal response/error instead of terminating Keeper?
| assert "node doesn't exist" in error | ||
| assert "/keeper/availability_zone" in error | ||
|
|
||
| # The keeper should still be alive — no SIGABRT, no raft-log poisoning. |
There was a problem hiding this comment.
This validates the immediate post-request behavior, but the PR description also claims replay after restart is fixed (no RAFT-log poisoning loop).
Could we add one restart step after _assert_znonode (or in a dedicated test): restart the same keeper instance, wait for reconnection, and run get("/keeper/availability_zone") again? That would directly prove the replay path no longer triggers termination.
@antonio2368 For context, after a Keeper HA event, ClickHouse → Keeper connections don't automatically rebalance; they stay pinned to whichever Keeper node they failed over to. We were testing an AZ-aware Keeper configuration so that each ClickHouse would prefer a same-AZ Keeper. During that rollout, we hit this bug. |
LLVM Coverage Report
Changed lines: 80.00% (8/10) | lost baseline coverage: 8 line(s) · Uncovered code |
ad8631f
Cherry pick #104663 to 26.4: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
…lability_zone` with `quorum_reads=true`
Backport #104663 to 26.4: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
Cherry pick #104663 to 25.8: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
…lability_zone` with `quorum_reads=true`
Cherry pick #104663 to 26.2: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
…lability_zone` with `quorum_reads=true`
Cherry pick #104663 to 26.3: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
…lability_zone` with `quorum_reads=true`
Backport #104663 to 26.2: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
Backport #104663 to 25.8: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
Backport #104663 to 26.3: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
…eeper/availability_zone` with `quorum_reads=true`
…4663 Backport ClickHouse#104663 to 26.4: Fix Keeper termination on get `/keeper/availability_zone` with `quorum_reads=true`
Problem. When ClickHouse Keeper runs with
<quorum_reads>true</quorum_reads>and<placement>absent,get /keeper/availability_zonereachesprocessImpl<false>via the raft commit path, fails thecontainer.findlookup, and triggersonStorageInconsistency→std::terminate. The request is already in the raft log, so every restart replays it and the Keeper terminates again — raft-log poisoning that leaves the Keeper cluster stuck in a restart crash loop.Fix. Drop
keeper_availability_zone_pathfrom thepreprocessearly-return list in bothGetandListRecursive. The regularuncommitted_state.getNodecheck now runs and emits aZNONODEErrorDeltawhen the AZ node is not in the container.Why. The early-return skip was correct only while AZ was served by a dedicated
processImplbranch and never lived instorage.container. Commit 06ff714 moved AZ intosystem_nodes_with_databehindif (!keeper_az.empty())and removed that branch, but thepreprocessskip was left behind. With<placement>absent the node is never registered. The skip preventspreprocessfrom producing theZNONODEErrorDeltathat would have short-circuitedcommit, so the request flows on tocontainer.findand trips the fail-fast branch.ListRecursivewas introduced with the same skip line in PR #100998. Removing the skip makes thequorum_reads=trueresponse match thequorum_reads=falseresponse (processLocalRequests→processImpl<true>'s gracefulZNONODE).tests/integration/test_keeper_availability_zone_quorum_reads/covers unconfigured + configured AZ underquorum_reads=true, plus the local-read path.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix Keeper termination and restart loop when
get /keeper/availability_zoneis sent withquorum_reads=trueto a Keeper without<placement>configured.Version info
26.5.1.56126.4.3.29,26.3.11.27,26.2.19.37,25.8.24.20