Repository navigation
Sync the replicas before the local backup in test_async_backups_to_same_destination - #131921
Conversation
…me_destination The `http-False` variant of `test_async_backups_to_same_destination` runs `BACKUP TABLE tbl TO <dest> ASYNC` without `ON CLUSTER` on node1 and node2 right after the `INSERT` on node1. Such a backup contains only the parts of the local replica, and only one of the two backups to the same destination succeeds. When node2's backup won before node2 had fetched `all_0_0_0`, the successful backup held only the table metadata (`num backup entries=1` in node2's log), `RESTORE` on node1 created an empty table, and the final check failed with `assert '' == '1\n'`. Run `SYSTEM SYNC REPLICA ON CLUSTER 'cluster' tbl` after the insert, as the other tests of this file do. The two backups still race for the destination. CI reports: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=126329&sha=a56d34954af566916a3978497a004b351f6e2642&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%202%2F5%29 (ClickHouse#126329) https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=109453&sha=806162ffe23baed3bee142174285056d8247ab1d&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%202%2F5%29 (ClickHouse#109453) Related: ClickHouse#89141 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; 0 findings) plus my own cold review of the diff (0 findings). No findings to adjudicate. The review checked that a Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261116-073001 |
|
cc @pamarcos, could you review this? test_async_backups_to_same_destination[http-False] sometimes restores an empty table because node2's local BACKUP (no ON CLUSTER) can win the destination before node2 fetched the inserted part; the test now runs SYSTEM SYNC REPLICA ON CLUSTER after the insert. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261116-065400 |
|
Workflow [PR], commit [d3e004a] Summary: ✅ AI ReviewSummaryThe PR synchronizes both replicas before Final VerdictStatus: ✅ Approve |
d9c002e
Related: #89141
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix flaky test
test_backup_restore_on_cluster/test.py::test_async_backups_to_same_destination.Description
test_async_backups_to_same_destination[http-False]fails withassert '' == '1\n'after the finalRESTOREinIntegration tests (arm_binary, 2/5)(1, 2; 17 times on 16 PRs and master since 2025-10). The old issue about it was closed as stale without a fix.The
http-Falsevariant runsBACKUP TABLE tbl TO <dest> ASYNCwithoutON CLUSTERon node1 and then on node2, right after theINSERTon node1. Such a backup contains only the parts of the local replica, and only one of the two backups gets the destination. In both failing runs node2's backup won and collected the table (num backup entries=1, metadata only) before node2 had fetchedall_0_0_0, so the restored table was empty.The test now runs
SYSTEM SYNC REPLICA ON CLUSTER 'cluster' tblafter the insert, as the other tests of this file do. The two backups still race for the destination, and the exactly-one-succeeds and restore checks are unchanged.Validation with the master debug build: with fetches stopped on node2, node2's backup has one entry and restores an empty table (3/3); running the new line before node2's backup gives 12 entries and restores
1(3/3). The fixed test passed 50 times per variant (150/150), and the wholetest.pypassed (49/49).Workflow [PR]
Sync PR [sync-upstream/pr/131921]
Version info
26.11.1.2810-master(included in26.11and later)