Skip to content

Commit

Permalink
Update the vstream doc in v17.0 (#1410)
Browse files Browse the repository at this point in the history
* Update the vstream doc in v17.0 to reflect vitessio/vitess#11886

Signed-off-by: yoheimuta <yoheimuta@gmail.com>

* Update content/en/docs/17.0/reference/vreplication/vstream.md

Co-authored-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: yohei yoshimuta <yoheimuta@gmail.com>

* Update content/en/docs/17.0/reference/vreplication/vstream.md

Co-authored-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: yohei yoshimuta <yoheimuta@gmail.com>

* Update content/en/docs/17.0/reference/vreplication/vstream.md

Co-authored-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: yohei yoshimuta <yoheimuta@gmail.com>

* Update content/en/docs/17.0/reference/vreplication/vstream.md

Co-authored-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: yohei yoshimuta <yoheimuta@gmail.com>

* Update content/en/docs/17.0/reference/vreplication/vstream.md

Co-authored-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: yohei yoshimuta <yoheimuta@gmail.com>

* Remove the unused forward slash at the end of Match value

Signed-off-by: yoheimuta <yoheimuta@gmail.com>

* Add an empty line between the sections

Signed-off-by: yoheimuta <yoheimuta@gmail.com>

---------

Signed-off-by: yoheimuta <yoheimuta@gmail.com>
Signed-off-by: yohei yoshimuta <yoheimuta@gmail.com>
Co-authored-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
yoheimuta and mattlord authored Mar 16, 2023
1 parent 83e8d2a commit 8fb5ea9
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions content/en/docs/17.0/reference/vreplication/vstream.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ The keyspace, shard, and GTID position list to start streaming from. If no `Shar
then a [table copy phase](https://github.com/vitessio/vitess/issues/6277) will be initiated for the tables matched
by the provided [filter](#filter) on the given shard.

If the `ShardGtid.Shard` value is omitted, this means that all shards in the keyspace specified in the `ShardGtid.Keyspace` value are included.
Additionally, if the `ShardGtid.Keyspace` value has a `/` prefix, you can use regular expressions such as `/.*` to include all keyspaces.

#### Filter

**Type** [Filter](https://pkg.go.dev/vitess.io/vitess/go/vt/proto/binlogdata#Filter)\
Expand Down Expand Up @@ -197,6 +200,56 @@ for {
...
```
</br>
#### Copy All Tables From All Shards in the `ks` Keyspace
Below is a snippet in Go that demonstrates how to copy from all shards by omitting `ShardGtid.Shard`:
```go
vgtid := &binlogdatapb.VGtid{
ShardGtids: []*binlogdatapb.ShardGtid{{
Keyspace: "ks",
Gtid: "",
}},
}
filter := &binlogdatapb.Filter{
Rules: []*binlogdatapb.Rule{{
Match: "/.*",
}},
}
flags := &vtgatepb.VStreamFlags{}
reader, err := gconn.VStream(ctx, topodatapb.TabletType_PRIMARY, vgtid, filter, flags)
```
</br>
#### Copy All Tables From All Shards in All Keyspaces
Below is a snippet in Go that demonstrates how to copy from all keyspaces by specifying `/.*` as the value for `ShardGtid.Keyspace`:
```go
vgtid := &binlogdatapb.VGtid{
ShardGtids: []*binlogdatapb.ShardGtid{{
Keyspace: "/.*",
Gtid: "",
}},
}
filter := &binlogdatapb.Filter{
Rules: []*binlogdatapb.Rule{{
Match: "/.*",
}},
}
flags := &vtgatepb.VStreamFlags{}
reader, err := gconn.VStream(ctx, topodatapb.TabletType_PRIMARY, vgtid, filter, flags)
```
</br>
{{< warning >}}
Copying from all keyspaces can generate a significant amount of load and potentially impact production traffic.
Therefore, please exercise caution when using regular expressions in production.
{{< /warning >}}
## Debugging
There is also an SQL interface that can be used for testing and debugging from a `vtgate`. Here's an example:
Expand Down

0 comments on commit 8fb5ea9

Please sign in to comment.