Repository navigation
Cherry pick #127656 to 26.8: Fix SYSTEM RESTORE REPLICA leaving a replica behind the table metadata version on concurrent restores - #128780
Conversation
…ncurrent restores SYSTEM RESTORE REPLICA raises the table's /metadata znode version to the highest metadata_version of the restored parts. It did that with plain SETs, after the table and the first replica were already visible, and without any replication log entry. A replica restored at the same time (ON CLUSTER) could copy the first replica, or read /metadata, before the raise finished; nothing ever moved it to the final version, so every ALTER on it failed with CANNOT_ASSIGN_ALTER. The SETs also raised the version BY the parts' version instead of TO it, so each restored replica added it again. Raise the version TO the target, in version-checked batches of at most MULTI_BATCH_SIZE SETs. Each batch also creates an ALTER_METADATA log entry of the version it reaches, in the same multi, so every version /metadata is published at has a log entry that carries every replica to it. The replica running the restore no longer sets its own metadata_version; it reaches the version by executing those entries, like the replica that runs an ALTER. A concurrent ALTER or restore makes the batch fail with ZBADVERSION; the loop re-reads the structure and continues, so nothing is overwritten. The failpoint rmt_restore_replica_pause_before_metadata_version_raise lets the test pause one restore right before the raise. Closes #127629 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shorten the batched metadata version raise comment to one line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ca-metadata-version Fix `SYSTEM RESTORE REPLICA` leaving a replica behind the table metadata version on concurrent restores
|
The only conflicts are in the failpoint lists of
|
# Conflicts: # src/Common/FailPoint.cpp # src/Storages/StorageReplicatedMergeTree.cpp
|
🕵 Thanks @groeneai. I resolved the conflicts by merging |
Original pull-request #127656
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job