forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
117656: streamingest: support reversing replication direction r=msbutler a=dt After promoting a standby that was replicating from some primary to be its own active cluster, turning it into the new primary, it is often desirable to reverse the replication direction, so that changes made to this now-primary cluster are replicated _back_ to the former primary, now operating as a standby. Turning a formerly active, primary cluster into a replicating standby cluster is particularly common during "failback" flows, where the once primary cluster is returned to primary status after the standby had temporarily been made the active cluster. Re-promoting the primary in such cases requires it have a virtual cluster that is fully caught up with the promoted standby cluster that is serving traffic, then performing cut-over from that standby back to the primary. This _could_ be performed by creating a completely new virtual cluster in the primary cluster from a replication stream of the temporarily active standby; just like the creation of a normal secondary replicating cluster this would start by backfilling all data from the source -- the promoted standby -- and then continuously applying changes as they are streamed to it. However, in cases where this is being done on a cluster _that previously was the primary cluster_, the cluster may still have a nearly up to date copy of the virtual cluster, with only those writes that have been applied by the promoted standby after cutover missing from it. In such cases, backfilling a completely new virtual cluster from the promoted standby involves copying far more data than needed; most of that data is _already on the primary_. Instead, the new syntax `ALTER VIRTUAL CLUSTER a START REPLICATION FROM a ON x` can be used to indicate the virtual cluster 'a' should be rewound back to the time at which virtual cluster 'a' on physical cluster 'x' -- the promoted standby -- diverged from it. This will check with cluster x to confirm that its virtual cluster a was indeed replicated from the cluster running the command, and then communicate the time after which they diverged, once cluster x was made active and started accepting new writes. The cluster rewinds virtual cluster x back to that timestamp, then starts replicating from cluster x at that timestamp. Release note (enterprise change): A virtual cluster which was previously being used as the source for physical cluster replication into a standby in another cluster which has since been activated can now be reconfigured to become a standby of that now-promoted cluster, reversing the direction of the replication stream, and does so by reusing the existing data as much as possible. Epic: CRDB-34233. Co-authored-by: David Taylor <[email protected]>
- Loading branch information
Showing
17 changed files
with
364 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.