Repository navigation
Pull the replication log before MOVE PART ... TO SHARD checks the part (flaky 05495_part_moves_between_shards_step_retry) - #129409
Conversation
…redicate A part inserted on a replica enters that replica's `queue.virtual_parts` only when the replica pulls the part's own GET_PART log entry, which the background `queueUpdatingTask` does asynchronously. `movePartitionToShard` builds a `ReplicatedMergeTreeZooKeeperMergePredicate`, whose constructor snapshots `virtual_parts` into `prev_virtual_parts` before it pulls the log, and `canUsePartInMerges` rejects a part missing from that snapshot. So `ALTER TABLE ... MOVE PART ... TO SHARD` issued right after an INSERT on the same replica fails with "Part ... does not contain in snapshot of previous virtual parts. (PART_IS_TEMPORARILY_LOCKED)" while the background pull is still in flight. On the macOS Fast test runner the client round trips are short enough to hit this window, which makes 05495_part_moves_between_shards_step_retry time out. `dropPartImpl` got the same fix in ClickHouse#76039 (pull the log with MERGE_PREDICATE before `getMergePredicate`); `movePartitionToShard`, whose check block is a copy of `dropPart`'s, never did. Port that call. The new test stops log pulling, inserts, then restarts pulling and moves the part in one client call, so the insert's entry is not in the queue when the MOVE starts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
SYSTEM STOP PULLING REPLICATION LOG only cancels the pull blocker; it does not wait for a pullLogsToQueue that already passed the blocker check. The queue-updating task started by CREATE TABLE could therefore read /log after the INSERT and put the part into virtual parts, so the test could pass without the fix by timing alone. SYSTEM SYNC REPLICA src PULL finishes that pull before the blocker is set, the same drain 02903_rmt_retriable_merge_exception uses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 2 rounds, 1 finding) plus my own review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261105-000000 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20261104-235100 |
|
cc @tavplubix @CheSema, could you review this and add the |
|
Workflow [PR], commit [f3172ab] Summary: ✅
AI ReviewSummaryReviewed PR head Final VerdictStatus: ✅ Approve. |
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, 38 s compile time in total, 7 of them have a recent master baseline. |
Algunenano
left a comment
There was a problem hiding this comment.
LGTM. @groeneai Please audit the code and see if there are any more issues remaining like this
|
Acknowledged. I am auditing the other |
|
@Algunenano I audited it and found no other instance, so there is no follow-up PR. The stale state is
In CIDB over the last 60 days, |
0a8bddf
A test added by a PR now fails the Fast test when it runs longer than 15 s, or 7.5 s when it is tagged `no-parallel` (or `sequential`). Existing tests are not checked. The Config Workflow hook `store_data.py` stores, for a PR, the files under `tests/queries/0_stateless/` that GitHub reports as `added` or `copied` as the KV key `new_stateless_test_files`. A renamed test is an old test, so it is not included. `fast_test.py` marks an `OK` row of such a test as `FAIL` when its duration is over the limit, reusing `Targeting.functional_test_source_file` and `Targeting.is_sequential_functional_test` from `find_tests.py`. The parent `Tests` result goes from `OK` to `FAIL`; an `ERROR` or `FAIL` is kept. The merge queue and master runs store no key, so they are not checked. `find_tests.py` is not added to the Fast test digest: a PR that adds or copies a test file always changes the digest, so the job always runs. Requested in ClickHouse#129298 (comment) CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=129409&sha=latest&name_0=PR&name_1=Fast+test+%28arm_darwin%29 PR: ClickHouse#129409 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #76039
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Failure.
05495_part_moves_between_shards_step_retry(added in #129029) times out inFast test (arm_darwin), 4 of about 200 runs since 2026-11-04, e.g. #110211, #129179. ItsALTER TABLE ... MOVE PART ... TO SHARDfails withPart all_0_0_0 does not contain in snapshot of previous virtual parts. (PART_IS_TEMPORARILY_LOCKED), so no move entry is created and the polling loops run until the timeout.Root cause. A part inserted on a replica enters
virtual_partsonly when the backgroundqueueUpdatingTaskpulls its log entry.movePartitionToShardbuilds a merge predicate, which snapshotsvirtual_partsbefore pulling the log, andcanUsePartInMergesrejects a part missing from that snapshot. The server logs of the failing jobs show the MOVE starting while the background pull of the insert's entry was still in flight. #76039 fixed the same race forDETACH/DROP PARTby pulling the log beforegetMergePredicate;movePartitionToShard, whose check is a copy ofdropPart's, did not get that call.Change. Call
queue.pullLogsToQueue(..., MERGE_PREDICATE)beforegetMergePredicateinmovePartitionToShard, asdropPartImpldoes.Validation. The new test
05507_part_move_to_shard_after_unpulled_insert(STOP PULLING, INSERT, then START PULLING and MOVE in one call) fails 20/20 without the change with the same error and passes 50/50 with it under random settings;05495and03356_pull_entry_before_detach_partpass 50/50.Workflow [PR]
Sync PR [sync-upstream/pr/129409]
Version info
26.11.1.1510-master(included in26.11and later)