SwitchWrites

Route writes to target keyspace in a vreplication workflow

Command #

SwitchWrites  [-timeout=30s] [-cancel] [-reverse] [-reverse_replication=false] -tablet_types={replica|rdonly} [-dry-run] <keyspace.workflow>

Description #

SwitchWrites is used to switch writes for tables in a MoveTables workflow or for entire keyspace in the Reshard workflow away from the master in the source keyspace to the master in the target keyspace

Parameters #

-timeout #

optional
default 30s

Specifies the maximum time to wait, in seconds, for vreplication to catch up on primary migrations. The migration will be cancelled on a timeout.

-filtered_replication_wait_time #

DEPRECATED
default 30s

SwitchWrites first stops writes on the source master and waits for the replication to the target to catchup with the point where the writes were stopped. If the wait time is longer than filtered_replication_wait_time the command will error out. For setups with high write qps you may need to increase this value.

-cancel #

optional
default false

If a previous SwitchWrites returned with an error you can restart it by running the command again (after fixing the issue that caused the failure) or the SwitchWrites can be canceled using this parameter. Only the SwitchWrites is cancelled: the workflow is set to Running so that replication continues.

-reverse #

optional
default false

Reverse a previous SwitchWrites serve from source

-reverse_replication #

optional
default true

SwitchWrites, by default, starts a reverse replication stream with the current target as the source, replicating back to the original source. This enables a quick and simple rollback. This reverse workflow name is that of the original workflow concatenated with \_reverse.

-tablet_types #

mandatory

Tablet types to switch one or both or rdonly/replica (default "rdonly,replica")

-dry-run #

optional
default false

You can do a dry run where no actual action is taken but the command logs all the actions that would be taken by SwitchReads.

keyspace.workflow #

mandatory

Name of target keyspace and the associated workflow to SwitchWrites for.