Prevent migration operations running before previous finalization completes v2 #16190
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a node was the source of a backup replica migration
and then if it becomes the destination of another replica migration
on the same partition,
MigrationOperation
can be executed beforethe former migration is finalized. Reason is, sources of backup migrations
are not part of migration transactions and they learn the migration
only while applying completed migrations.
Previously, when we detect this, we skipped the execution of previous
migrations finalization to prevent data loss. See #14834
But this may cause replica data leak, because of ignored finalization.
This time, migration finalizations are registered before
they are executed or enqueued. If there's an pending finalization
while a migration operation is being executed then migration operation
is rejected with a retryable exception.
Fixes #15562
Fixes #16066
Backport of #16189