Skip to content

Instantly share code, notes, and snippets.

@mattlord
Created August 27, 2021 20:01
Show Gist options
  • Save mattlord/794fcfd7e9a5eb2b45839fbe55e4f10e to your computer and use it in GitHub Desktop.
Save mattlord/794fcfd7e9a5eb2b45839fbe55e4f10e to your computer and use it in GitHub Desktop.

For VReplication streams, we must choose a tablet to serve the role of vstreamer (source) and vapplier (target) in the replication stream.

Key context for the tablet picker: cells, keyspace, shard, and tablet types (primary/master, replica).

ℹ️ VReplication will only look for tablet pairings within the same cell. If you want to have cross-cell streams then you will need to create a CellAlias that contains the list of potential cells and specify that using the -cell flag in your VReplication workflow commands.

The tablet picker logic for is here. It gets a set of valid candidates for the source and target of the stream:

  • Source (vstreamer): it uses the random tablet returned by the tablet picker from the viable candidates of the specified types in your workflow command's -tablet_types flag

    ⚠️ The default value for the VReplication workflow command's -tablet_types flag is "PRIMARY/MASTER,REPLICA"

  • Target (vapplier) : it must choose a viable primary tablet as we need to do writes that are then replicated within the target shard

The relevant callsites are:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment