Tablet Selection
Introduction #
For both VTGate VStreams and VTTablet VReplication streams we must choose a tablet to serve the role of source (vstreamer). This
tablet selection is performed by the internal TabletPicker
component.
Cells #
By default the TabletPicker
will only look for viable (healthy and serving) source tablets of the specified tablet type(s) within the local cell of the
calling process β the vtgate
managing the VStream or the target vttablet
for the VReplication stream β and it will select a random one from the candidate
list. If you want to support cross-cell streams then you will need to specify the list of cells or any
CellAlias that contain a list of cells using the --cells
flag in your VReplication
workflow commands like MoveTables
or the
VStreamFlags.Cells
field in a
VStreamRequest
.
Tablet Types #
VReplication #
For VReplication, the server side default which determines the candidate types made available for potential selection as the source for a stream is set
using the vttablet
--vreplication_tablet_type
flag (default value is in_order:REPLICA,PRIMARY
). The target tablet
will provide this value to the TabletPicker
to determine the viable source tablet candidates. You can override this default on the client side using your
workflow command's --tablet_types
flag.
You can also specify an order of preference for the tablet types using the in_order:
prefix in both the server and client flags. For example,
--tablet_types "in_order:REPLICA,PRIMARY"
would cause a replica source tablet to be used whenever possible and a primary tablet would only be used as
a fallback in the event that there are no viable replica tablets available at the time.
VStream #
For a VStream there is no default tablet type. You must specify an individual tablet type using the
VStreamRequest.TabletType
field.