Repository navigation
Do not fail reads of system.part_moves_between_shards when a replicated table has no Keeper tree - #122132
Conversation
…ed table has no Keeper tree
A replicated table whose Keeper tree is absent stays attached in read-only mode
rather than failing to attach: ReplicatedMergeTreeAttachThread::runImpl logs
"No metadata in ZooKeeper for {}: table will stay in readonly mode", sets
has_metadata_in_zookeeper = false and returns early. That early return skips
createNewZooKeeperNodes(), whose asyncTryCreateNoThrow back-fills
<zookeeper_path>/part_moves_shard, so such a table has no task node for the
life of the server.
PartMovesBetweenShardsOrchestrator::syncStateFromZK() read that node with the
throwing getChildren, and StorageSystemPartMovesBetweenShards::fillData has no
per-table isolation, so the ZNONODE from one degraded table aborted the entire
query for every user with Code: 999. KILL PART_MOVE_TO_SHARD is implemented as
exactly that read and cannot prune by task_uuid, since only database and table
are pushed down, so the statement was unusable server-wide as well.
Read the node with tryGetChildren instead. It suppresses only ZNONODE and
rethrows every other code, so connection loss, session expiry, operation
timeout and auth failures still propagate unchanged. An absent
part_moves_shard node means no part-move tasks, so the empty snapshot is the
true answer, and it is published through the existing entries = new_entries
exit rather than a new return path.
The write side is unaffected: movePartitionToShard calls
getZooKeeperAndAssertNotReadonly() before creating a task znode, so MOVE PART
TO SHARD on such a table is still refused with TABLE_IS_READ_ONLY.
Observed on 26.8.11.37 in Stateless tests (amd_asan_ubsan, distributed plan,
parallel), where a concurrently attached treeless table made
05082_kill_and_system_on_cluster_access_types fail.
Co-Authored-By: Claude Opus 5 <[email protected]>
The test's only part-move observable was absence: it expects zero rows from system.part_moves_between_shards and targets the zero UUID with KILL PART_MOVE_TO_SHARD, which cannot match. An implementation that never issues the listing at all therefore satisfies the reference for free. Deleting the zk->tryGetChildren call and leaving the empty Strings behind publishes the same empty vector through the same exit, so the reference still matches and the test stays green. Assert through system.zookeeper_log that the List on the absent path was issued and was answered ZNONODE. The predicate uses count() > 0 rather than an exact count because the number of List requests per query is not contractual, and it carries no op_num predicate because makeListRequest maps to List, SimpleList, FilteredList or FilteredListWithStatsAndData depending on Keeper feature flags. The path is unique per run via CLICKHOUSE_TEST_ZOOKEEPER_PREFIX, so the assertion stays parallel-safe and nothing else ever touches that path for this table. The explicit SYSTEM FLUSH LOGS zookeeper_log is required because the log's flush_interval_milliseconds is 7500. Measured three ways on one rig: green on the fix 10/10; red on a mutant with the listing call deleted, where the new assertion prints 0 while the other two still match; red on the pristine base with Code 999 on both reads. Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex). Two cold passes: one on the fix
Cost of reading Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20260925-003800 |
|
Workflow [PR], commit [5e986e4] Summary: ❌
AI ReviewSummaryThis PR changes Final VerdictStatus: ✅ Approve LLVM Coverage ReportMeasured on commit 5e986e4.
Changed lines: Changed C/C++ lines covered: 4/5 (80.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 16 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - 5e986e4Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose
All 176 checks accounted for (134 pass, 39 not selected, Session id: cron:our-pr-ci-monitor:20260925-060048 |
e823efc
…alized-query-plan-112891 Picks up ClickHouse#122132, which fixes the 05082_kill_and_system_on_cluster_access_types failure in Stateless tests (arm_binary, parallel) on 101ef90. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@alexey-milovidov could you add 05082 is on all four active release branches through the #118360 backports, but this fix is on none of them: 26.3, 26.7, 26.8 and 26.9 still use the throwing The label expands to exactly those four branches, and the source change applies cleanly on each. |
…e log scan Stress worker 1 (`--database=test_1`) runs with `memory_tracker_fault_probability=0.05`. Work that the stress phase leaves behind keeps the settings of the query that created it and is executed again by the upgraded server after the restart: - a distributed DDL entry stores the initiator's changed settings (`DDLLogEntry`) and `DDLTaskBase::makeQueryContext` applies them, so a queued `BACKUP ... ON CLUSTER` of `test_1` replays with fault injection and `BackupsWorker` logs `Failed to make internal backup ... fault injected` at `<Error>`; - a pending `Distributed` batch is sent with its stored settings, and the receiving async-insert flush logs `AsynchronousInsertQueue: Failed insertion ... fault injected` at `<Error>` with an empty query id, so the existing `} <Error> executeQuery: Code:` entry does not cover it. Seen on three unrelated PRs in 90 days (ClickHouse#123464, ClickHouse#117943, ClickHouse#120725); in each job these lines were the only output of the scan. Nothing enables fault injection on the upgraded server itself, so the message can only come from carried-over stress work. Ignore it as a fixed string, the same string the stress smoke check already tolerates (`ci/jobs/scripts/stress/stress.py`). It is MemoryTracker's message for both injection sites and does not match a real `memory limit exceeded` error. The large DDL backlog in the ClickHouse#123464 job comes from the previous release (26.9) wedging its DDLWorker on `KILL PART_MOVE_TO_SHARD ... ON CLUSTER`, which ClickHouse#122132 fixed on master only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
SELECTfromsystem.part_moves_between_shardsandKILL PART_MOVE_TO_SHARDfailing withCode: 999 ... No node, path .../part_moves_shardwhen any replicated table on the server is attached without its Keeper tree.Description
On 26.8.11.37,
SELECT ... FROM system.part_moves_between_shards- andKILL PART_MOVE_TO_SHARD, which reads it - fail withCode: 999 ... No node, path .../part_moves_shardwhenever any replicated table on the server is attached without its Keeper tree, which is an intended read-only state rather than an error.Root cause. Such a table stays attached in read-only mode instead of failing to attach (
ReplicatedMergeTreeAttachThread.cpp:158-163), and that early return skips thecreateNewZooKeeperNodes()back-fill, so it has nopart_moves_shardnode for the life of the server.syncStateFromZK()read that node with the throwinggetChildren, andStorageSystemPartMovesBetweenShards::fillDatahas no per-table isolation, so one degraded table aborted the whole query for every user. Onlydatabaseandtableare pushed down, so avoiding it means naming it, whichKILL PART_MOVE_TO_SHARD WHERE task_uuid = ...cannot.Fix. Read it with
tryGetChildren, which suppresses onlyZNONODE(ZooKeeper.cpp:487-492), so connection loss, session expiry and auth failures still propagate. Nopart_moves_shardnode means no part-move tasks, so an empty snapshot is the true answer. Single site:syncStateFromZK()is the only reader of that path, and all three callers go through it.system.part_moves_between_shards,KILL PART_MOVE_TO_SHARDMOVE PART TO SHARD)TABLE_IS_READ_ONLYbefore any createsystem.replicas/replication_queue/mutations/detached_partsgetat:104DROP, not reproducible without a new failpointValidation. New test red before / green after; the reported failure reproduced byte-for-byte and green after; 50 runs each of it,
05082,04077,02841and04831, interleaved, in a randomized and a non-randomized arm (500 runs), no failures.Failing CI job: https://github.com/ClickHouse/ClickHouse/actions/runs/36044079089/job/107790703975 (report)
Workflow [PR]
Sync PR [sync-upstream/pr/122132]
Version info
26.10.1.862-master(included in26.10and later)