Repository navigation
Write part_log entry before reporting a plain MergeTree mutation as done - #107741
Conversation
Otherwise after "ALTER SETTINGS mutations_sync=2" and "SYSTEM FLUSH LOGS
part_log" you may not see this mutation as in [1]:
2026-06-17T13:01:58.1385357Z [2026-06-17 13:01:58] [ 6835 / 11515] 03568_mutation_affected_rows_counter: [ FAIL ] 0.18 sec.
2026-06-17T13:01:58.1386195Z [2026-06-17 13:01:58] Reason: result differs with reference:
2026-06-17T13:01:58.1387248Z [2026-06-17 13:01:58] --- /home/ubuntu/actions-runner/_work/ClickHouse/ClickHouse/tests/queries/0_stateless/03568_mutation_affected_rows_counter.reference
2026-06-17T13:01:58.1388336Z 2026-06-17 14:54:43.238557950 +0200
2026-06-17T13:01:58.1389136Z [2026-06-17 13:01:58] +++ /home/ubuntu/actions-runner/_work/ClickHouse/ClickHouse/tests/queries/0_stateless/03568_mutation_affected_rows_counter.216313.stdout
2026-06-17T13:01:58.1389938Z 2026-06-17 15:01:58.111713786 +0200
2026-06-17T13:01:58.1390288Z [2026-06-17 13:01:58] @@ -1,2 +1 @@
2026-06-17T13:01:58.1390611Z [2026-06-17 13:01:58] 151 2
2026-06-17T13:01:58.1390888Z [2026-06-17 13:01:58] -1000 1
[1]: https://github.com/ClickHouse/ClickHouse/actions/runs/27690285295
|
Workflow [PR], commit [189f802] Summary: ❌
AI ReviewSummaryThis PR tries to make plain Findings
Tests
Final VerdictStatus: Minimum required action: close the success-path timed-poll race and add focused coverage or another proof that |
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
7267e1c to
189f802
Compare
| /// Write the part log entry before reporting the mutation as done, otherwise a | ||
| /// synchronous mutation (mutations_sync) may return to the client before the | ||
| /// MutatePart row is queued, so a subsequent SYSTEM FLUSH LOGS misses it. | ||
| write_part_log({}); |
There was a problem hiding this comment.
This still does not guarantee that mutations_sync waits for the part-log row. waitForMutation is not only woken by updateMutationEntriesErrors; it also polls every second. After transaction.commit the mutated part is visible, so a waiter whose timed wait expires while this background task is between the commit and this write_part_log will see getIncompleteMutationsStatus as done and can return before the MutatePart row is queued. An immediate SYSTEM FLUSH LOGS part_log can still take its target before this push. Please make the completion condition observed by mutations_sync happen after the part-log entry is queued, or otherwise block the timed-poll path too.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 14/14 (100.00%) | Lost baseline coverage: none · Uncovered code |
baadbda
Otherwise after "ALTER SETTINGS mutations_sync=2" and "SYSTEM FLUSH LOGS part_log" you may not see this mutation as in 1:
Changelog category (leave one):
Version info
26.6.1.1052