Overview of the Issue
For a VStream with StopOnReshard flag enabled the Journal event is sent correctly if the vstream is active when the reshard happens. However, if, after the reshard is complete, the vstream is restarted from the previous shard/gtid, it will not receive the Journal event.
Reproduction Steps
Modify vstream_client.go
--- a/examples/local/vstream_client.go
+++ b/examples/local/vstream_client.go
@@ -42,17 +42,26 @@ func main() {
var vgtid *binlogdatapb.VGtid
if streamCustomer {
vgtid = &binlogdatapb.VGtid{
- ShardGtids: []*binlogdatapb.ShardGtid{{
- Keyspace: "customer",
- Shard: "-80",
- // Gtid "" is to stream from the start, "current" is to stream from the current gtid
- // you can also specify a gtid to start with.
- Gtid: "", //"current" // "MySQL56/36a89abd-978f-11eb-b312-04ed332e05c2:1-265"
- }, {
- Keyspace: "customer",
- Shard: "80-",
- Gtid: "",
- }}}
+ ShardGtids: []*binlogdatapb.ShardGtid{
+ {
+ Keyspace: "customer",
+ Shard: "0",
+ Gtid: "",
+ },
+ },
+ }
} else {
vgtid = &binlogdatapb.VGtid{
ShardGtids: []*binlogdatapb.ShardGtid{{
@@ -75,6 +84,8 @@ func main() {
flags := &vtgatepb.VStreamFlags{
//MinimizeSkew: false,
//HeartbeatInterval: 60, //seconds
+ StopOnReshard: true,
}
./101_initial_cluster.sh; mysql < ../common/insert_commerce_data.sql; ./201_customer_tablets.sh ; ./202_move_tables.sh; ./203_switch_reads.sh; ./204_switch_writes.sh; ./205_clean_commerce.sh;
Run the reshard
./301_customer_sharded.sh; ./302_new_shards.sh; ./303_reshard.sh; ./304_switch_reads.sh; ./305_switch_writes.sh;
Receive the Journal event
[type:BEGIN timestamp:1724172966 current_time:1724172966973269000 keyspace:"customer" shard:"0" type:JOURNAL timestamp:1724172966 journal:{id:8200191490597391617 migration_type:SHARDS tables:"/.*" local_position:"MySQL56/52f690c6-5f14-11ef-8999-f4f6f6eab5c9:1-365" shard_gtids:{keyspace:"customer" shard:"-80" gtid:"MySQL56/f526d4b4-5f14-11ef-8d83-4127049b0131:1-154"} shard_gtids:{keyspace:"customer" shard:"80-" gtid:"MySQL56/f9de4c3a-5f14-11ef-b8ff-f0e7b3cce20a:1-154"} participants:{keyspace:"customer" shard:"0"}} current_time:1724172966973826000 keyspace:"customer" shard:"0"]
stream ended
Restart the stream from previous local_position
+++ b/examples/local/vstream_client.go
@@ -42,17 +42,26 @@ func main() {
var vgtid *binlogdatapb.VGtid
if streamCustomer {
vgtid = &binlogdatapb.VGtid{
- ShardGtids: []*binlogdatapb.ShardGtid{{
- Keyspace: "customer",
- Shard: "-80",
- // Gtid "" is to stream from the start, "current" is to stream from the current gtid
- // you can also specify a gtid to start with.
- Gtid: "", //"current" // "MySQL56/36a89abd-978f-11eb-b312-04ed332e05c2:1-265"
- }, {
- Keyspace: "customer",
- Shard: "80-",
- Gtid: "",
- }}}
+ ShardGtids: []*binlogdatapb.ShardGtid{
+ {
+ Keyspace: "customer",
+ Shard: "0",
+ Gtid: "MySQL56/52f690c6-5f14-11ef-8999-f4f6f6eab5c9:1-365",
+ },
+ },
+ }
Stream doesn't receive journal event
[type:VGTID vgtid:{shard_gtids:{keyspace:"customer" shard:"0" gtid:"MySQL56/52f690c6-5f14-11ef-8999-f4f6f6eab5c9:1-372"}} keyspace:"customer" shard:"0" type:OTHER timestamp:1724172966 current_time:1724173661848590000 keyspace:"customer" shard:"0"]
stream ended
Binary Version
Used main branch at commit 0af3d38
Operating System and Environment details
Log Fragments
Overview of the Issue
For a VStream with StopOnReshard flag enabled the Journal event is sent correctly if the vstream is active when the reshard happens. However, if, after the reshard is complete, the vstream is restarted from the previous shard/gtid, it will not receive the Journal event.
Reproduction Steps
Modify vstream_client.go
Run the reshard
Receive the Journal event
Restart the stream from previous local_position
Stream doesn't receive journal event
Binary Version
Operating System and Environment details
Log Fragments