Repository navigation
Set Coordination component in PartMovesBetweenShardsOrchestrator - #101462
antonio2368 merged 4 commits into
Conversation
When enforce_keeper_component_tracking is enabled, ZooKeeper requests require a coordination component to be set via setCurrentComponent(). PartMovesBetweenShardsOrchestrator's methods (run, getEntries, getEntryByUUID, killPartMoveToShard) make ZooKeeper calls without setting the component, causing LOGICAL_ERROR crashes with "Current component is empty". This was triggered by stress tests running queries against system.part_moves_between_shards, which calls getEntries() -> syncStateFromZK() -> zk->getChildren(). The crash affected 14+ unrelated PRs in CI. Fix: Add Coordination::setCurrentComponent RAII guard at all four public entry points that can trigger ZK access. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Pre-PR Validation Gate (session: cron:clickhouse-ci-task-worker:20260401-064500)a) Deterministic repro? ✅ b) Root cause? ✅ c) Fix matches root cause? ✅ Added d) New tests added? ✅ e) Demonstrated in both directions? ✅ Without fix: LOGICAL_ERROR crash on every execution. With fix: 20/20 passes, f) Fix is general? ✅ All 4 public methods covered: |
|
cc @antonio2368 @Michicosun — could you review this? This is the same class of missing |
antonio2368
left a comment
There was a problem hiding this comment.
Great job putting the component guards at correct place.
|
|
||
| PartMovesBetweenShardsOrchestrator::Entry PartMovesBetweenShardsOrchestrator::getEntryByUUID(const UUID & task_uuid) | ||
| { | ||
| auto component_guard = Coordination::setCurrentComponent("PartMovesBetweenShardsOrchestrator"); |
There was a problem hiding this comment.
This can be removed as it's covered by killPartMoveToShard.
There was a problem hiding this comment.
Good catch — removed in dd3739b. getEntryByUUID is private and only called from killPartMoveToShard, so the guard there was indeed redundant.
|
Workflow [PR], commit [96ac68a] Summary: ❌
AI ReviewSummaryThis PR fixes a real correctness issue in ClickHouse Rules
Final Verdict
|
getEntryByUUID is a private method only called from killPartMoveToShard, which already sets the Coordination component guard. The guard in getEntryByUUID was therefore redundant. Addresses review feedback from @antonio2368.
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
|
Done — merged latest master (includes the SimSIMD SVE MSan fix from #101239) into the branch. CI should re-run with the fix included. |
LLVM Coverage Report
Changed lines: 25.00% (3/12) · Uncovered code |
ef3b391
|
26.3 is the only active release branch without this fix, and a test that is being backported there right now aborts the server because of it.
#118360 adds Branch state, measured against this PR's merge commit
26.3 was cut 2026-03-19, 20 days before this merged, while 26.4 was cut 2026-04-21 and inherited the guard, so 26.3 is the only active branch on the wrong side of the cut. No cherry-pick or backport branch for this PR has ever existed, so nothing was declined earlier. Scope, stated plainly: @alexey-milovidov could you apply |
|
Backporting to merge #122038 |
Backport #101462 to 26.3: Set Coordination component in PartMovesBetweenShardsOrchestrator
…tMovesBetweenShardsOrchestrator
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix LOGICAL_ERROR crash "Current component is empty" when querying
system.part_moves_between_shardswithenforce_keeper_component_trackingenabled.What this PR does
When
enforce_keeper_component_trackingis enabled, all ZooKeeper requests must have a coordination component set viaCoordination::setCurrentComponent(). ThePartMovesBetweenShardsOrchestratorwas missing these guards, causing crashes in stress tests.Root cause:
getEntries()→syncStateFromZK()→zk->getChildren()→pushRequest()throws LOGICAL_ERROR because no component is set in thread-local storage.Trigger: Any query to
system.part_moves_between_shardswhen aReplicatedMergeTreetable exists. The stress test02841_not_ready_set_bug.shdoes exactly this. 14+ unrelated PRs affected in CI.Fix: Add
Coordination::setCurrentComponent("PartMovesBetweenShardsOrchestrator")RAII guard at all four public entry points:run()— background orchestrator threadgetEntries()— called fromsystem.part_moves_between_shardsgetEntryByUUID()— called when killing a part movekillPartMoveToShard()— called fromKILL PART_MOVE_TO_SHARDThis follows the same pattern used in PRs #98663, #99630, #98188 to fix the same class of missing-component bugs.
Stack trace (from CI):
Testing
enforce_keeper_component_tracking: true02841_not_ready_set_bugpasses 5/504077_part_moves_between_shards_keeper_componentVersion info
26.4.1.663-master(included in26.4and later)26.3.33.151