Skip to content

Commit

Permalink
Moar minor tablet selection tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Dec 22, 2022
1 parent 790d041 commit a8a0eba
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions content/en/docs/16.0/reference/vreplication/tablet_selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,26 @@ need to replicate the streamed writes within the target shard.

### Cells

By default the `TabletPicker` will only look for viable (healthy and serving) source tablets 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](https://vitess.io/docs/reference/programs/vtctl/cell-aliases/) that
contain the list of potential cells using the `--cells` flag in your VReplication workflow commands like [`MoveTables`](../movetables/) or the
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](https://vitess.io/docs/reference/programs/vtctl/cell-aliases/) that contain a list of cells using the `--cells` flag in your VReplication
workflow commands like [`MoveTables`](../movetables/) or the
[`VStreamFlags.Cells`](https://pkg.go.dev/vitess.io/vitess/go/vt/proto/vtgate#VStreamFlags) field in a
[`VStreamRequest`](https://pkg.go.dev/vitess.io/vitess/go/vt/proto/vtgate#VStreamRequest).

### Tablet Types

#### VReplication
For VReplication, the server side default which determines the candidate types made available for potential selection in a stream is set using the
[`vttablet` `--vreplication_tablet_type` flag](../flags/#vreplication_tablet_type) (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
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](../flags/#vreplication_tablet_type) (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
For a VStream there is no default tablet type. You must specify an individual tablet type using the
[`VStreamRequest.TabletType`](https://pkg.go.dev/vitess.io/vitess/go/vt/proto/vtgate#VStreamRequest) field.

0 comments on commit a8a0eba

Please sign in to comment.