From 88ae836fd81cad4fe92938946286307bd941cf22 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Wed, 17 Jan 2024 17:40:56 -0500 Subject: [PATCH] Move MySQL56 to MySQL Signed-off-by: Matt Lord --- examples/local/vstream_client.go | 2 +- .../vreplication/vdiff/vdiff_env_test.go | 6 +- .../command/vreplication/vdiff/vdiff_test.go | 4 +- go/mysql/binlog_event_compression.go | 2 +- go/mysql/binlog_event_make.go | 30 +-- go/mysql/binlog_event_make_test.go | 26 +-- ...event_mysql56.go => binlog_event_mysql.go} | 32 +-- go/mysql/binlog_event_mysql56_test.go | 182 ----------------- go/mysql/binlog_event_mysql_test.go | 182 +++++++++++++++++ go/mysql/endtoend/replication_test.go | 2 +- go/mysql/flavor_mysql.go | 10 +- go/mysql/flavor_mysql_test.go | 4 +- .../{mysql56_gtid.go => mysql_gtid.go} | 32 +-- ...{mysql56_gtid_set.go => mysql_gtid_set.go} | 68 +++---- ...tid_set_test.go => mysql_gtid_set_test.go} | 172 ++++++++-------- ...ysql56_gtid_test.go => mysql_gtid_test.go} | 50 ++--- go/mysql/replication/primary_status.go | 2 +- go/mysql/replication/replication_position.go | 10 +- .../replication/replication_position_test.go | 8 +- go/mysql/replication/replication_status.go | 18 +- .../replication/replication_status_test.go | 16 +- go/mysql/replication_test.go | 2 +- .../backup/vtctlbackup/pitr_test_framework.go | 6 +- .../reparent/plannedreparent/reparent_test.go | 6 +- .../foreignkey/stress/fk_stress_test.go | 2 +- go/vt/binlog/binlog_streamer_rbr_test.go | 4 +- go/vt/binlog/binlog_streamer_test.go | 34 ++-- go/vt/binlog/eventtoken/compare_test.go | 16 +- go/vt/mysqlctl/backupengine.go | 2 +- go/vt/mysqlctl/binlogs_gtid.go | 2 +- go/vt/mysqlctl/binlogs_gtid_test.go | 22 +- go/vt/mysqlctl/builtinbackupengine.go | 18 +- go/vt/mysqlctl/builtinbackupengine_test.go | 8 +- go/vt/mysqlctl/xtrabackupengine_test.go | 6 +- go/vt/proto/vtgate/vtgate.pb.go | 2 +- go/vt/vtadmin/cluster/cluster_test.go | 12 +- .../grpcvtctldserver/server_slow_test.go | 20 +- go/vt/vtctl/grpcvtctldserver/server_test.go | 10 +- .../reparentutil/emergency_reparenter_test.go | 190 +++++++++--------- .../planned_reparenter_flaky_test.go | 64 +++--- .../reparentutil/reparent_sorter_test.go | 14 +- go/vt/vtctl/reparentutil/replication.go | 6 +- go/vt/vtctl/reparentutil/replication_test.go | 176 ++++++++-------- go/vt/vtctl/reparentutil/util_test.go | 52 ++--- go/vt/vtctl/vdiff2_test.go | 4 +- go/vt/vtctl/vdiff_env_test.go | 6 +- go/vt/vtctl/vtctl_test.go | 2 +- go/vt/vtctl/workflow/materializer_test.go | 2 +- .../vttablet/tabletmanager/framework_test.go | 2 +- .../tabletmanager/vdiff/framework_test.go | 4 +- .../vreplication/journal_test.go | 20 +- .../vreplication/vplayer_flaky_test.go | 10 +- .../messager/message_manager_test.go | 18 +- .../tabletserver/schema/historian_test.go | 4 +- .../tabletserver/schema/tracker_test.go | 4 +- .../tabletserver/vstreamer/snapshot_conn.go | 6 +- .../tabletserver/vstreamer/vstreamer.go | 2 +- go/vt/vttest/environment.go | 2 +- go/vt/wrangler/wrangler_env_test.go | 2 +- proto/vtgate.proto | 2 +- 60 files changed, 811 insertions(+), 811 deletions(-) rename go/mysql/{binlog_event_mysql56.go => binlog_event_mysql.go} (65%) delete mode 100644 go/mysql/binlog_event_mysql56_test.go create mode 100644 go/mysql/binlog_event_mysql_test.go rename go/mysql/replication/{mysql56_gtid.go => mysql_gtid.go} (80%) rename go/mysql/replication/{mysql56_gtid_set.go => mysql_gtid_set.go} (91%) rename go/mysql/replication/{mysql56_gtid_set_test.go => mysql_gtid_set_test.go} (84%) rename go/mysql/replication/{mysql56_gtid_test.go => mysql_gtid_test.go} (75%) diff --git a/examples/local/vstream_client.go b/examples/local/vstream_client.go index 98d2129f898..238726dbeef 100644 --- a/examples/local/vstream_client.go +++ b/examples/local/vstream_client.go @@ -47,7 +47,7 @@ func main() { 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" + Gtid: "", //"current" // "MySQL/36a89abd-978f-11eb-b312-04ed332e05c2:1-265" }, { Keyspace: "customer", Shard: "80-", diff --git a/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_env_test.go b/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_env_test.go index 0a1ff5054cd..3f97fbd7bb2 100644 --- a/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_env_test.go +++ b/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_env_test.go @@ -48,13 +48,13 @@ import ( const ( // vdiffStopPosition is the default stop position for the target vreplication. // It can be overridden with the positons argument to newTestVDiffEnv. - vdiffStopPosition = "MySQL56/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-892" + vdiffStopPosition = "MySQL/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-892" // vdiffSourceGtid should be the position reported by the source side VStreamResults. // It's expected to be higher the vdiffStopPosition. - vdiffSourceGtid = "MySQL56/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-893" + vdiffSourceGtid = "MySQL/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-893" // vdiffTargetPrimaryPosition is the primary position of the target after // vreplication has been synchronized. - vdiffTargetPrimaryPosition = "MySQL56/e34d6fb6-7cbf-11ed-a1eb-0242ac120002:1-892" + vdiffTargetPrimaryPosition = "MySQL/e34d6fb6-7cbf-11ed-a1eb-0242ac120002:1-892" ) type testVDiffEnv struct { diff --git a/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_test.go b/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_test.go index 8742d22abd0..a72dada48de 100644 --- a/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_test.go +++ b/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_test.go @@ -572,8 +572,8 @@ func TestVDiffSharded(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() env := newTestVDiffEnv(t, ctx, []string{"-40", "40-"}, []string{"-80", "80-"}, "", map[string]string{ - "-80": "MySQL56/0e45e704-7cb9-11ed-a1eb-0242ac120002:1-890", - "80-": "MySQL56/1497ddb0-7cb9-11ed-a1eb-0242ac120002:1-891", + "-80": "MySQL/0e45e704-7cb9-11ed-a1eb-0242ac120002:1-890", + "80-": "MySQL/1497ddb0-7cb9-11ed-a1eb-0242ac120002:1-891", }) defer env.close() diff --git a/go/mysql/binlog_event_compression.go b/go/mysql/binlog_event_compression.go index 325bfeb4827..73bbafa292a 100644 --- a/go/mysql/binlog_event_compression.go +++ b/go/mysql/binlog_event_compression.go @@ -220,7 +220,7 @@ func (tp *TransactionPayload) decode() error { eventLen, pos, decompressedPayloadLen)) } eventData := decompressedPayload[pos : pos+eventLen] - ble := NewMysql56BinlogEvent(eventData) + ble := NewMysqlBinlogEvent(eventData) tp.Events = append(tp.Events, ble) pos += eventLen diff --git a/go/mysql/binlog_event_make.go b/go/mysql/binlog_event_make.go index 52a8c453517..652400eaf06 100644 --- a/go/mysql/binlog_event_make.go +++ b/go/mysql/binlog_event_make.go @@ -30,8 +30,8 @@ const ( // This file contains utility methods to create binlog replication // packets. They are mostly used for testing. -// NewMySQL56BinlogFormat returns a typical BinlogFormat for MySQL 5.6. -func NewMySQL56BinlogFormat() BinlogFormat { +// NewMySQLBinlogFormat returns a typical BinlogFormat for MySQL 5.6. +func NewMySQLBinlogFormat() BinlogFormat { return BinlogFormat{ FormatVersion: 4, ServerVersion: "5.6.33-0ubuntu0.14.04.1-log", @@ -133,11 +133,11 @@ func (s *FakeBinlogStream) Packetize(f BinlogFormat, typ byte, flags uint16, dat // NewInvalidEvent returns an invalid event (its size is <19). func NewInvalidEvent() BinlogEvent { - return NewMysql56BinlogEvent([]byte{0}) + return NewMysqlBinlogEvent([]byte{0}) } // NewFormatDescriptionEvent creates a new FormatDescriptionEvent -// based on the provided BinlogFormat. It uses a mysql56BinlogEvent +// based on the provided BinlogFormat. It uses a mysqlBinlogEvent // but could use a MariaDB one. func NewFormatDescriptionEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { length := 2 + // binlog-version @@ -155,7 +155,7 @@ func NewFormatDescriptionEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent data[57+len(f.HeaderSizes)] = f.ChecksumAlgorithm ev := s.Packetize(f, eFormatDescriptionEvent, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewInvalidFormatDescriptionEvent returns an invalid FormatDescriptionEvent. @@ -166,7 +166,7 @@ func NewInvalidFormatDescriptionEvent(f BinlogFormat, s *FakeBinlogStream) Binlo data[0] = 3 ev := s.Packetize(f, eFormatDescriptionEvent, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewRotateEvent returns a RotateEvent. @@ -179,7 +179,7 @@ func NewRotateEvent(f BinlogFormat, s *FakeBinlogStream, position uint64, filena copy(data[8:], filename) ev := s.Packetize(f, eRotateEvent, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } func NewFakeRotateEvent(f BinlogFormat, s *FakeBinlogStream, filename string) BinlogEvent { @@ -190,14 +190,14 @@ func NewFakeRotateEvent(f BinlogFormat, s *FakeBinlogStream, filename string) Bi copy(data[8:], filename) ev := s.Packetize(f, eRotateEvent, FlagLogEventArtificial, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewHeartbeatEvent returns a HeartbeatEvent. // see https://dev.mysql.com/doc/internals/en/heartbeat-event.html func NewHeartbeatEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { ev := s.Packetize(f, eHeartbeatEvent, 0, []byte{}) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewHeartbeatEvent returns a HeartbeatEvent. @@ -208,7 +208,7 @@ func NewHeartbeatEventWithLogFile(f BinlogFormat, s *FakeBinlogStream, filename copy(data, filename) ev := s.Packetize(f, eHeartbeatEvent, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewQueryEvent makes up a QueryEvent based on the Query structure. @@ -250,7 +250,7 @@ func NewQueryEvent(f BinlogFormat, s *FakeBinlogStream, q Query) BinlogEvent { copy(data[pos:], q.SQL) ev := s.Packetize(f, eQueryEvent, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewInvalidQueryEvent returns an invalid QueryEvent. IsValid is however true. @@ -261,7 +261,7 @@ func NewInvalidQueryEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { data[4+4] = 200 // > 100 ev := s.Packetize(f, eQueryEvent, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewXIDEvent returns a XID event. We do not use the data, so keep it 0. @@ -270,7 +270,7 @@ func NewXIDEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { data := make([]byte, length) ev := s.Packetize(f, eXIDEvent, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewIntVarEvent returns an IntVar event. @@ -289,7 +289,7 @@ func NewIntVarEvent(f BinlogFormat, s *FakeBinlogStream, typ byte, value uint64) data[8] = byte(value >> 56) ev := s.Packetize(f, eIntVarEvent, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } // NewMariaDBGTIDEvent returns a MariaDB specific GTID event. @@ -462,5 +462,5 @@ func newRowsEvent(f BinlogFormat, s *FakeBinlogStream, typ byte, tableID uint64, } ev := s.Packetize(f, typ, 0, data) - return NewMysql56BinlogEvent(ev) + return NewMysqlBinlogEvent(ev) } diff --git a/go/mysql/binlog_event_make_test.go b/go/mysql/binlog_event_make_test.go index 12d8a54ff97..2a66918a43c 100644 --- a/go/mysql/binlog_event_make_test.go +++ b/go/mysql/binlog_event_make_test.go @@ -33,7 +33,7 @@ import ( // FormatDescriptionEvent is working properly. func TestFormatDescriptionEvent(t *testing.T) { // MySQL 5.6 - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() event := NewFormatDescriptionEvent(f, s) @@ -59,7 +59,7 @@ func TestFormatDescriptionEvent(t *testing.T) { } func TestQueryEvent(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() q := Query{ @@ -85,7 +85,7 @@ func TestQueryEvent(t *testing.T) { } func TestXIDEvent(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() event := NewXIDEvent(f, s) @@ -95,7 +95,7 @@ func TestXIDEvent(t *testing.T) { } func TestIntVarEvent(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() event := NewIntVarEvent(f, s, IntVarLastInsertID, 0x123456789abcdef0) @@ -117,7 +117,7 @@ func TestIntVarEvent(t *testing.T) { } func TestInvalidEvents(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() // InvalidEvent @@ -146,7 +146,7 @@ func TestInvalidEvents(t *testing.T) { } func TestMariadDBGTIDEVent(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() s.ServerID = 0x87654321 @@ -190,7 +190,7 @@ func TestMariadDBGTIDEVent(t *testing.T) { } func TestTableMapEvent(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() tm := &TableMap{ @@ -245,7 +245,7 @@ func TestTableMapEvent(t *testing.T) { } func TestLargeTableMapEvent(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() colLen := 256 @@ -287,7 +287,7 @@ func TestLargeTableMapEvent(t *testing.T) { } func TestRowsEvent(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() /* @@ -375,7 +375,7 @@ func TestRowsEvent(t *testing.T) { func TestHeartbeatEvent(t *testing.T) { // MySQL 5.6 - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() event := NewHeartbeatEvent(f, s) require.NotNil(t, event) @@ -385,7 +385,7 @@ func TestHeartbeatEvent(t *testing.T) { func TestRotateRotateEvent(t *testing.T) { // MySQL 5.6 - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() event := NewRotateEvent(f, s, 456, "mysql-bin.000123") require.NotNil(t, event) @@ -398,7 +398,7 @@ func TestRotateRotateEvent(t *testing.T) { func TestFakeRotateEvent(t *testing.T) { // MySQL 5.6 - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() event := NewFakeRotateEvent(f, s, "mysql-bin.000123") require.NotNil(t, event) @@ -409,7 +409,7 @@ func TestFakeRotateEvent(t *testing.T) { assert.Equal(t, "mysql-bin.000123", nextFile) } func TestLargeRowsEvent(t *testing.T) { - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() /* diff --git a/go/mysql/binlog_event_mysql56.go b/go/mysql/binlog_event_mysql.go similarity index 65% rename from go/mysql/binlog_event_mysql56.go rename to go/mysql/binlog_event_mysql.go index 3f931310ba9..4f07fceab9a 100644 --- a/go/mysql/binlog_event_mysql56.go +++ b/go/mysql/binlog_event_mysql.go @@ -24,31 +24,31 @@ import ( "vitess.io/vitess/go/vt/vterrors" ) -// mysql56BinlogEvent wraps a raw packet buffer and provides methods to examine +// mysqlBinlogEvent wraps a raw packet buffer and provides methods to examine // it by implementing BinlogEvent. Some methods are pulled in from // binlogEvent. -type mysql56BinlogEvent struct { +type mysqlBinlogEvent struct { binlogEvent semiSyncAckRequested bool } -// NewMysql56BinlogEventWithSemiSyncInfo creates a BinlogEvent from given byte array -func NewMysql56BinlogEventWithSemiSyncInfo(buf []byte, semiSyncAckRequested bool) BinlogEvent { - return mysql56BinlogEvent{binlogEvent: binlogEvent(buf), semiSyncAckRequested: semiSyncAckRequested} +// NewMysqlBinlogEventWithSemiSyncInfo creates a BinlogEvent from given byte array +func NewMysqlBinlogEventWithSemiSyncInfo(buf []byte, semiSyncAckRequested bool) BinlogEvent { + return mysqlBinlogEvent{binlogEvent: binlogEvent(buf), semiSyncAckRequested: semiSyncAckRequested} } -// NewMysql56BinlogEvent creates a BinlogEvent from given byte array -func NewMysql56BinlogEvent(buf []byte) BinlogEvent { - return mysql56BinlogEvent{binlogEvent: binlogEvent(buf)} +// NewMysqlBinlogEvent creates a BinlogEvent from given byte array +func NewMysqlBinlogEvent(buf []byte) BinlogEvent { + return mysqlBinlogEvent{binlogEvent: binlogEvent(buf)} } // IsSemiSyncAckRequested implements BinlogEvent.IsSemiSyncAckRequested(). -func (ev mysql56BinlogEvent) IsSemiSyncAckRequested() bool { +func (ev mysqlBinlogEvent) IsSemiSyncAckRequested() bool { return ev.semiSyncAckRequested } // IsGTID implements BinlogEvent.IsGTID(). -func (ev mysql56BinlogEvent) IsGTID() bool { +func (ev mysqlBinlogEvent) IsGTID() bool { return ev.Type() == eGTIDEvent } @@ -60,18 +60,18 @@ func (ev mysql56BinlogEvent) IsGTID() bool { // 1 flags // 16 SID (server UUID) // 8 GNO (sequence number, signed int) -func (ev mysql56BinlogEvent) GTID(f BinlogFormat) (replication.GTID, bool, error) { +func (ev mysqlBinlogEvent) GTID(f BinlogFormat) (replication.GTID, bool, error) { data := ev.Bytes()[f.HeaderLength:] var sid replication.SID copy(sid[:], data[1:1+16]) gno := int64(binary.LittleEndian.Uint64(data[1+16 : 1+16+8])) - return replication.Mysql56GTID{Server: sid, Sequence: gno}, false /* hasBegin */, nil + return replication.MysqlGTID{Server: sid, Sequence: gno}, false /* hasBegin */, nil } // PreviousGTIDs implements BinlogEvent.PreviousGTIDs(). -func (ev mysql56BinlogEvent) PreviousGTIDs(f BinlogFormat) (replication.Position, error) { +func (ev mysqlBinlogEvent) PreviousGTIDs(f BinlogFormat) (replication.Position, error) { data := ev.Bytes()[f.HeaderLength:] - set, err := replication.NewMysql56GTIDSetFromSIDBlock(data) + set, err := replication.NewMysqlGTIDSetFromSIDBlock(data) if err != nil { return replication.Position{}, err } @@ -81,7 +81,7 @@ func (ev mysql56BinlogEvent) PreviousGTIDs(f BinlogFormat) (replication.Position } // StripChecksum implements BinlogEvent.StripChecksum(). -func (ev mysql56BinlogEvent) StripChecksum(f BinlogFormat) (BinlogEvent, []byte, error) { +func (ev mysqlBinlogEvent) StripChecksum(f BinlogFormat) (BinlogEvent, []byte, error) { switch f.ChecksumAlgorithm { case BinlogChecksumAlgOff, BinlogChecksumAlgUndef: // There is no checksum. @@ -92,7 +92,7 @@ func (ev mysql56BinlogEvent) StripChecksum(f BinlogFormat) (BinlogEvent, []byte, length := len(data) checksum := data[length-BinlogCRC32ChecksumLen:] data = data[:length-BinlogCRC32ChecksumLen] - return mysql56BinlogEvent{binlogEvent: binlogEvent(data)}, checksum, nil + return mysqlBinlogEvent{binlogEvent: binlogEvent(data)}, checksum, nil default: // MySQL 5.6 does not guarantee that future checksum algorithms will be // 4 bytes, so we can't support them a priori. diff --git a/go/mysql/binlog_event_mysql56_test.go b/go/mysql/binlog_event_mysql56_test.go deleted file mode 100644 index e5fa3545278..00000000000 --- a/go/mysql/binlog_event_mysql56_test.go +++ /dev/null @@ -1,182 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mysql - -import ( - "fmt" - "reflect" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "vitess.io/vitess/go/mysql/replication" -) - -// Sample event data for MySQL 5.6. -var ( - mysql56FormatEvent = NewMysql56BinlogEvent([]byte{0x78, 0x4e, 0x49, 0x55, 0xf, 0x64, 0x0, 0x0, 0x0, 0x74, 0x0, 0x0, 0x0, 0x78, 0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x0, 0x35, 0x2e, 0x36, 0x2e, 0x32, 0x34, 0x2d, 0x6c, 0x6f, 0x67, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x78, 0x4e, 0x49, 0x55, 0x13, 0x38, 0xd, 0x0, 0x8, 0x0, 0x12, 0x0, 0x4, 0x4, 0x4, 0x4, 0x12, 0x0, 0x0, 0x5c, 0x0, 0x4, 0x1a, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x2, 0x0, 0x0, 0x0, 0xa, 0xa, 0xa, 0x19, 0x19, 0x0, 0x1, 0x18, 0x4a, 0xf, 0xca}) - mysql56GTIDEvent = NewMysql56BinlogEvent([]byte{0xff, 0x4e, 0x49, 0x55, 0x21, 0x64, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0xf5, 0x2, 0x0, 0x0, 0x0, 0x0, 0x1, 0x43, 0x91, 0x92, 0xbd, 0xf3, 0x7c, 0x11, 0xe4, 0xbb, 0xeb, 0x2, 0x42, 0xac, 0x11, 0x3, 0x5a, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x48, 0x45, 0x82, 0x27}) - // This is the result of: begin; insert into customer values (1, "mlord@planetscale.com"), (2, "sup@planetscale.com"); commit; - mysql56TransactionPayloadEvent = NewMysql56BinlogEvent([]byte{0xc7, 0xe1, 0x4b, 0x64, 0x28, 0x5b, 0xd2, 0xc7, 0x19, 0xdb, 0x00, 0x00, 0x00, 0x3a, 0x50, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0x03, 0xfc, 0xfe, 0x00, 0x01, 0x01, 0xb8, 0x00, 0x28, 0xb5, 0x2f, 0xfd, 0x00, 0x58, 0x64, 0x05, 0x00, 0xf2, 0x49, 0x23, 0x2a, 0xa0, 0x27, 0x69, 0x0c, 0xff, 0xe8, 0x06, 0xeb, 0xfe, 0xc3, 0xab, 0x8a, 0x7b, 0xc0, 0x36, 0x42, 0x5c, 0x6f, 0x1b, 0x2f, 0xfb, 0x6e, 0xc4, 0x9a, 0xe6, 0x6e, 0x6b, 0xda, 0x08, 0xf1, 0x37, 0x7e, 0xff, 0xb8, 0x6c, 0xbc, 0x27, 0x3c, 0xb7, 0x4f, 0xee, 0x14, 0xff, 0xaf, 0x09, 0x06, 0x69, 0xe3, 0x12, 0x68, 0x4a, 0x6e, 0xc3, 0xe1, 0x28, 0xaf, 0x3f, 0xc8, 0x14, 0x1c, 0xc3, 0x60, 0xce, 0xe3, 0x1e, 0x18, 0x4c, 0x63, 0xa1, 0x35, 0x90, 0x79, 0x04, 0xe8, 0xa9, 0xeb, 0x4a, 0x1b, 0xd7, 0x41, 0x53, 0x72, 0x17, 0xa4, 0x23, 0xa4, 0x47, 0x68, 0x00, 0xa2, 0x37, 0xee, 0xc1, 0xc7, 0x71, 0x30, 0x24, 0x19, 0xfd, 0x78, 0x49, 0x1b, 0x97, 0xd2, 0x94, 0xdc, 0x85, 0xa2, 0x21, 0xc1, 0xb0, 0x63, 0x8d, 0x7b, 0x0f, 0x32, 0x87, 0x07, 0xe2, 0x39, 0xf0, 0x7c, 0x3e, 0x01, 0xfe, 0x13, 0x8f, 0x11, 0xd0, 0x05, 0x9f, 0xbc, 0x18, 0x59, 0x91, 0x36, 0x2e, 0x6d, 0x4a, 0x6e, 0x0b, 0x00, 0x5e, 0x28, 0x10, 0xc0, 0x02, 0x50, 0x77, 0xe0, 0x64, 0x30, 0x02, 0x9e, 0x09, 0x54, 0xec, 0x80, 0x6d, 0x07, 0xa4, 0xc1, 0x7d, 0x60, 0xe4, 0x01, 0x78, 0x01, 0x01, 0x00, 0x00}) - mysql56QueryEvent = NewMysql56BinlogEvent([]byte{0xff, 0x4e, 0x49, 0x55, 0x2, 0x64, 0x0, 0x0, 0x0, 0x77, 0x0, 0x0, 0x0, 0xdb, 0x3, 0x0, 0x0, 0x0, 0x0, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x3, 0x73, 0x74, 0x64, 0x4, 0x8, 0x0, 0x8, 0x0, 0x21, 0x0, 0xc, 0x1, 0x74, 0x65, 0x73, 0x74, 0x0, 0x74, 0x65, 0x73, 0x74, 0x0, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x28, 0x6d, 0x73, 0x67, 0x29, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x28, 0x27, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x27, 0x29, 0x92, 0x12, 0x79, 0xc3}) - mysql56SemiSyncNoAckQueryEvent = NewMysql56BinlogEvent([]byte{0xef, 0x00, 0xff, 0x4e, 0x49, 0x55, 0x2, 0x64, 0x0, 0x0, 0x0, 0x77, 0x0, 0x0, 0x0, 0xdb, 0x3, 0x0, 0x0, 0x0, 0x0, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x3, 0x73, 0x74, 0x64, 0x4, 0x8, 0x0, 0x8, 0x0, 0x21, 0x0, 0xc, 0x1, 0x74, 0x65, 0x73, 0x74, 0x0, 0x74, 0x65, 0x73, 0x74, 0x0, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x28, 0x6d, 0x73, 0x67, 0x29, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x28, 0x27, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x27, 0x29, 0x92, 0x12, 0x79, 0xc3}) - mysql56SemiSyncAckQueryEvent = NewMysql56BinlogEvent([]byte{0xef, 0x01, 0xff, 0x4e, 0x49, 0x55, 0x2, 0x64, 0x0, 0x0, 0x0, 0x77, 0x0, 0x0, 0x0, 0xdb, 0x3, 0x0, 0x0, 0x0, 0x0, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x3, 0x73, 0x74, 0x64, 0x4, 0x8, 0x0, 0x8, 0x0, 0x21, 0x0, 0xc, 0x1, 0x74, 0x65, 0x73, 0x74, 0x0, 0x74, 0x65, 0x73, 0x74, 0x0, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x28, 0x6d, 0x73, 0x67, 0x29, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x28, 0x27, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x27, 0x29, 0x92, 0x12, 0x79, 0xc3}) -) - -func TestMysql56IsGTID(t *testing.T) { - if got, want := mysql56FormatEvent.IsGTID(), false; got != want { - t.Errorf("%#v.IsGTID() = %#v, want %#v", mysql56FormatEvent, got, want) - } - if got, want := mysql56QueryEvent.IsGTID(), false; got != want { - t.Errorf("%#v.IsGTID() = %#v, want %#v", mysql56QueryEvent, got, want) - } - if got, want := mysql56GTIDEvent.IsGTID(), true; got != want { - t.Errorf("%#v.IsGTID() = %#v, want %#v", mysql56GTIDEvent, got, want) - } -} - -func TestMysql56StripChecksum(t *testing.T) { - format, err := mysql56FormatEvent.Format() - require.NoError(t, err, "Format() error: %v", err) - - stripped, gotChecksum, err := mysql56QueryEvent.StripChecksum(format) - require.NoError(t, err, "StripChecksum() error: %v", err) - - // Check checksum. - if want := []byte{0x92, 0x12, 0x79, 0xc3}; !reflect.DeepEqual(gotChecksum, want) { - t.Errorf("checksum = %#v, want %#v", gotChecksum, want) - } - - // Check query, to make sure checksum was stripped properly. - // Query length is defined as "the rest of the bytes after offset X", - // so the query will be wrong if the checksum is not stripped. - gotQuery, err := stripped.Query(format) - require.NoError(t, err, "Query() error: %v", err) - - if want := "insert into test_table (msg) values ('hello')"; string(gotQuery.SQL) != want { - t.Errorf("query = %#v, want %#v", string(gotQuery.SQL), want) - } -} - -func TestMysql56GTID(t *testing.T) { - format, err := mysql56FormatEvent.Format() - require.NoError(t, err, "Format() error: %v", err) - - input, _, err := mysql56GTIDEvent.StripChecksum(format) - require.NoError(t, err, "StripChecksum() error: %v", err) - require.True(t, input.IsGTID(), "IsGTID() = false, want true") - - want := replication.Mysql56GTID{ - Server: replication.SID{0x43, 0x91, 0x92, 0xbd, 0xf3, 0x7c, 0x11, 0xe4, 0xbb, 0xeb, 0x2, 0x42, 0xac, 0x11, 0x3, 0x5a}, - Sequence: 4, - } - got, hasBegin, err := input.GTID(format) - require.NoError(t, err, "GTID() error: %v", err) - assert.False(t, hasBegin, "GTID() returned hasBegin") - assert.Equal(t, want, got, "GTID() = %#v, want %#v", got, want) -} - -func TestMysql56DecodeTransactionPayload(t *testing.T) { - format := NewMySQL56BinlogFormat() - tableMap := &TableMap{} - require.True(t, mysql56TransactionPayloadEvent.IsTransactionPayload()) - - // The generated event is the result of the following SQL being executed in vtgate - // against the commerce keyspace: - // begin; insert into customer values (1, "mlord@planetscale.com"), (2, "sup@planetscale.com"); commit; - // All of these below internal events are encoded in the compressed transaction - // payload event. - want := []string{ - "BEGIN", // Query event - "vt_commerce.customer", // TableMap event - "[1 mlord@planetscale.com]", // WriteRows event - "[2 sup@planetscale.com]", // WriteRows event - "COMMIT", // XID event - } - internalEvents, err := mysql56TransactionPayloadEvent.TransactionPayload(format) - require.NoError(t, err) - eventStrs := []string{} - for _, ev := range internalEvents { - switch { - case ev.IsTableMap(): - tableMap, err = ev.TableMap(format) - require.NoError(t, err) - eventStrs = append(eventStrs, fmt.Sprintf("%s.%s", tableMap.Database, tableMap.Name)) - case ev.IsQuery(): - query, err := ev.Query(format) - require.NoError(t, err) - eventStrs = append(eventStrs, query.SQL) - case ev.IsWriteRows(): - rows, err := ev.Rows(format, tableMap) - require.NoError(t, err) - for i := range rows.Rows { - rowStr, err := rows.StringValuesForTests(tableMap, i) - require.NoError(t, err) - eventStrs = append(eventStrs, fmt.Sprintf("%v", rowStr)) - } - case ev.IsXID(): - eventStrs = append(eventStrs, "COMMIT") - } - } - require.Equal(t, want, eventStrs) -} - -func TestMysql56ParsePosition(t *testing.T) { - input := "00010203-0405-0607-0809-0a0b0c0d0e0f:1-2" - - sid := replication.SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} - var set replication.GTIDSet = replication.Mysql56GTIDSet{} - set = set.AddGTID(replication.Mysql56GTID{Server: sid, Sequence: 1}) - set = set.AddGTID(replication.Mysql56GTID{Server: sid, Sequence: 2}) - want := replication.Position{GTIDSet: set} - - got, err := replication.ParsePosition(replication.Mysql56FlavorID, input) - assert.NoError(t, err, "unexpected error: %v", err) - assert.True(t, got.Equal(want), "(&mysql56{}).ParsePosition(%#v) = %#v, want %#v", input, got, want) - -} - -func TestMysql56SemiSyncAck(t *testing.T) { - { - c := Conn{ExpectSemiSyncIndicator: false} - buf, semiSyncAckRequested, err := c.AnalyzeSemiSyncAckRequest(mysql56QueryEvent.Bytes()) - assert.NoError(t, err) - e := NewMysql56BinlogEventWithSemiSyncInfo(buf, semiSyncAckRequested) - - assert.False(t, e.IsSemiSyncAckRequested()) - assert.True(t, e.IsQuery()) - } - { - c := Conn{ExpectSemiSyncIndicator: true} - buf, semiSyncAckRequested, err := c.AnalyzeSemiSyncAckRequest(mysql56SemiSyncNoAckQueryEvent.Bytes()) - assert.NoError(t, err) - e := NewMysql56BinlogEventWithSemiSyncInfo(buf, semiSyncAckRequested) - - assert.False(t, e.IsSemiSyncAckRequested()) - assert.True(t, e.IsQuery()) - } - { - c := Conn{ExpectSemiSyncIndicator: true} - buf, semiSyncAckRequested, err := c.AnalyzeSemiSyncAckRequest(mysql56SemiSyncAckQueryEvent.Bytes()) - assert.NoError(t, err) - e := NewMysql56BinlogEventWithSemiSyncInfo(buf, semiSyncAckRequested) - - assert.True(t, e.IsSemiSyncAckRequested()) - assert.True(t, e.IsQuery()) - } -} diff --git a/go/mysql/binlog_event_mysql_test.go b/go/mysql/binlog_event_mysql_test.go new file mode 100644 index 00000000000..d8ef52f8845 --- /dev/null +++ b/go/mysql/binlog_event_mysql_test.go @@ -0,0 +1,182 @@ +/* +Copyright 2019 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package mysql + +import ( + "fmt" + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "vitess.io/vitess/go/mysql/replication" +) + +// Sample event data for MySQL 5.6. +var ( + mysqlFormatEvent = NewMysqlBinlogEvent([]byte{0x78, 0x4e, 0x49, 0x55, 0xf, 0x64, 0x0, 0x0, 0x0, 0x74, 0x0, 0x0, 0x0, 0x78, 0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x0, 0x35, 0x2e, 0x36, 0x2e, 0x32, 0x34, 0x2d, 0x6c, 0x6f, 0x67, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x78, 0x4e, 0x49, 0x55, 0x13, 0x38, 0xd, 0x0, 0x8, 0x0, 0x12, 0x0, 0x4, 0x4, 0x4, 0x4, 0x12, 0x0, 0x0, 0x5c, 0x0, 0x4, 0x1a, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x2, 0x0, 0x0, 0x0, 0xa, 0xa, 0xa, 0x19, 0x19, 0x0, 0x1, 0x18, 0x4a, 0xf, 0xca}) + mysqlGTIDEvent = NewMysqlBinlogEvent([]byte{0xff, 0x4e, 0x49, 0x55, 0x21, 0x64, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0xf5, 0x2, 0x0, 0x0, 0x0, 0x0, 0x1, 0x43, 0x91, 0x92, 0xbd, 0xf3, 0x7c, 0x11, 0xe4, 0xbb, 0xeb, 0x2, 0x42, 0xac, 0x11, 0x3, 0x5a, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x48, 0x45, 0x82, 0x27}) + // This is the result of: begin; insert into customer values (1, "mlord@planetscale.com"), (2, "sup@planetscale.com"); commit; + mysqlTransactionPayloadEvent = NewMysqlBinlogEvent([]byte{0xc7, 0xe1, 0x4b, 0x64, 0x28, 0x5b, 0xd2, 0xc7, 0x19, 0xdb, 0x00, 0x00, 0x00, 0x3a, 0x50, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0x03, 0xfc, 0xfe, 0x00, 0x01, 0x01, 0xb8, 0x00, 0x28, 0xb5, 0x2f, 0xfd, 0x00, 0x58, 0x64, 0x05, 0x00, 0xf2, 0x49, 0x23, 0x2a, 0xa0, 0x27, 0x69, 0x0c, 0xff, 0xe8, 0x06, 0xeb, 0xfe, 0xc3, 0xab, 0x8a, 0x7b, 0xc0, 0x36, 0x42, 0x5c, 0x6f, 0x1b, 0x2f, 0xfb, 0x6e, 0xc4, 0x9a, 0xe6, 0x6e, 0x6b, 0xda, 0x08, 0xf1, 0x37, 0x7e, 0xff, 0xb8, 0x6c, 0xbc, 0x27, 0x3c, 0xb7, 0x4f, 0xee, 0x14, 0xff, 0xaf, 0x09, 0x06, 0x69, 0xe3, 0x12, 0x68, 0x4a, 0x6e, 0xc3, 0xe1, 0x28, 0xaf, 0x3f, 0xc8, 0x14, 0x1c, 0xc3, 0x60, 0xce, 0xe3, 0x1e, 0x18, 0x4c, 0x63, 0xa1, 0x35, 0x90, 0x79, 0x04, 0xe8, 0xa9, 0xeb, 0x4a, 0x1b, 0xd7, 0x41, 0x53, 0x72, 0x17, 0xa4, 0x23, 0xa4, 0x47, 0x68, 0x00, 0xa2, 0x37, 0xee, 0xc1, 0xc7, 0x71, 0x30, 0x24, 0x19, 0xfd, 0x78, 0x49, 0x1b, 0x97, 0xd2, 0x94, 0xdc, 0x85, 0xa2, 0x21, 0xc1, 0xb0, 0x63, 0x8d, 0x7b, 0x0f, 0x32, 0x87, 0x07, 0xe2, 0x39, 0xf0, 0x7c, 0x3e, 0x01, 0xfe, 0x13, 0x8f, 0x11, 0xd0, 0x05, 0x9f, 0xbc, 0x18, 0x59, 0x91, 0x36, 0x2e, 0x6d, 0x4a, 0x6e, 0x0b, 0x00, 0x5e, 0x28, 0x10, 0xc0, 0x02, 0x50, 0x77, 0xe0, 0x64, 0x30, 0x02, 0x9e, 0x09, 0x54, 0xec, 0x80, 0x6d, 0x07, 0xa4, 0xc1, 0x7d, 0x60, 0xe4, 0x01, 0x78, 0x01, 0x01, 0x00, 0x00}) + mysqlQueryEvent = NewMysqlBinlogEvent([]byte{0xff, 0x4e, 0x49, 0x55, 0x2, 0x64, 0x0, 0x0, 0x0, 0x77, 0x0, 0x0, 0x0, 0xdb, 0x3, 0x0, 0x0, 0x0, 0x0, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x3, 0x73, 0x74, 0x64, 0x4, 0x8, 0x0, 0x8, 0x0, 0x21, 0x0, 0xc, 0x1, 0x74, 0x65, 0x73, 0x74, 0x0, 0x74, 0x65, 0x73, 0x74, 0x0, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x28, 0x6d, 0x73, 0x67, 0x29, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x28, 0x27, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x27, 0x29, 0x92, 0x12, 0x79, 0xc3}) + mysqlSemiSyncNoAckQueryEvent = NewMysqlBinlogEvent([]byte{0xef, 0x00, 0xff, 0x4e, 0x49, 0x55, 0x2, 0x64, 0x0, 0x0, 0x0, 0x77, 0x0, 0x0, 0x0, 0xdb, 0x3, 0x0, 0x0, 0x0, 0x0, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x3, 0x73, 0x74, 0x64, 0x4, 0x8, 0x0, 0x8, 0x0, 0x21, 0x0, 0xc, 0x1, 0x74, 0x65, 0x73, 0x74, 0x0, 0x74, 0x65, 0x73, 0x74, 0x0, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x28, 0x6d, 0x73, 0x67, 0x29, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x28, 0x27, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x27, 0x29, 0x92, 0x12, 0x79, 0xc3}) + mysqlSemiSyncAckQueryEvent = NewMysqlBinlogEvent([]byte{0xef, 0x01, 0xff, 0x4e, 0x49, 0x55, 0x2, 0x64, 0x0, 0x0, 0x0, 0x77, 0x0, 0x0, 0x0, 0xdb, 0x3, 0x0, 0x0, 0x0, 0x0, 0x3d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x3, 0x73, 0x74, 0x64, 0x4, 0x8, 0x0, 0x8, 0x0, 0x21, 0x0, 0xc, 0x1, 0x74, 0x65, 0x73, 0x74, 0x0, 0x74, 0x65, 0x73, 0x74, 0x0, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x28, 0x6d, 0x73, 0x67, 0x29, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x28, 0x27, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x27, 0x29, 0x92, 0x12, 0x79, 0xc3}) +) + +func TestMysqlIsGTID(t *testing.T) { + if got, want := mysqlFormatEvent.IsGTID(), false; got != want { + t.Errorf("%#v.IsGTID() = %#v, want %#v", mysqlFormatEvent, got, want) + } + if got, want := mysqlQueryEvent.IsGTID(), false; got != want { + t.Errorf("%#v.IsGTID() = %#v, want %#v", mysqlQueryEvent, got, want) + } + if got, want := mysqlGTIDEvent.IsGTID(), true; got != want { + t.Errorf("%#v.IsGTID() = %#v, want %#v", mysqlGTIDEvent, got, want) + } +} + +func TestMysqlStripChecksum(t *testing.T) { + format, err := mysqlFormatEvent.Format() + require.NoError(t, err, "Format() error: %v", err) + + stripped, gotChecksum, err := mysqlQueryEvent.StripChecksum(format) + require.NoError(t, err, "StripChecksum() error: %v", err) + + // Check checksum. + if want := []byte{0x92, 0x12, 0x79, 0xc3}; !reflect.DeepEqual(gotChecksum, want) { + t.Errorf("checksum = %#v, want %#v", gotChecksum, want) + } + + // Check query, to make sure checksum was stripped properly. + // Query length is defined as "the rest of the bytes after offset X", + // so the query will be wrong if the checksum is not stripped. + gotQuery, err := stripped.Query(format) + require.NoError(t, err, "Query() error: %v", err) + + if want := "insert into test_table (msg) values ('hello')"; string(gotQuery.SQL) != want { + t.Errorf("query = %#v, want %#v", string(gotQuery.SQL), want) + } +} + +func TestMysqlGTID(t *testing.T) { + format, err := mysqlFormatEvent.Format() + require.NoError(t, err, "Format() error: %v", err) + + input, _, err := mysqlGTIDEvent.StripChecksum(format) + require.NoError(t, err, "StripChecksum() error: %v", err) + require.True(t, input.IsGTID(), "IsGTID() = false, want true") + + want := replication.MysqlGTID{ + Server: replication.SID{0x43, 0x91, 0x92, 0xbd, 0xf3, 0x7c, 0x11, 0xe4, 0xbb, 0xeb, 0x2, 0x42, 0xac, 0x11, 0x3, 0x5a}, + Sequence: 4, + } + got, hasBegin, err := input.GTID(format) + require.NoError(t, err, "GTID() error: %v", err) + assert.False(t, hasBegin, "GTID() returned hasBegin") + assert.Equal(t, want, got, "GTID() = %#v, want %#v", got, want) +} + +func TestMysqlDecodeTransactionPayload(t *testing.T) { + format := NewMySQLBinlogFormat() + tableMap := &TableMap{} + require.True(t, mysqlTransactionPayloadEvent.IsTransactionPayload()) + + // The generated event is the result of the following SQL being executed in vtgate + // against the commerce keyspace: + // begin; insert into customer values (1, "mlord@planetscale.com"), (2, "sup@planetscale.com"); commit; + // All of these below internal events are encoded in the compressed transaction + // payload event. + want := []string{ + "BEGIN", // Query event + "vt_commerce.customer", // TableMap event + "[1 mlord@planetscale.com]", // WriteRows event + "[2 sup@planetscale.com]", // WriteRows event + "COMMIT", // XID event + } + internalEvents, err := mysqlTransactionPayloadEvent.TransactionPayload(format) + require.NoError(t, err) + eventStrs := []string{} + for _, ev := range internalEvents { + switch { + case ev.IsTableMap(): + tableMap, err = ev.TableMap(format) + require.NoError(t, err) + eventStrs = append(eventStrs, fmt.Sprintf("%s.%s", tableMap.Database, tableMap.Name)) + case ev.IsQuery(): + query, err := ev.Query(format) + require.NoError(t, err) + eventStrs = append(eventStrs, query.SQL) + case ev.IsWriteRows(): + rows, err := ev.Rows(format, tableMap) + require.NoError(t, err) + for i := range rows.Rows { + rowStr, err := rows.StringValuesForTests(tableMap, i) + require.NoError(t, err) + eventStrs = append(eventStrs, fmt.Sprintf("%v", rowStr)) + } + case ev.IsXID(): + eventStrs = append(eventStrs, "COMMIT") + } + } + require.Equal(t, want, eventStrs) +} + +func TestMysqlParsePosition(t *testing.T) { + input := "00010203-0405-0607-0809-0a0b0c0d0e0f:1-2" + + sid := replication.SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} + var set replication.GTIDSet = replication.MysqlGTIDSet{} + set = set.AddGTID(replication.MysqlGTID{Server: sid, Sequence: 1}) + set = set.AddGTID(replication.MysqlGTID{Server: sid, Sequence: 2}) + want := replication.Position{GTIDSet: set} + + got, err := replication.ParsePosition(replication.MysqlFlavorID, input) + assert.NoError(t, err, "unexpected error: %v", err) + assert.True(t, got.Equal(want), "(&mysql{}).ParsePosition(%#v) = %#v, want %#v", input, got, want) + +} + +func TestMysqlSemiSyncAck(t *testing.T) { + { + c := Conn{ExpectSemiSyncIndicator: false} + buf, semiSyncAckRequested, err := c.AnalyzeSemiSyncAckRequest(mysqlQueryEvent.Bytes()) + assert.NoError(t, err) + e := NewMysqlBinlogEventWithSemiSyncInfo(buf, semiSyncAckRequested) + + assert.False(t, e.IsSemiSyncAckRequested()) + assert.True(t, e.IsQuery()) + } + { + c := Conn{ExpectSemiSyncIndicator: true} + buf, semiSyncAckRequested, err := c.AnalyzeSemiSyncAckRequest(mysqlSemiSyncNoAckQueryEvent.Bytes()) + assert.NoError(t, err) + e := NewMysqlBinlogEventWithSemiSyncInfo(buf, semiSyncAckRequested) + + assert.False(t, e.IsSemiSyncAckRequested()) + assert.True(t, e.IsQuery()) + } + { + c := Conn{ExpectSemiSyncIndicator: true} + buf, semiSyncAckRequested, err := c.AnalyzeSemiSyncAckRequest(mysqlSemiSyncAckQueryEvent.Bytes()) + assert.NoError(t, err) + e := NewMysqlBinlogEventWithSemiSyncInfo(buf, semiSyncAckRequested) + + assert.True(t, e.IsSemiSyncAckRequested()) + assert.True(t, e.IsQuery()) + } +} diff --git a/go/mysql/endtoend/replication_test.go b/go/mysql/endtoend/replication_test.go index 441209b35f7..5991f425bef 100644 --- a/go/mysql/endtoend/replication_test.go +++ b/go/mysql/endtoend/replication_test.go @@ -90,7 +90,7 @@ func connectForReplication(t *testing.T, rbr bool) (*mysql.Conn, mysql.BinlogFor for { be, err := conn.ReadBinlogEvent() require.NoError(t, err, "ReadPacket failed: %v", err) - require.True(t, be.IsValid(), "NewMysql56BinlogEvent has an invalid packet: %v", be) + require.True(t, be.IsValid(), "NewMysqlBinlogEvent has an invalid packet: %v", be) // Skip rotate packets. These are normal as first packets. if be.IsRotate() { diff --git a/go/mysql/flavor_mysql.go b/go/mysql/flavor_mysql.go index 2406a7e001f..143e1a492c1 100644 --- a/go/mysql/flavor_mysql.go +++ b/go/mysql/flavor_mysql.go @@ -58,7 +58,7 @@ func (mysqlFlavor) primaryGTIDSet(c *Conn) (replication.GTIDSet, error) { if len(qr.Rows) != 1 || len(qr.Rows[0]) != 1 { return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "unexpected result format for gtid_executed: %#v", qr) } - return replication.ParseMysql56GTIDSet(qr.Rows[0][0].ToString()) + return replication.ParseMysqlGTIDSet(qr.Rows[0][0].ToString()) } // purgedGTIDSet is part of the Flavor interface. @@ -71,7 +71,7 @@ func (mysqlFlavor) purgedGTIDSet(c *Conn) (replication.GTIDSet, error) { if len(qr.Rows) != 1 || len(qr.Rows[0]) != 1 { return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "unexpected result format for gtid_purged: %#v", qr) } - return replication.ParseMysql56GTIDSet(qr.Rows[0][0].ToString()) + return replication.ParseMysqlGTIDSet(qr.Rows[0][0].ToString()) } // serverUUID is part of the Flavor interface. @@ -137,9 +137,9 @@ func (mysqlFlavor) startSQLThreadCommand() string { // sendBinlogDumpCommand is part of the Flavor interface. func (mysqlFlavor) sendBinlogDumpCommand(c *Conn, serverID uint32, binlogFilename string, startPos replication.Position) error { - gtidSet, ok := startPos.GTIDSet.(replication.Mysql56GTIDSet) + gtidSet, ok := startPos.GTIDSet.(replication.MysqlGTIDSet) if !ok { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "startPos.GTIDSet is wrong type - expected Mysql56GTIDSet, got: %#v", startPos.GTIDSet) + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "startPos.GTIDSet is wrong type - expected MysqlGTIDSet, got: %#v", startPos.GTIDSet) } // Build the command. @@ -280,7 +280,7 @@ func (mysqlFlavor) readBinlogEvent(c *Conn) (BinlogEvent, error) { if err != nil { return nil, err } - ev := NewMysql56BinlogEventWithSemiSyncInfo(buf, semiSyncAckRequested) + ev := NewMysqlBinlogEventWithSemiSyncInfo(buf, semiSyncAckRequested) return ev, nil } diff --git a/go/mysql/flavor_mysql_test.go b/go/mysql/flavor_mysql_test.go index 0e1b749633a..8160e922cdf 100644 --- a/go/mysql/flavor_mysql_test.go +++ b/go/mysql/flavor_mysql_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestMysql56SetReplicationSourceCommand(t *testing.T) { +func TestMysqlSetReplicationSourceCommand(t *testing.T) { params := &ConnParams{ Uname: "username", Pass: "password", @@ -44,7 +44,7 @@ func TestMysql56SetReplicationSourceCommand(t *testing.T) { } -func TestMysql56SetReplicationSourceCommandSSL(t *testing.T) { +func TestMysqlSetReplicationSourceCommandSSL(t *testing.T) { params := &ConnParams{ Uname: "username", Pass: "password", diff --git a/go/mysql/replication/mysql56_gtid.go b/go/mysql/replication/mysql_gtid.go similarity index 80% rename from go/mysql/replication/mysql56_gtid.go rename to go/mysql/replication/mysql_gtid.go index 4ec861b84e5..99471e2b240 100644 --- a/go/mysql/replication/mysql56_gtid.go +++ b/go/mysql/replication/mysql_gtid.go @@ -26,11 +26,11 @@ import ( "vitess.io/vitess/go/vt/vterrors" ) -// Mysql56FlavorID is the string identifier for the Mysql56 flavor. -const Mysql56FlavorID = "MySQL56" +// MysqlFlavorID is the string identifier for the Mysql flavor. +const MysqlFlavorID = "MySQL" -// parseMysql56GTID is registered as a GTID parser. -func parseMysql56GTID(s string) (GTID, error) { +// parseMysqlGTID is registered as a GTID parser. +func parseMysqlGTID(s string) (GTID, error) { // Split into parts. parts := strings.Split(s, ":") if len(parts) != 2 { @@ -49,7 +49,7 @@ func parseMysql56GTID(s string) (GTID, error) { return nil, vterrors.Wrapf(err, "invalid MySQL 5.6 GTID Sequence number (%v)", parts[1]) } - return Mysql56GTID{Server: sid, Sequence: seq}, nil + return MysqlGTID{Server: sid, Sequence: seq}, nil } // SID is the 16-byte unique ID of a MySQL 5.6 server. @@ -86,8 +86,8 @@ func ParseSID(s string) (sid SID, err error) { return sid, nil } -// Mysql56GTID implements GTID -type Mysql56GTID struct { +// MysqlGTID implements GTID +type MysqlGTID struct { // Server is the SID of the server that originally committed the transaction. Server SID // Sequence is the sequence number of the transaction within a given Server's @@ -96,35 +96,35 @@ type Mysql56GTID struct { } // String implements GTID.String(). -func (gtid Mysql56GTID) String() string { +func (gtid MysqlGTID) String() string { return fmt.Sprintf("%s:%d", gtid.Server, gtid.Sequence) } // Flavor implements GTID.Flavor(). -func (gtid Mysql56GTID) Flavor() string { - return Mysql56FlavorID +func (gtid MysqlGTID) Flavor() string { + return MysqlFlavorID } // SequenceDomain implements GTID.SequenceDomain(). -func (gtid Mysql56GTID) SequenceDomain() any { +func (gtid MysqlGTID) SequenceDomain() any { return nil } // SourceServer implements GTID.SourceServer(). -func (gtid Mysql56GTID) SourceServer() any { +func (gtid MysqlGTID) SourceServer() any { return gtid.Server } // SequenceNumber implements GTID.SequenceNumber(). -func (gtid Mysql56GTID) SequenceNumber() any { +func (gtid MysqlGTID) SequenceNumber() any { return gtid.Sequence } // GTIDSet implements GTID.GTIDSet(). -func (gtid Mysql56GTID) GTIDSet() GTIDSet { - return Mysql56GTIDSet{}.AddGTID(gtid) +func (gtid MysqlGTID) GTIDSet() GTIDSet { + return MysqlGTIDSet{}.AddGTID(gtid) } func init() { - gtidParsers[Mysql56FlavorID] = parseMysql56GTID + gtidParsers[MysqlFlavorID] = parseMysqlGTID } diff --git a/go/mysql/replication/mysql56_gtid_set.go b/go/mysql/replication/mysql_gtid_set.go similarity index 91% rename from go/mysql/replication/mysql56_gtid_set.go rename to go/mysql/replication/mysql_gtid_set.go index 1d46176b19a..c7d143a0766 100644 --- a/go/mysql/replication/mysql56_gtid_set.go +++ b/go/mysql/replication/mysql_gtid_set.go @@ -56,11 +56,11 @@ func parseInterval(s string) (interval, error) { return interval{start: int64(start), end: int64(start)}, nil } -// ParseMysql56GTIDSet is registered as a GTIDSet parser. +// ParseMysqlGTIDSet is registered as a GTIDSet parser. // // https://dev.mysql.com/doc/refman/5.6/en/replication-gtids-concepts.html -func ParseMysql56GTIDSet(s string) (Mysql56GTIDSet, error) { - set := make(Mysql56GTIDSet) +func ParseMysqlGTIDSet(s string) (MysqlGTIDSet, error) { + set := make(MysqlGTIDSet) input := s // gtid_set: uuid_set [, uuid_set] ... @@ -144,11 +144,11 @@ func ParseMysql56GTIDSet(s string) (Mysql56GTIDSet, error) { return set, nil } -// Mysql56GTIDSet implements GTIDSet for MySQL 5.6. -type Mysql56GTIDSet map[SID][]interval +// MysqlGTIDSet implements GTIDSet for MySQL 5.6. +type MysqlGTIDSet map[SID][]interval // SIDs returns a sorted list of SIDs in the set. -func (set Mysql56GTIDSet) SIDs() []SID { +func (set MysqlGTIDSet) SIDs() []SID { sids := make([]SID, 0, len(set)) for sid := range set { sids = append(sids, sid) @@ -164,7 +164,7 @@ func sortSIDs(sids []SID) { } // String implements GTIDSet. -func (set Mysql56GTIDSet) String() string { +func (set MysqlGTIDSet) String() string { var buf strings.Builder for i, sid := range set.SIDs() { if i != 0 { @@ -188,7 +188,7 @@ func (set Mysql56GTIDSet) String() string { // Last returns the last gtid as string // For gtidset having multiple SIDs or multiple intervals // it just returns the last SID with last interval -func (set Mysql56GTIDSet) Last() string { +func (set MysqlGTIDSet) Last() string { var buf strings.Builder if len(set.SIDs()) > 0 { sid := set.SIDs()[len(set.SIDs())-1] @@ -204,11 +204,11 @@ func (set Mysql56GTIDSet) Last() string { } // Flavor implements GTIDSet. -func (Mysql56GTIDSet) Flavor() string { return Mysql56FlavorID } +func (MysqlGTIDSet) Flavor() string { return MysqlFlavorID } // ContainsGTID implements GTIDSet. -func (set Mysql56GTIDSet) ContainsGTID(gtid GTID) bool { - gtid56, ok := gtid.(Mysql56GTID) +func (set MysqlGTIDSet) ContainsGTID(gtid GTID) bool { + gtid56, ok := gtid.(MysqlGTID) if !ok { return false } @@ -228,12 +228,12 @@ func (set Mysql56GTIDSet) ContainsGTID(gtid GTID) bool { } // Contains implements GTIDSet. -func (set Mysql56GTIDSet) Contains(other GTIDSet) bool { +func (set MysqlGTIDSet) Contains(other GTIDSet) bool { if other == nil { return false } - other56, ok := other.(Mysql56GTIDSet) + other56, ok := other.(MysqlGTIDSet) if !ok { return false } @@ -268,8 +268,8 @@ func (set Mysql56GTIDSet) Contains(other GTIDSet) bool { } // Equal implements GTIDSet. -func (set Mysql56GTIDSet) Equal(other GTIDSet) bool { - other56, ok := other.(Mysql56GTIDSet) +func (set MysqlGTIDSet) Equal(other GTIDSet) bool { + other56, ok := other.(MysqlGTIDSet) if !ok { return false } @@ -302,8 +302,8 @@ func (set Mysql56GTIDSet) Equal(other GTIDSet) bool { } // AddGTID implements GTIDSet. -func (set Mysql56GTIDSet) AddGTID(gtid GTID) GTIDSet { - gtid56, ok := gtid.(Mysql56GTID) +func (set MysqlGTIDSet) AddGTID(gtid GTID) GTIDSet { + gtid56, ok := gtid.(MysqlGTID) if !ok { return set } @@ -316,7 +316,7 @@ func (set Mysql56GTIDSet) AddGTID(gtid GTID) GTIDSet { // Make a copy and add the new GTID in the proper place. // This function is not supposed to modify the original set. - newSet := make(Mysql56GTIDSet) + newSet := make(MysqlGTIDSet) added := false @@ -371,21 +371,21 @@ func (set Mysql56GTIDSet) AddGTID(gtid GTID) GTIDSet { } // Union implements GTIDSet.Union(). -func (set Mysql56GTIDSet) Union(other GTIDSet) GTIDSet { +func (set MysqlGTIDSet) Union(other GTIDSet) GTIDSet { if set == nil && other != nil { return other } if set == nil || other == nil { return set } - mydbOther, ok := other.(Mysql56GTIDSet) + mydbOther, ok := other.(MysqlGTIDSet) if !ok { return set } // Make a copy and add the new GTID in the proper place. // This function is not supposed to modify the original set. - newSet := make(Mysql56GTIDSet) + newSet := make(MysqlGTIDSet) for otherSID, otherIntervals := range mydbOther { intervals, ok := set[otherSID] @@ -443,7 +443,7 @@ func (set Mysql56GTIDSet) Union(other GTIDSet) GTIDSet { // by internal commands that refer to an "SID block". // // e.g. https://dev.mysql.com/doc/internals/en/com-binlog-dump-gtid.html -func (set Mysql56GTIDSet) SIDBlock() []byte { +func (set MysqlGTIDSet) SIDBlock() []byte { buf := &bytes.Buffer{} // Number of SIDs. @@ -467,16 +467,16 @@ func (set Mysql56GTIDSet) SIDBlock() []byte { return buf.Bytes() } -// Difference will supply the difference between the receiver and supplied Mysql56GTIDSets, and supply the result -// as a Mysql56GTIDSet. -func (set Mysql56GTIDSet) Difference(other Mysql56GTIDSet) Mysql56GTIDSet { +// Difference will supply the difference between the receiver and supplied MysqlGTIDSets, and supply the result +// as a MysqlGTIDSet. +func (set MysqlGTIDSet) Difference(other MysqlGTIDSet) MysqlGTIDSet { if other == nil || set == nil { return set } // Make a fresh, empty set to hold the new value. // This function is not supposed to modify the original set. - differenceSet := make(Mysql56GTIDSet) + differenceSet := make(MysqlGTIDSet) for sid, intervals := range set { otherIntervals, ok := other[sid] @@ -595,7 +595,7 @@ func (set Mysql56GTIDSet) Difference(other Mysql56GTIDSet) Mysql56GTIDSet { return differenceSet } -// NewMysql56GTIDSetFromSIDBlock builds a Mysql56GTIDSet from parsing a SID Block. +// NewMysqlGTIDSetFromSIDBlock builds a MysqlGTIDSet from parsing a SID Block. // This is the reverse of the SIDBlock method. // // Expected format: @@ -612,9 +612,9 @@ func (set Mysql56GTIDSet) Difference(other Mysql56GTIDSet) Mysql56GTIDSet { // // 8 start // 8 end -func NewMysql56GTIDSetFromSIDBlock(data []byte) (Mysql56GTIDSet, error) { +func NewMysqlGTIDSetFromSIDBlock(data []byte) (MysqlGTIDSet, error) { buf := bytes.NewReader(data) - var set Mysql56GTIDSet = make(map[SID][]interval) + var set MysqlGTIDSet = make(map[SID][]interval) var nSIDs uint64 if err := binary.Read(buf, binary.LittleEndian, &nSIDs); err != nil { return nil, vterrors.Wrapf(err, "cannot read nSIDs") @@ -668,20 +668,20 @@ func popInterval(dst *interval, s1, s2 *[]interval) bool { } func init() { - gtidSetParsers[Mysql56FlavorID] = func(s string) (GTIDSet, error) { - return ParseMysql56GTIDSet(s) + gtidSetParsers[MysqlFlavorID] = func(s string) (GTIDSet, error) { + return ParseMysqlGTIDSet(s) } } -// Subtract takes in two Mysql56GTIDSets as strings and subtracts the second from the first +// Subtract takes in two MysqlGTIDSets as strings and subtracts the second from the first // The result is also a string. // An error is thrown if parsing is not possible for either GTIDSets func Subtract(lhs, rhs string) (string, error) { - lhsSet, err := ParseMysql56GTIDSet(lhs) + lhsSet, err := ParseMysqlGTIDSet(lhs) if err != nil { return "", err } - rhsSet, err := ParseMysql56GTIDSet(rhs) + rhsSet, err := ParseMysqlGTIDSet(rhs) if err != nil { return "", err } diff --git a/go/mysql/replication/mysql56_gtid_set_test.go b/go/mysql/replication/mysql_gtid_set_test.go similarity index 84% rename from go/mysql/replication/mysql56_gtid_set_test.go rename to go/mysql/replication/mysql_gtid_set_test.go index 323baae3885..e44806ac94b 100644 --- a/go/mysql/replication/mysql56_gtid_set_test.go +++ b/go/mysql/replication/mysql_gtid_set_test.go @@ -47,11 +47,11 @@ func TestSortSIDList(t *testing.T) { assert.True(t, reflect.DeepEqual(input, want), "got %#v, want %#v", input, want) } -func TestParseMysql56GTIDSet(t *testing.T) { +func TestParseMysqlGTIDSet(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 255} - table := map[string]Mysql56GTIDSet{ + table := map[string]MysqlGTIDSet{ // Empty "": {}, // Simple case @@ -101,14 +101,14 @@ func TestParseMysql56GTIDSet(t *testing.T) { for input, want := range table { t.Run(input, func(t *testing.T) { - got, err := ParseMysql56GTIDSet(input) + got, err := ParseMysqlGTIDSet(input) require.NoError(t, err) assert.Equal(t, want, got) }) } } -func TestParseMysql56GTIDSetInvalid(t *testing.T) { +func TestParseMysqlGTIDSetInvalid(t *testing.T) { table := []string{ // No intervals "00010203-0405-0607-0809-0a0b0c0d0e0f", @@ -122,16 +122,16 @@ func TestParseMysql56GTIDSetInvalid(t *testing.T) { } for _, input := range table { - _, err := ParseMysql56GTIDSet(input) - assert.Error(t, err, "ParseMysql56GTIDSet(%#v) expected error, got none", err) + _, err := ParseMysqlGTIDSet(input) + assert.Error(t, err, "ParseMysqlGTIDSet(%#v) expected error, got none", err) } } -func TestMysql56GTIDSetString(t *testing.T) { +func TestMysqlGTIDSetString(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 255} - table := map[string]Mysql56GTIDSet{ + table := map[string]MysqlGTIDSet{ // Simple case "00010203-0405-0607-0809-0a0b0c0d0e0f:1-5": { sid1: []interval{{1, 5}}, @@ -158,19 +158,19 @@ func TestMysql56GTIDSetString(t *testing.T) { } } -func TestMysql56GTIDSetFlavor(t *testing.T) { - input := Mysql56GTIDSet{} - if got, want := input.Flavor(), "MySQL56"; got != want { +func TestMysqlGTIDSetFlavor(t *testing.T) { + input := MysqlGTIDSet{} + if got, want := input.Flavor(), "MySQL"; got != want { t.Errorf("%#v.Flavor() = %#v, want %#v", input, got, want) } } -func TestMysql56GTIDSetContainsGTID(t *testing.T) { +func TestMysqlGTIDSetContainsGTID(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16} sid3 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17} - set := Mysql56GTIDSet{ + set := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}}, sid2: []interval{{1, 5}, {50, 50}}, } @@ -178,19 +178,19 @@ func TestMysql56GTIDSetContainsGTID(t *testing.T) { table := map[GTID]bool{ fakeGTID{}: false, - Mysql56GTID{sid1, 1}: false, - Mysql56GTID{sid1, 19}: false, - Mysql56GTID{sid1, 20}: true, - Mysql56GTID{sid1, 23}: true, - Mysql56GTID{sid1, 30}: true, - Mysql56GTID{sid1, 31}: false, + MysqlGTID{sid1, 1}: false, + MysqlGTID{sid1, 19}: false, + MysqlGTID{sid1, 20}: true, + MysqlGTID{sid1, 23}: true, + MysqlGTID{sid1, 30}: true, + MysqlGTID{sid1, 31}: false, - Mysql56GTID{sid2, 1}: true, - Mysql56GTID{sid2, 10}: false, - Mysql56GTID{sid2, 50}: true, - Mysql56GTID{sid2, 51}: false, + MysqlGTID{sid2, 1}: true, + MysqlGTID{sid2, 10}: false, + MysqlGTID{sid2, 50}: true, + MysqlGTID{sid2, 51}: false, - Mysql56GTID{sid3, 1}: false, + MysqlGTID{sid3, 1}: false, } for input, want := range table { @@ -200,19 +200,19 @@ func TestMysql56GTIDSetContainsGTID(t *testing.T) { } } -func TestMysql56GTIDSetContains(t *testing.T) { +func TestMysqlGTIDSetContains(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16} sid3 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17} // The set to test against. - set := Mysql56GTIDSet{ + set := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, } // Test cases that should return Contains() = true. - contained := []Mysql56GTIDSet{ + contained := []MysqlGTIDSet{ // The set should contain itself. set, // Every set contains the empty set. @@ -240,22 +240,22 @@ func TestMysql56GTIDSetContains(t *testing.T) { fakeGTID{}, // Simple cases - Mysql56GTIDSet{sid1: []interval{{1, 5}}}, - Mysql56GTIDSet{sid1: []interval{{10, 19}}}, + MysqlGTIDSet{sid1: []interval{{1, 5}}}, + MysqlGTIDSet{sid1: []interval{{10, 19}}}, // Overlapping intervals - Mysql56GTIDSet{sid1: []interval{{10, 20}}}, - Mysql56GTIDSet{sid1: []interval{{10, 25}}}, - Mysql56GTIDSet{sid1: []interval{{25, 31}}}, - Mysql56GTIDSet{sid1: []interval{{30, 31}}}, + MysqlGTIDSet{sid1: []interval{{10, 20}}}, + MysqlGTIDSet{sid1: []interval{{10, 25}}}, + MysqlGTIDSet{sid1: []interval{{25, 31}}}, + MysqlGTIDSet{sid1: []interval{{30, 31}}}, // Multiple intervals - Mysql56GTIDSet{sid1: []interval{{20, 30}, {34, 34}}}, + MysqlGTIDSet{sid1: []interval{{20, 30}, {34, 34}}}, // Multiple SIDs - Mysql56GTIDSet{ + MysqlGTIDSet{ sid1: []interval{{20, 30}, {36, 36}}, sid2: []interval{{3, 5}, {55, 60}}, }, // SID is missing entirely - Mysql56GTIDSet{sid3: []interval{{1, 5}}}, + MysqlGTIDSet{sid3: []interval{{1, 5}}}, } for _, other := range notContained { @@ -265,19 +265,19 @@ func TestMysql56GTIDSetContains(t *testing.T) { } } -func TestMysql56GTIDSetContains2(t *testing.T) { - set1, err := ParseMysql56GTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-243") +func TestMysqlGTIDSetContains2(t *testing.T) { + set1, err := ParseMysqlGTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-243") require.NoError(t, err) - set2, err := ParseMysql56GTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615") + set2, err := ParseMysqlGTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615") require.NoError(t, err) - set3, err := ParseMysql56GTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-632") + set3, err := ParseMysqlGTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-632") require.NoError(t, err) - set4, err := ParseMysql56GTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:20-664") + set4, err := ParseMysqlGTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:20-664") require.NoError(t, err) - set5, err := ParseMysql56GTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:20-243") + set5, err := ParseMysqlGTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:20-243") require.NoError(t, err) - compareSet, err := ParseMysql56GTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615") + compareSet, err := ParseMysqlGTIDSet("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615") require.NoError(t, err) assert.True(t, compareSet.Contains(set1)) @@ -287,19 +287,19 @@ func TestMysql56GTIDSetContains2(t *testing.T) { assert.True(t, compareSet.Contains(set5)) } -func TestMysql56GTIDSetEqual(t *testing.T) { +func TestMysqlGTIDSetEqual(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16} sid3 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17} // The set to test against. - set := Mysql56GTIDSet{ + set := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, } // Test cases that should return Equal() = true. - equal := []Mysql56GTIDSet{ + equal := []MysqlGTIDSet{ // Same underlying map instance set, // Different instance, same data @@ -321,35 +321,35 @@ func TestMysql56GTIDSetEqual(t *testing.T) { // Wrong flavor is not equal. fakeGTID{}, // Empty set - Mysql56GTIDSet{}, + MysqlGTIDSet{}, // Interval changed - Mysql56GTIDSet{ + MysqlGTIDSet{ sid1: []interval{{20, 31}, {35, 40}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, // Interval added - Mysql56GTIDSet{ + MysqlGTIDSet{ sid1: []interval{{20, 30}, {32, 33}, {35, 40}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, // Interval removed - Mysql56GTIDSet{ + MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}}, sid2: []interval{{1, 5}, {60, 70}}, }, // Different SID, same intervals - Mysql56GTIDSet{ + MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}}, sid3: []interval{{1, 5}, {50, 50}, {60, 70}}, }, // SID added - Mysql56GTIDSet{ + MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, sid3: []interval{{1, 5}}, }, // SID removed - Mysql56GTIDSet{ + MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}}, }, } @@ -365,66 +365,66 @@ func TestMysql56GTIDSetEqual(t *testing.T) { } } -func TestMysql56GTIDSetAddGTID(t *testing.T) { +func TestMysqlGTIDSetAddGTID(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16} sid3 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17} // The set to test against. - set := Mysql56GTIDSet{ + set := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, } - table := map[GTID]Mysql56GTIDSet{ + table := map[GTID]MysqlGTIDSet{ // Adding wrong flavor is a no-op. fakeGTID{}: set, // Adding GTIDs that are already in the set - Mysql56GTID{Server: sid1, Sequence: 20}: { + MysqlGTID{Server: sid1, Sequence: 20}: { sid1: []interval{{20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, - Mysql56GTID{Server: sid1, Sequence: 30}: { + MysqlGTID{Server: sid1, Sequence: 30}: { sid1: []interval{{20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, - Mysql56GTID{Server: sid1, Sequence: 25}: { + MysqlGTID{Server: sid1, Sequence: 25}: { sid1: []interval{{20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, // New interval beginning - Mysql56GTID{Server: sid1, Sequence: 1}: { + MysqlGTID{Server: sid1, Sequence: 1}: { sid1: []interval{{1, 1}, {20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, // New interval middle - Mysql56GTID{Server: sid1, Sequence: 32}: { + MysqlGTID{Server: sid1, Sequence: 32}: { sid1: []interval{{20, 30}, {32, 32}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, // New interval end - Mysql56GTID{Server: sid1, Sequence: 50}: { + MysqlGTID{Server: sid1, Sequence: 50}: { sid1: []interval{{20, 30}, {35, 40}, {42, 45}, {50, 50}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, // Extend interval start - Mysql56GTID{Server: sid2, Sequence: 49}: { + MysqlGTID{Server: sid2, Sequence: 49}: { sid1: []interval{{20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {49, 50}, {60, 70}}, }, // Extend interval end - Mysql56GTID{Server: sid2, Sequence: 51}: { + MysqlGTID{Server: sid2, Sequence: 51}: { sid1: []interval{{20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {50, 51}, {60, 70}}, }, // Merge intervals - Mysql56GTID{Server: sid1, Sequence: 41}: { + MysqlGTID{Server: sid1, Sequence: 41}: { sid1: []interval{{20, 30}, {35, 45}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, }, // Different SID - Mysql56GTID{Server: sid3, Sequence: 1}: { + MysqlGTID{Server: sid3, Sequence: 1}: { sid1: []interval{{20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {50, 50}, {60, 70}}, sid3: []interval{{1, 1}}, @@ -438,17 +438,17 @@ func TestMysql56GTIDSetAddGTID(t *testing.T) { } } -func TestMysql56GTIDSetUnion(t *testing.T) { +func TestMysqlGTIDSetUnion(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16} sid3 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17} - set1 := Mysql56GTIDSet{ + set1 := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}, {42, 45}}, sid2: []interval{{1, 5}, {20, 50}, {60, 70}}, } - set2 := Mysql56GTIDSet{ + set2 := MysqlGTIDSet{ sid1: []interval{{20, 31}, {35, 37}, {41, 46}}, sid2: []interval{{3, 6}, {22, 49}, {67, 72}}, sid3: []interval{{1, 45}}, @@ -456,7 +456,7 @@ func TestMysql56GTIDSetUnion(t *testing.T) { got := set1.Union(set2) - want := Mysql56GTIDSet{ + want := MysqlGTIDSet{ sid1: []interval{{20, 31}, {35, 46}}, sid2: []interval{{1, 6}, {20, 50}, {60, 72}}, sid3: []interval{{1, 45}}, @@ -465,21 +465,21 @@ func TestMysql56GTIDSetUnion(t *testing.T) { } -func TestMysql56GTIDSetDifference(t *testing.T) { +func TestMysqlGTIDSetDifference(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16} sid3 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17} sid4 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 18} sid5 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 19} - set1 := Mysql56GTIDSet{ + set1 := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 39}, {40, 53}, {55, 75}}, sid2: []interval{{1, 7}, {20, 50}, {60, 70}}, sid4: []interval{{1, 30}}, sid5: []interval{{1, 7}, {20, 30}}, } - set2 := Mysql56GTIDSet{ + set2 := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 37}, {50, 60}}, sid2: []interval{{3, 5}, {22, 25}, {32, 37}, {67, 70}}, sid3: []interval{{1, 45}}, @@ -488,7 +488,7 @@ func TestMysql56GTIDSetDifference(t *testing.T) { got := set1.Difference(set2) - want := Mysql56GTIDSet{ + want := MysqlGTIDSet{ sid1: []interval{{38, 39}, {40, 49}, {61, 75}}, sid2: []interval{{1, 2}, {6, 7}, {20, 21}, {26, 31}, {38, 50}, {60, 66}}, sid4: []interval{{1, 30}}, @@ -498,23 +498,23 @@ func TestMysql56GTIDSetDifference(t *testing.T) { sid10 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid11 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} - set10 := Mysql56GTIDSet{ + set10 := MysqlGTIDSet{ sid10: []interval{{1, 30}}, } - set11 := Mysql56GTIDSet{ + set11 := MysqlGTIDSet{ sid11: []interval{{1, 30}}, } got = set10.Difference(set11) - want = Mysql56GTIDSet{} + want = MysqlGTIDSet{} assert.True(t, got.Equal(want), "got %#v; want %#v", got, want) } -func TestMysql56GTIDSetSIDBlock(t *testing.T) { +func TestMysqlGTIDSetSIDBlock(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16} - input := Mysql56GTIDSet{ + input := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 40}}, sid2: []interval{{1, 5}}, } @@ -546,17 +546,17 @@ func TestMysql56GTIDSetSIDBlock(t *testing.T) { assert.True(t, reflect.DeepEqual(got, want), "%#v.SIDBlock() = %#v, want %#v", input, got, want) // Testing the conversion back. - set, err := NewMysql56GTIDSetFromSIDBlock(want) - require.NoError(t, err, "Reconstructing Mysql56GTIDSet from SID block failed: %v", err) - assert.True(t, reflect.DeepEqual(set, input), "NewMysql56GTIDSetFromSIDBlock(%#v) = %#v, want %#v", want, set, input) + set, err := NewMysqlGTIDSetFromSIDBlock(want) + require.NoError(t, err, "Reconstructing MysqlGTIDSet from SID block failed: %v", err) + assert.True(t, reflect.DeepEqual(set, input), "NewMysqlGTIDSetFromSIDBlock(%#v) = %#v, want %#v", want, set, input) } -func TestMySQL56GTIDSetLast(t *testing.T) { +func TestMySQLGTIDSetLast(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} sid2 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 255} - table := map[string]Mysql56GTIDSet{ + table := map[string]MysqlGTIDSet{ // Simple case "00010203-0405-0607-0809-0a0b0c0d0e0f:5": { sid1: []interval{{1, 5}}, @@ -683,7 +683,7 @@ func TestSubtract(t *testing.T) { } } -func BenchmarkMySQL56GTIDParsing(b *testing.B) { +func BenchmarkMySQLGTIDParsing(b *testing.B) { var Inputs = []string{ "00010203-0405-0607-0809-0a0b0c0d0e0f:1-5", "00010203-0405-0607-0809-0a0b0c0d0e0f:12", @@ -700,7 +700,7 @@ func BenchmarkMySQL56GTIDParsing(b *testing.B) { for n := 0; n < b.N; n++ { for _, input := range Inputs { - _, _ = ParseMysql56GTIDSet(input) + _, _ = ParseMysqlGTIDSet(input) } } } diff --git a/go/mysql/replication/mysql56_gtid_test.go b/go/mysql/replication/mysql_gtid_test.go similarity index 75% rename from go/mysql/replication/mysql56_gtid_test.go rename to go/mysql/replication/mysql_gtid_test.go index 7a4bc9862a8..cbe0405ac08 100644 --- a/go/mysql/replication/mysql56_gtid_test.go +++ b/go/mysql/replication/mysql_gtid_test.go @@ -24,20 +24,20 @@ import ( "github.com/stretchr/testify/require" ) -func TestParseMysql56GTID(t *testing.T) { +func TestParseMysqlGTID(t *testing.T) { input := "00010203-0405-0607-0809-0A0B0C0D0E0F:56789" - want := Mysql56GTID{ + want := MysqlGTID{ Server: SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, Sequence: 56789, } - got, err := parseMysql56GTID(input) + got, err := parseMysqlGTID(input) require.NoError(t, err, "unexpected error: %v", err) - assert.Equal(t, want, got, "parseMysql56GTID(%#v) = %#v, want %#v", input, got, want) + assert.Equal(t, want, got, "parseMysqlGTID(%#v) = %#v, want %#v", input, got, want) } -func TestParseMysql56GTIDInvalid(t *testing.T) { +func TestParseMysqlGTIDInvalid(t *testing.T) { table := []string{ "", "00010203-0405-0607-0809-0A0B0C0D0E0F", @@ -47,8 +47,8 @@ func TestParseMysql56GTIDInvalid(t *testing.T) { } for _, input := range table { - _, err := parseMysql56GTID(input) - assert.Error(t, err, "parseMysql56GTID(%#v): expected error, got none", input) + _, err := parseMysqlGTID(input) + assert.Error(t, err, "parseMysqlGTID(%#v): expected error, got none", input) } } @@ -87,8 +87,8 @@ func TestParseSIDInvalid(t *testing.T) { } } -func TestMysql56GTIDString(t *testing.T) { - input := Mysql56GTID{ +func TestMysqlGTIDString(t *testing.T) { + input := MysqlGTID{ Server: SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, Sequence: 12345, } @@ -98,22 +98,22 @@ func TestMysql56GTIDString(t *testing.T) { } } -func TestMysql56GTIDFlavor(t *testing.T) { - input := Mysql56GTID{} - if got, want := input.Flavor(), "MySQL56"; got != want { +func TestMysqlGTIDFlavor(t *testing.T) { + input := MysqlGTID{} + if got, want := input.Flavor(), "MySQL"; got != want { t.Errorf("%#v.Flavor() = %#v, want %#v", input, got, want) } } -func TestMysql56SequenceDomain(t *testing.T) { - input := Mysql56GTID{} +func TestMysqlSequenceDomain(t *testing.T) { + input := MysqlGTID{} if got, want := input.SequenceDomain(), any(nil); got != want { t.Errorf("%#v.SequenceDomain() = %#v, want %#v", input, got, want) } } -func TestMysql56SourceServer(t *testing.T) { - input := Mysql56GTID{ +func TestMysqlSourceServer(t *testing.T) { + input := MysqlGTID{ Server: SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, } want := any(SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}) @@ -122,8 +122,8 @@ func TestMysql56SourceServer(t *testing.T) { } } -func TestMysql56SequenceNumber(t *testing.T) { - input := Mysql56GTID{ +func TestMysqlSequenceNumber(t *testing.T) { + input := MysqlGTID{ Server: SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, Sequence: 5432, } @@ -133,23 +133,23 @@ func TestMysql56SequenceNumber(t *testing.T) { } } -func TestMysql56GTIDGTIDSet(t *testing.T) { +func TestMysqlGTIDGTIDSet(t *testing.T) { sid1 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} - input := Mysql56GTID{Server: sid1, Sequence: 5432} - want := Mysql56GTIDSet{sid1: []interval{{5432, 5432}}} + input := MysqlGTID{Server: sid1, Sequence: 5432} + want := MysqlGTIDSet{sid1: []interval{{5432, 5432}}} if got := input.GTIDSet(); !got.Equal(want) { t.Errorf("%#v.GTIDSet() = %#v, want %#v", input, got, want) } } -func TestMysql56ParseGTID(t *testing.T) { +func TestMysqlParseGTID(t *testing.T) { input := "00010203-0405-0607-0809-0A0B0C0D0E0F:56789" - want := Mysql56GTID{ + want := MysqlGTID{ Server: SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, Sequence: 56789, } - got, err := parseMysql56GTID(input) + got, err := parseMysqlGTID(input) require.NoError(t, err, "unexpected error: %v", err) - assert.Equal(t, want, got, "(&mysql56{}).ParseGTID(%#v) = %#v, want %#v", input, got, want) + assert.Equal(t, want, got, "(&mysql{}).ParseGTID(%#v) = %#v, want %#v", input, got, want) } diff --git a/go/mysql/replication/primary_status.go b/go/mysql/replication/primary_status.go index 679b152f9d4..817221da86d 100644 --- a/go/mysql/replication/primary_status.go +++ b/go/mysql/replication/primary_status.go @@ -44,7 +44,7 @@ func ParseMysqlPrimaryStatus(resultMap map[string]string) (PrimaryStatus, error) status := ParsePrimaryStatus(resultMap) var err error - status.Position.GTIDSet, err = ParseMysql56GTIDSet(resultMap["Executed_Gtid_Set"]) + status.Position.GTIDSet, err = ParseMysqlGTIDSet(resultMap["Executed_Gtid_Set"]) if err != nil { return PrimaryStatus{}, vterrors.Wrapf(err, "PrimaryStatus can't parse MySQL 5.6 GTID (Executed_Gtid_Set: %#v)", resultMap["Executed_Gtid_Set"]) } diff --git a/go/mysql/replication/replication_position.go b/go/mysql/replication/replication_position.go index a1a9fc2c9c1..2e3db994204 100644 --- a/go/mysql/replication/replication_position.go +++ b/go/mysql/replication/replication_position.go @@ -149,8 +149,8 @@ func DecodePosition(s string) (rp Position, err error) { // EncodePosition back into a Position value with the // correct underlying flavor. If the string does not indicate a flavor, then the 'flavor' argument // is used. For example: -// - DecodePositionDefaultFlavor("MySQL56/16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", "foo"): "MySQL56" explicitly indicated, this is the flavor. -// - DecodePositionDefaultFlavor("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", "MySQL56"): No flavor indicated in `s`, therefore using "MySQL56" +// - DecodePositionDefaultFlavor("MySQL/16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", "foo"): "MySQL" explicitly indicated, this is the flavor. +// - DecodePositionDefaultFlavor("16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", "MySQL"): No flavor indicated in `s`, therefore using "MySQL" func DecodePositionDefaultFlavor(s string, flavor string) (rp Position, err error) { if s == "" { return rp, nil @@ -199,11 +199,11 @@ func (rp *Position) UnmarshalJSON(buf []byte) error { } // MatchesFlavor will take a flavor string, and return whether the positions GTIDSet matches the supplied flavor. -// The caller should use the constants Mysql56FlavorID, MariadbFlavorID, or FilePosFlavorID when supplying the flavor string. +// The caller should use the constants MysqlFlavorID, MariadbFlavorID, or FilePosFlavorID when supplying the flavor string. func (rp *Position) MatchesFlavor(flavor string) bool { switch flavor { - case Mysql56FlavorID: - _, matches := rp.GTIDSet.(Mysql56GTIDSet) + case MysqlFlavorID: + _, matches := rp.GTIDSet.(MysqlGTIDSet) return matches case MariadbFlavorID: _, matches := rp.GTIDSet.(MariadbGTIDSet) diff --git a/go/mysql/replication/replication_position_test.go b/go/mysql/replication/replication_position_test.go index 125f5929bbe..5c9996bbbba 100644 --- a/go/mysql/replication/replication_position_test.go +++ b/go/mysql/replication/replication_position_test.go @@ -273,18 +273,18 @@ func TestDecodePosition(t *testing.T) { } func TestDecodePositionDefaultFlavor(t *testing.T) { - gtidSetParsers[Mysql56FlavorID] = func(s string) (GTIDSet, error) { - return ParseMysql56GTIDSet(s) + gtidSetParsers[MysqlFlavorID] = func(s string) (GTIDSet, error) { + return ParseMysqlGTIDSet(s) } { - pos := "MySQL56/16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615" + pos := "MySQL/16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615" rp, err := DecodePositionDefaultFlavor(pos, "foo") assert.NoError(t, err) assert.Equal(t, "16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", rp.GTIDSet.String()) } { pos := "16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615" - rp, err := DecodePositionDefaultFlavor(pos, Mysql56FlavorID) + rp, err := DecodePositionDefaultFlavor(pos, MysqlFlavorID) assert.NoError(t, err) assert.Equal(t, "16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", rp.GTIDSet.String()) } diff --git a/go/mysql/replication/replication_status.go b/go/mysql/replication/replication_status.go index 6b3d1bf2214..ac8ab5f2561 100644 --- a/go/mysql/replication/replication_status.go +++ b/go/mysql/replication/replication_status.go @@ -179,30 +179,30 @@ func ProtoToReplicationStatus(s *replicationdatapb.Status) ReplicationStatus { // FindErrantGTIDs can be used to find errant GTIDs in the receiver's relay log, by comparing it against all known replicas, // provided as a list of ReplicationStatus's. This method only works if the flavor for all retrieved ReplicationStatus's is MySQL. -// The result is returned as a Mysql56GTIDSet, each of whose elements is a found errant GTID. +// The result is returned as a MysqlGTIDSet, each of whose elements is a found errant GTID. // This function is best effort in nature. If it marks something as errant, then it is for sure errant. But there may be cases of errant GTIDs, which aren't caught by this function. -func (s *ReplicationStatus) FindErrantGTIDs(otherReplicaStatuses []*ReplicationStatus) (Mysql56GTIDSet, error) { +func (s *ReplicationStatus) FindErrantGTIDs(otherReplicaStatuses []*ReplicationStatus) (MysqlGTIDSet, error) { if len(otherReplicaStatuses) == 0 { // If there is nothing to compare this replica against, then we must assume that its GTID set is the correct one. return nil, nil } - relayLogSet, ok := s.RelayLogPosition.GTIDSet.(Mysql56GTIDSet) + relayLogSet, ok := s.RelayLogPosition.GTIDSet.(MysqlGTIDSet) if !ok { return nil, fmt.Errorf("errant GTIDs can only be computed on the MySQL flavor") } - otherSets := make([]Mysql56GTIDSet, 0, len(otherReplicaStatuses)) + otherSets := make([]MysqlGTIDSet, 0, len(otherReplicaStatuses)) for _, status := range otherReplicaStatuses { - otherSet, ok := status.RelayLogPosition.GTIDSet.(Mysql56GTIDSet) + otherSet, ok := status.RelayLogPosition.GTIDSet.(MysqlGTIDSet) if !ok { - panic("The receiver ReplicationStatus contained a Mysql56GTIDSet in its relay log, but a replica's ReplicationStatus is of another flavor. This should never happen.") + panic("The receiver ReplicationStatus contained a MysqlGTIDSet in its relay log, but a replica's ReplicationStatus is of another flavor. This should never happen.") } otherSets = append(otherSets, otherSet) } // Copy set for final diffSet so we don't mutate receiver. - diffSet := make(Mysql56GTIDSet, len(relayLogSet)) + diffSet := make(MysqlGTIDSet, len(relayLogSet)) for sid, intervals := range relayLogSet { if sid == s.SourceUUID { continue @@ -234,11 +234,11 @@ func ParseMysqlReplicationStatus(resultMap map[string]string) (ReplicationStatus } var err error - status.Position.GTIDSet, err = ParseMysql56GTIDSet(resultMap["Executed_Gtid_Set"]) + status.Position.GTIDSet, err = ParseMysqlGTIDSet(resultMap["Executed_Gtid_Set"]) if err != nil { return ReplicationStatus{}, vterrors.Wrapf(err, "ReplicationStatus can't parse MySQL 5.6 GTID (Executed_Gtid_Set: %#v)", resultMap["Executed_Gtid_Set"]) } - relayLogGTIDSet, err := ParseMysql56GTIDSet(resultMap["Retrieved_Gtid_Set"]) + relayLogGTIDSet, err := ParseMysqlGTIDSet(resultMap["Retrieved_Gtid_Set"]) if err != nil { return ReplicationStatus{}, vterrors.Wrapf(err, "ReplicationStatus can't parse MySQL 5.6 GTID (Retrieved_Gtid_Set: %#v)", resultMap["Retrieved_Gtid_Set"]) } diff --git a/go/mysql/replication/replication_status_test.go b/go/mysql/replication/replication_status_test.go index c1f5991f253..506c365c233 100644 --- a/go/mysql/replication/replication_status_test.go +++ b/go/mysql/replication/replication_status_test.go @@ -64,21 +64,21 @@ func TestFindErrantGTIDs(t *testing.T) { sid4 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 18} sourceSID := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 19} - set1 := Mysql56GTIDSet{ + set1 := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 39}, {40, 53}, {55, 75}}, sid2: []interval{{1, 7}, {20, 50}, {60, 70}}, sid4: []interval{{1, 30}}, sourceSID: []interval{{1, 7}, {20, 30}}, } - set2 := Mysql56GTIDSet{ + set2 := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 37}, {50, 60}}, sid2: []interval{{3, 5}, {22, 25}, {32, 37}, {67, 70}}, sid3: []interval{{1, 45}}, sourceSID: []interval{{2, 6}, {15, 40}}, } - set3 := Mysql56GTIDSet{ + set3 := MysqlGTIDSet{ sid1: []interval{{20, 30}, {35, 38}, {50, 70}}, sid2: []interval{{3, 5}, {22, 25}, {32, 37}, {67, 70}}, sid3: []interval{{1, 45}}, @@ -88,14 +88,14 @@ func TestFindErrantGTIDs(t *testing.T) { testcases := []struct { mainRepStatus *ReplicationStatus otherRepStatuses []*ReplicationStatus - want Mysql56GTIDSet + want MysqlGTIDSet }{{ mainRepStatus: &ReplicationStatus{SourceUUID: sourceSID, RelayLogPosition: Position{GTIDSet: set1}}, otherRepStatuses: []*ReplicationStatus{ {SourceUUID: sourceSID, RelayLogPosition: Position{GTIDSet: set2}}, {SourceUUID: sourceSID, RelayLogPosition: Position{GTIDSet: set3}}, }, - want: Mysql56GTIDSet{ + want: MysqlGTIDSet{ sid1: []interval{{39, 39}, {40, 49}, {71, 75}}, sid2: []interval{{1, 2}, {6, 7}, {20, 21}, {26, 31}, {38, 50}, {60, 66}}, sid4: []interval{{1, 30}}, @@ -125,7 +125,7 @@ func TestMysqlShouldGetPosition(t *testing.T) { sid, _ := ParseSID("3e11fa47-71ca-11e1-9e33-c80aa9429562") want := PrimaryStatus{ - Position: Position{GTIDSet: Mysql56GTIDSet{sid: []interval{{start: 1, end: 5}}}}, + Position: Position{GTIDSet: MysqlGTIDSet{sid: []interval{{start: 1, end: 5}}}}, FilePosition: Position{GTIDSet: FilePosGTID{File: "source-bin.000003", Pos: 1307}}, } got, err := ParseMysqlPrimaryStatus(resultMap) @@ -179,8 +179,8 @@ func TestMysqlShouldGetRelayLogPosition(t *testing.T) { sid, _ := ParseSID("3e11fa47-71ca-11e1-9e33-c80aa9429562") want := ReplicationStatus{ - Position: Position{GTIDSet: Mysql56GTIDSet{sid: []interval{{start: 1, end: 5}}}}, - RelayLogPosition: Position{GTIDSet: Mysql56GTIDSet{sid: []interval{{start: 1, end: 9}}}}, + Position: Position{GTIDSet: MysqlGTIDSet{sid: []interval{{start: 1, end: 5}}}}, + RelayLogPosition: Position{GTIDSet: MysqlGTIDSet{sid: []interval{{start: 1, end: 9}}}}, } got, err := ParseMysqlReplicationStatus(resultMap) require.NoError(t, err) diff --git a/go/mysql/replication_test.go b/go/mysql/replication_test.go index c397bc71b45..fe999f54d5b 100644 --- a/go/mysql/replication_test.go +++ b/go/mysql/replication_test.go @@ -119,7 +119,7 @@ func TestComBinlogDumpGTID(t *testing.T) { } assert.Equal(t, expectedData, data) }) - f := NewMySQL56BinlogFormat() + f := NewMySQLBinlogFormat() s := NewFakeBinlogStream() t.Run("Write rotate event", func(t *testing.T) { diff --git a/go/test/endtoend/backup/vtctlbackup/pitr_test_framework.go b/go/test/endtoend/backup/vtctlbackup/pitr_test_framework.go index 8b9014e7f8c..4fcdd6d2a73 100644 --- a/go/test/endtoend/backup/vtctlbackup/pitr_test_framework.go +++ b/go/test/endtoend/backup/vtctlbackup/pitr_test_framework.go @@ -214,7 +214,7 @@ func ExecTestIncrementalBackupAndRestoreToPos(t *testing.T, tcase *PITRTestCase) require.NotEqual(t, manifest.Position, manifest.FromPosition) require.True(t, manifest.Position.GTIDSet.Union(manifest.PurgedPosition.GTIDSet).Contains(manifest.FromPosition.GTIDSet)) - gtidPurgedPos, err := replication.ParsePosition(replication.Mysql56FlavorID, GetReplicaGtidPurged(t, 0)) + gtidPurgedPos, err := replication.ParsePosition(replication.MysqlFlavorID, GetReplicaGtidPurged(t, 0)) require.NoError(t, err) fromPositionIncludingPurged := manifest.FromPosition.GTIDSet.Union(gtidPurgedPos.GTIDSet) @@ -429,7 +429,7 @@ func ExecTestIncrementalBackupAndRestoreToTimestamp(t *testing.T, tcase *PITRTes } } - gtidPurgedPos, err := replication.ParsePosition(replication.Mysql56FlavorID, GetReplicaGtidPurged(t, 0)) + gtidPurgedPos, err := replication.ParsePosition(replication.MysqlFlavorID, GetReplicaGtidPurged(t, 0)) require.NoError(t, err) fromPositionIncludingPurged := manifest.FromPosition.GTIDSet.Union(gtidPurgedPos.GTIDSet) @@ -675,7 +675,7 @@ func ExecTestIncrementalBackupOnTwoTablets(t *testing.T, tcase *PITRTestCase) { require.NotEqual(t, manifest.Position, manifest.FromPosition) require.True(t, manifest.Position.GTIDSet.Union(manifest.PurgedPosition.GTIDSet).Contains(manifest.FromPosition.GTIDSet)) - gtidPurgedPos, err := replication.ParsePosition(replication.Mysql56FlavorID, GetReplicaGtidPurged(t, tc.replicaIndex)) + gtidPurgedPos, err := replication.ParsePosition(replication.MysqlFlavorID, GetReplicaGtidPurged(t, tc.replicaIndex)) require.NoError(t, err) fromPositionIncludingPurged := manifest.FromPosition.GTIDSet.Union(gtidPurgedPos.GTIDSet) diff --git a/go/test/endtoend/reparent/plannedreparent/reparent_test.go b/go/test/endtoend/reparent/plannedreparent/reparent_test.go index 45cbeb565c7..a624a840146 100644 --- a/go/test/endtoend/reparent/plannedreparent/reparent_test.go +++ b/go/test/endtoend/reparent/plannedreparent/reparent_test.go @@ -446,7 +446,7 @@ func TestFullStatus(t *testing.T) { // For a primary tablet there is no replication status assert.Nil(t, primaryStatus.ReplicationStatus) assert.Contains(t, primaryStatus.PrimaryStatus.String(), "vt-0000000101-bin") - assert.Equal(t, primaryStatus.GtidPurged, "MySQL56/") + assert.Equal(t, primaryStatus.GtidPurged, "MySQL/") assert.False(t, primaryStatus.ReadOnly) vtTabletVersion, err := cluster.GetMajorVersion("vttablet") require.NoError(t, err) @@ -484,7 +484,7 @@ func TestFullStatus(t *testing.T) { require.NoError(t, err) assert.NotEmpty(t, replicaStatus.ServerUuid) assert.NotEmpty(t, replicaStatus.ServerId) - assert.Contains(t, replicaStatus.ReplicationStatus.Position, "MySQL56/"+replicaStatus.ReplicationStatus.SourceUuid) + assert.Contains(t, replicaStatus.ReplicationStatus.Position, "MySQL/"+replicaStatus.ReplicationStatus.SourceUuid) assert.EqualValues(t, replication.ReplicationStateRunning, replicaStatus.ReplicationStatus.IoState) assert.EqualValues(t, replication.ReplicationStateRunning, replicaStatus.ReplicationStatus.SqlState) assert.Equal(t, fileNameFromPosition(replicaStatus.ReplicationStatus.FilePosition), fileNameFromPosition(primaryStatus.PrimaryStatus.FilePosition)) @@ -507,7 +507,7 @@ func TestFullStatus(t *testing.T) { assert.EqualValues(t, replicaStatus.ReplicationStatus.SourcePort, tablets[0].MySQLPort) assert.Equal(t, replicaStatus.ReplicationStatus.SourceUser, "vt_repl") assert.Contains(t, replicaStatus.PrimaryStatus.String(), "vt-0000000102-bin") - assert.Equal(t, replicaStatus.GtidPurged, "MySQL56/") + assert.Equal(t, replicaStatus.GtidPurged, "MySQL/") assert.True(t, replicaStatus.ReadOnly) // For all version at or above v17.0.0, each replica will start in super_read_only mode. if vtTabletVersion >= 17 && vtcltlVersion >= 17 { diff --git a/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go b/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go index 60eff73b820..68ea361b979 100644 --- a/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go +++ b/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go @@ -415,7 +415,7 @@ func getTabletPosition(t *testing.T, tablet *cluster.Vttablet) replication.Posit require.NotNil(t, row) gtidExecuted := row.AsString("gtid_executed", "") require.NotEmpty(t, gtidExecuted) - pos, err := replication.DecodePositionDefaultFlavor(gtidExecuted, replication.Mysql56FlavorID) + pos, err := replication.DecodePositionDefaultFlavor(gtidExecuted, replication.MysqlFlavorID) assert.NoError(t, err) return pos } diff --git a/go/vt/binlog/binlog_streamer_rbr_test.go b/go/vt/binlog/binlog_streamer_rbr_test.go index 1678b086719..5e925c79722 100644 --- a/go/vt/binlog/binlog_streamer_rbr_test.go +++ b/go/vt/binlog/binlog_streamer_rbr_test.go @@ -36,7 +36,7 @@ import ( // This file tests the RBR events are parsed correctly. func TestStreamerParseRBREvents(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -286,7 +286,7 @@ func TestStreamerParseRBREvents(t *testing.T) { } func TestStreamerParseRBRNameEscapes(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 diff --git a/go/vt/binlog/binlog_streamer_test.go b/go/vt/binlog/binlog_streamer_test.go index 47be1e27b11..ae6f369411e 100644 --- a/go/vt/binlog/binlog_streamer_test.go +++ b/go/vt/binlog/binlog_streamer_test.go @@ -80,7 +80,7 @@ func sendTestEvents(channel chan<- mysql.BinlogEvent, events []mysql.BinlogEvent } func TestStreamerParseEventsXID(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -142,7 +142,7 @@ func TestStreamerParseEventsXID(t *testing.T) { } func TestStreamerParseEventsCommit(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -242,7 +242,7 @@ func TestStreamerStop(t *testing.T) { } func TestStreamerParseEventsClientEOF(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ @@ -342,7 +342,7 @@ func TestStreamerParseEventsGTIDPurged(t *testing.T) { } func TestStreamerParseEventsSendErrorXID(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ @@ -386,7 +386,7 @@ func TestStreamerParseEventsSendErrorXID(t *testing.T) { } func TestStreamerParseEventsSendErrorCommit(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ @@ -431,7 +431,7 @@ func TestStreamerParseEventsSendErrorCommit(t *testing.T) { } func TestStreamerParseEventsInvalid(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ @@ -472,7 +472,7 @@ func TestStreamerParseEventsInvalid(t *testing.T) { } func TestStreamerParseEventsInvalidFormat(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ @@ -515,7 +515,7 @@ func TestStreamerParseEventsInvalidFormat(t *testing.T) { } func TestStreamerParseEventsNoFormat(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ @@ -558,7 +558,7 @@ func TestStreamerParseEventsNoFormat(t *testing.T) { } func TestStreamerParseEventsInvalidQuery(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ @@ -599,7 +599,7 @@ func TestStreamerParseEventsInvalidQuery(t *testing.T) { } func TestStreamerParseEventsRollback(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -686,7 +686,7 @@ func TestStreamerParseEventsRollback(t *testing.T) { } func TestStreamerParseEventsDMLWithoutBegin(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -759,7 +759,7 @@ func TestStreamerParseEventsDMLWithoutBegin(t *testing.T) { } func TestStreamerParseEventsBeginWithoutCommit(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -835,7 +835,7 @@ func TestStreamerParseEventsBeginWithoutCommit(t *testing.T) { } func TestStreamerParseEventsSetInsertID(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -897,7 +897,7 @@ func TestStreamerParseEventsSetInsertID(t *testing.T) { } func TestStreamerParseEventsInvalidIntVar(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ @@ -940,7 +940,7 @@ func TestStreamerParseEventsInvalidIntVar(t *testing.T) { } func TestStreamerParseEventsOtherDB(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -1003,7 +1003,7 @@ func TestStreamerParseEventsOtherDB(t *testing.T) { } func TestStreamerParseEventsOtherDBBegin(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() s.ServerID = 62344 @@ -1066,7 +1066,7 @@ func TestStreamerParseEventsOtherDBBegin(t *testing.T) { } func TestStreamerParseEventsBeginAgain(t *testing.T) { - f := mysql.NewMySQL56BinlogFormat() + f := mysql.NewMySQLBinlogFormat() s := mysql.NewFakeBinlogStream() input := []mysql.BinlogEvent{ diff --git a/go/vt/binlog/eventtoken/compare_test.go b/go/vt/binlog/eventtoken/compare_test.go index bf638602ded..d76d9372f4e 100644 --- a/go/vt/binlog/eventtoken/compare_test.go +++ b/go/vt/binlog/eventtoken/compare_test.go @@ -140,7 +140,7 @@ func TestFresher(t *testing.T) { ev2: &querypb.EventToken{ Timestamp: 100, Shard: "s1", - Position: "MySQL56/33333333-3333-3333-3333-333333333333:456-789", + Position: "MySQL/33333333-3333-3333-3333-333333333333:456-789", }, expected: -1, }, { @@ -181,40 +181,40 @@ func TestFresher(t *testing.T) { }, expected: 0, }, { - // MySQL56 test cases. + // MySQL test cases. ev1: &querypb.EventToken{ Timestamp: 100, Shard: "s1", - Position: "MySQL56/33333333-3333-3333-3333-333333333333:1-200", + Position: "MySQL/33333333-3333-3333-3333-333333333333:1-200", }, ev2: &querypb.EventToken{ Timestamp: 100, Shard: "s1", - Position: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Position: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, expected: 1, }, { ev1: &querypb.EventToken{ Timestamp: 100, Shard: "s1", - Position: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Position: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, ev2: &querypb.EventToken{ Timestamp: 100, Shard: "s1", - Position: "MySQL56/33333333-3333-3333-3333-333333333333:1-200", + Position: "MySQL/33333333-3333-3333-3333-333333333333:1-200", }, expected: -1, }, { ev1: &querypb.EventToken{ Timestamp: 100, Shard: "s1", - Position: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Position: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, ev2: &querypb.EventToken{ Timestamp: 100, Shard: "s1", - Position: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Position: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, expected: 0, }} diff --git a/go/vt/mysqlctl/backupengine.go b/go/vt/mysqlctl/backupengine.go index cf6065cd733..aeccc0f32c1 100644 --- a/go/vt/mysqlctl/backupengine.go +++ b/go/vt/mysqlctl/backupengine.go @@ -278,7 +278,7 @@ type BackupManifest struct { // Position is the replication position at which the backup was taken. Position replication.Position - // PurgedPosition stands for purged GTIDs, information that is necessary for PITR recovery. This is specific to MySQL56 + // PurgedPosition stands for purged GTIDs, information that is necessary for PITR recovery. This is specific to MySQL PurgedPosition replication.Position // FromPosition is only applicable to incremental backups, and stands for the position from diff --git a/go/vt/mysqlctl/binlogs_gtid.go b/go/vt/mysqlctl/binlogs_gtid.go index 3ea48663578..465bb66d718 100644 --- a/go/vt/mysqlctl/binlogs_gtid.go +++ b/go/vt/mysqlctl/binlogs_gtid.go @@ -71,7 +71,7 @@ func ChooseBinlogsForIncrementalBackup( if err != nil { return nil, "", "", vterrors.Wrapf(err, "cannot get previous gtids for binlog %v", binlog) } - previousGTIDsPos, err := replication.ParsePosition(replication.Mysql56FlavorID, previousGtids) + previousGTIDsPos, err := replication.ParsePosition(replication.MysqlFlavorID, previousGtids) if err != nil { return nil, "", "", vterrors.Wrapf(err, "cannot decode binlog %s position in incremental backup: %v", binlog, previousGTIDsPos) } diff --git a/go/vt/mysqlctl/binlogs_gtid_test.go b/go/vt/mysqlctl/binlogs_gtid_test.go index 655208e908e..ec0bd84d3d2 100644 --- a/go/vt/mysqlctl/binlogs_gtid_test.go +++ b/go/vt/mysqlctl/binlogs_gtid_test.go @@ -271,9 +271,9 @@ func TestChooseBinlogsForIncrementalBackup(t *testing.T) { } for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { - backupPos, err := replication.ParsePosition(replication.Mysql56FlavorID, tc.backupPos) + backupPos, err := replication.ParsePosition(replication.MysqlFlavorID, tc.backupPos) require.NoError(t, err) - gtidPurged, err := replication.ParsePosition(replication.Mysql56FlavorID, tc.gtidPurged) + gtidPurged, err := replication.ParsePosition(replication.MysqlFlavorID, tc.gtidPurged) require.NoError(t, err) binlogsToBackup, fromGTID, toGTID, err := ChooseBinlogsForIncrementalBackup( context.Background(), @@ -308,8 +308,8 @@ func TestChooseBinlogsForIncrementalBackup(t *testing.T) { func TestIsValidIncrementalBakcup(t *testing.T) { incrementalManifest := func(backupPos string, backupFromPos string) *BackupManifest { return &BackupManifest{ - Position: replication.MustParsePosition(replication.Mysql56FlavorID, fmt.Sprintf("16b1039f-22b6-11ed-b765-0a43f95f28a3:%s", backupPos)), - FromPosition: replication.MustParsePosition(replication.Mysql56FlavorID, fmt.Sprintf("16b1039f-22b6-11ed-b765-0a43f95f28a3:%s", backupFromPos)), + Position: replication.MustParsePosition(replication.MysqlFlavorID, fmt.Sprintf("16b1039f-22b6-11ed-b765-0a43f95f28a3:%s", backupPos)), + FromPosition: replication.MustParsePosition(replication.MysqlFlavorID, fmt.Sprintf("16b1039f-22b6-11ed-b765-0a43f95f28a3:%s", backupFromPos)), Incremental: true, } } @@ -385,9 +385,9 @@ func TestIsValidIncrementalBakcup(t *testing.T) { } for i, tc := range tt { t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - basePos, err := replication.ParsePosition(replication.Mysql56FlavorID, tc.baseGTID) + basePos, err := replication.ParsePosition(replication.MysqlFlavorID, tc.baseGTID) require.NoError(t, err) - purgedPos, err := replication.ParsePosition(replication.Mysql56FlavorID, tc.purgedGTID) + purgedPos, err := replication.ParsePosition(replication.MysqlFlavorID, tc.purgedGTID) require.NoError(t, err) isValid := IsValidIncrementalBakcup(basePos.GTIDSet, purgedPos.GTIDSet, incrementalManifest(tc.backupPos, tc.backupFromPos)) assert.Equal(t, tc.expectIsValid, isValid) @@ -397,7 +397,7 @@ func TestIsValidIncrementalBakcup(t *testing.T) { func TestFindPITRPath(t *testing.T) { generatePosition := func(posRange string) replication.Position { - return replication.MustParsePosition(replication.Mysql56FlavorID, fmt.Sprintf("16b1039f-22b6-11ed-b765-0a43f95f28a3:%s", posRange)) + return replication.MustParsePosition(replication.MysqlFlavorID, fmt.Sprintf("16b1039f-22b6-11ed-b765-0a43f95f28a3:%s", posRange)) } fullManifest := func(backupPos string) *BackupManifest { return &BackupManifest{ @@ -587,7 +587,7 @@ func TestFindPITRPath(t *testing.T) { for i := range fullBackups { var err error fullBackup := fullBackups[i] - fullBackup.PurgedPosition, err = replication.ParsePosition(replication.Mysql56FlavorID, tc.purgedGTID) + fullBackup.PurgedPosition, err = replication.ParsePosition(replication.MysqlFlavorID, tc.purgedGTID) require.NoError(t, err) defer func() { fullBackup.PurgedPosition = replication.Position{} @@ -597,7 +597,7 @@ func TestFindPITRPath(t *testing.T) { manifests = append(manifests, fullBackups...) manifests = append(manifests, tc.incrementalBackups...) - restorePos, err := replication.ParsePosition(replication.Mysql56FlavorID, tc.restoreGTID) + restorePos, err := replication.ParsePosition(replication.MysqlFlavorID, tc.restoreGTID) require.NoErrorf(t, err, "%v", err) path, err := FindPITRPath(restorePos.GTIDSet, manifests) if tc.expectError != "" { @@ -626,7 +626,7 @@ func TestFindPITRPath(t *testing.T) { func TestFindPITRToTimePath(t *testing.T) { generatePosition := func(posRange string) replication.Position { - return replication.MustParsePosition(replication.Mysql56FlavorID, fmt.Sprintf("16b1039f-22b6-11ed-b765-0a43f95f28a3:%s", posRange)) + return replication.MustParsePosition(replication.MysqlFlavorID, fmt.Sprintf("16b1039f-22b6-11ed-b765-0a43f95f28a3:%s", posRange)) } fullManifest := func(backupPos string, timeStr string) *BackupManifest { _, err := ParseRFC3339(timeStr) @@ -851,7 +851,7 @@ func TestFindPITRToTimePath(t *testing.T) { for i := range fullBackups { var err error fullBackup := fullBackups[i] - fullBackup.PurgedPosition, err = replication.ParsePosition(replication.Mysql56FlavorID, tc.purgedGTID) + fullBackup.PurgedPosition, err = replication.ParsePosition(replication.MysqlFlavorID, tc.purgedGTID) require.NoError(t, err) defer func() { fullBackup.PurgedPosition = replication.Position{} diff --git a/go/vt/mysqlctl/builtinbackupengine.go b/go/vt/mysqlctl/builtinbackupengine.go index 57f55cefb2f..b6379d63948 100644 --- a/go/vt/mysqlctl/builtinbackupengine.go +++ b/go/vt/mysqlctl/builtinbackupengine.go @@ -214,16 +214,16 @@ func (be *BuiltinBackupEngine) ExecuteBackup(ctx context.Context, params BackupP return be.executeFullBackup(ctx, params, bh) } -// getIncrementalFromPosGTIDSet turns the given string into a valid Mysql56GTIDSet -func getIncrementalFromPosGTIDSet(incrementalFromPos string) (replication.Mysql56GTIDSet, error) { - pos, err := replication.DecodePositionDefaultFlavor(incrementalFromPos, replication.Mysql56FlavorID) +// getIncrementalFromPosGTIDSet turns the given string into a valid MysqlGTIDSet +func getIncrementalFromPosGTIDSet(incrementalFromPos string) (replication.MysqlGTIDSet, error) { + pos, err := replication.DecodePositionDefaultFlavor(incrementalFromPos, replication.MysqlFlavorID) if err != nil { return nil, vterrors.Wrapf(err, "cannot decode position in incremental backup: %v", incrementalFromPos) } - if !pos.MatchesFlavor(replication.Mysql56FlavorID) { + if !pos.MatchesFlavor(replication.MysqlFlavorID) { return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "incremental backup only supports MySQL GTID positions. Got: %v", incrementalFromPos) } - ifPosGTIDSet, ok := pos.GTIDSet.(replication.Mysql56GTIDSet) + ifPosGTIDSet, ok := pos.GTIDSet.(replication.MysqlGTIDSet) if !ok { return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "cannot get MySQL GTID value: %v", pos) } @@ -258,12 +258,12 @@ func (be *BuiltinBackupEngine) executeIncrementalBackup(ctx context.Context, par } // @@gtid_purged - getPurgedGTIDSet := func() (replication.Position, replication.Mysql56GTIDSet, error) { + getPurgedGTIDSet := func() (replication.Position, replication.MysqlGTIDSet, error) { gtidPurged, err := params.Mysqld.GetGTIDPurged(ctx) if err != nil { return gtidPurged, nil, vterrors.Wrap(err, "can't get @@gtid_purged") } - purgedGTIDSet, ok := gtidPurged.GTIDSet.(replication.Mysql56GTIDSet) + purgedGTIDSet, ok := gtidPurged.GTIDSet.(replication.MysqlGTIDSet) if !ok { return gtidPurged, nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "cannot get MySQL GTID purged value: %v", gtidPurged) } @@ -316,11 +316,11 @@ func (be *BuiltinBackupEngine) executeIncrementalBackup(ctx context.Context, par if err != nil { return false, vterrors.Wrapf(err, "cannot get binary logs to backup in incremental backup") } - incrementalBackupFromPosition, err := replication.ParsePosition(replication.Mysql56FlavorID, incrementalBackupFromGTID) + incrementalBackupFromPosition, err := replication.ParsePosition(replication.MysqlFlavorID, incrementalBackupFromGTID) if err != nil { return false, vterrors.Wrapf(err, "cannot parse position %v", incrementalBackupFromGTID) } - incrementalBackupToPosition, err := replication.ParsePosition(replication.Mysql56FlavorID, incrementalBackupToGTID) + incrementalBackupToPosition, err := replication.ParsePosition(replication.MysqlFlavorID, incrementalBackupToGTID) if err != nil { return false, vterrors.Wrapf(err, "cannot parse position %v", incrementalBackupToGTID) } diff --git a/go/vt/mysqlctl/builtinbackupengine_test.go b/go/vt/mysqlctl/builtinbackupengine_test.go index 39e4aa7ae1c..f727d7a8771 100644 --- a/go/vt/mysqlctl/builtinbackupengine_test.go +++ b/go/vt/mysqlctl/builtinbackupengine_test.go @@ -32,7 +32,7 @@ func TestGetIncrementalFromPosGTIDSet(t *testing.T) { expctError bool }{ { - "MySQL56/16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", + "MySQL/16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", "16b1039f-22b6-11ed-b765-0a43f95f28a3:1-615", false, }, @@ -42,12 +42,12 @@ func TestGetIncrementalFromPosGTIDSet(t *testing.T) { false, }, { - "MySQL56/16b1039f-22b6-11ed-b765-0a43f95f28a3", + "MySQL/16b1039f-22b6-11ed-b765-0a43f95f28a3", "", true, }, { - "MySQL56/invalid", + "MySQL/invalid", "", true, }, @@ -76,5 +76,5 @@ func TestShouldDrainForBackupBuiltIn(t *testing.T) { assert.True(t, be.ShouldDrainForBackup(&tabletmanagerdatapb.BackupRequest{})) assert.False(t, be.ShouldDrainForBackup(&tabletmanagerdatapb.BackupRequest{IncrementalFromPos: "auto"})) assert.False(t, be.ShouldDrainForBackup(&tabletmanagerdatapb.BackupRequest{IncrementalFromPos: "99ca8ed4-399c-11ee-861b-0a43f95f28a3:1-197"})) - assert.False(t, be.ShouldDrainForBackup(&tabletmanagerdatapb.BackupRequest{IncrementalFromPos: "MySQL56/99ca8ed4-399c-11ee-861b-0a43f95f28a3:1-197"})) + assert.False(t, be.ShouldDrainForBackup(&tabletmanagerdatapb.BackupRequest{IncrementalFromPos: "MySQL/99ca8ed4-399c-11ee-861b-0a43f95f28a3:1-197"})) } diff --git a/go/vt/mysqlctl/xtrabackupengine_test.go b/go/vt/mysqlctl/xtrabackupengine_test.go index 7a829ce4ba0..f5e8dbf965e 100644 --- a/go/vt/mysqlctl/xtrabackupengine_test.go +++ b/go/vt/mysqlctl/xtrabackupengine_test.go @@ -45,7 +45,7 @@ func TestFindReplicationPosition(t *testing.T) { 190809 00:16:14 completed OK!` want := "145e508e-ae54-11e9-8ce6-46824dd1815e:1-3,1e51f8be-ae54-11e9-a7c6-4280a041109b:1-3,47b59de1-b368-11e9-b48b-624401d35560:1-152981,557def0a-b368-11e9-84ed-f6fffd91cc57:1-3,599ef589-ae55-11e9-9688-ca1f44501925:1-14857169,b9ce485d-b36b-11e9-9b17-2a6e0a6011f4:1-371262" - pos, err := findReplicationPosition(input, "MySQL56", logutil.NewConsoleLogger()) + pos, err := findReplicationPosition(input, "MySQL", logutil.NewConsoleLogger()) if err != nil { t.Fatalf("findReplicationPosition error: %v", err) } @@ -58,7 +58,7 @@ func TestFindReplicationPositionNoMatch(t *testing.T) { // Make sure failure to find a match triggers an error. input := `nothing` - _, err := findReplicationPosition(input, "MySQL56", logutil.NewConsoleLogger()) + _, err := findReplicationPosition(input, "MySQL", logutil.NewConsoleLogger()) if err == nil { t.Fatalf("expected error from findReplicationPosition but got nil") } @@ -70,7 +70,7 @@ func TestFindReplicationPositionEmptyMatch(t *testing.T) { '` - _, err := findReplicationPosition(input, "MySQL56", logutil.NewConsoleLogger()) + _, err := findReplicationPosition(input, "MySQL", logutil.NewConsoleLogger()) if err == nil { t.Fatalf("expected error from findReplicationPosition but got nil") } diff --git a/go/vt/proto/vtgate/vtgate.pb.go b/go/vt/proto/vtgate/vtgate.pb.go index 298b71418d1..5331630a8ca 100644 --- a/go/vt/proto/vtgate/vtgate.pb.go +++ b/go/vt/proto/vtgate/vtgate.pb.go @@ -1168,7 +1168,7 @@ type VStreamRequest struct { TabletType topodata.TabletType `protobuf:"varint,2,opt,name=tablet_type,json=tabletType,proto3,enum=topodata.TabletType" json:"tablet_type,omitempty"` // position specifies the starting point of the bin log positions // as well as the keyspace-shards to pull events from. - // position is of the form 'ks1:0@MySQL56/|ks2:-80@MySQL56/'. + // position is of the form 'ks1:0@MySQL/|ks2:-80@MySQL/'. Vgtid *binlogdata.VGtid `protobuf:"bytes,3,opt,name=vgtid,proto3" json:"vgtid,omitempty"` Filter *binlogdata.Filter `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"` Flags *VStreamFlags `protobuf:"bytes,5,opt,name=flags,proto3" json:"flags,omitempty"` diff --git a/go/vt/vtadmin/cluster/cluster_test.go b/go/vt/vtadmin/cluster/cluster_test.go index 53c3b4f71cd..13c6c8bac44 100644 --- a/go/vt/vtadmin/cluster/cluster_test.go +++ b/go/vt/vtadmin/cluster/cluster_test.go @@ -2778,17 +2778,17 @@ func TestGetShardReplicationPositions(t *testing.T) { "zone1-001": { IoState: int32(replication.ReplicationStateStopped), SqlState: int32(replication.ReplicationStateStopped), - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + Position: "MySQL/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, "zone1-002": { // Note: in reality other fields will be set on replicating hosts as well, but this is sufficient to illustrate in the testing. IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning), - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + Position: "MySQL/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, "zone1-003": { IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning), - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + Position: "MySQL/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, }, TabletMap: map[string]*topodatapb.Tablet{ @@ -2841,17 +2841,17 @@ func TestGetShardReplicationPositions(t *testing.T) { "zone1-001": { IoState: int32(replication.ReplicationStateStopped), SqlState: int32(replication.ReplicationStateStopped), - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + Position: "MySQL/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, "zone1-002": { IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning), - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + Position: "MySQL/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, "zone1-003": { IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning), - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + Position: "MySQL/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, }, TabletMap: map[string]*topodatapb.Tablet{ diff --git a/go/vt/vtctl/grpcvtctldserver/server_slow_test.go b/go/vt/vtctl/grpcvtctldserver/server_slow_test.go index c2625925867..2d1923c0801 100644 --- a/go/vt/vtctl/grpcvtctldserver/server_slow_test.go +++ b/go/vt/vtctl/grpcvtctldserver/server_slow_test.go @@ -106,7 +106,7 @@ func TestEmergencyReparentShardSlow(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -147,18 +147,18 @@ func TestEmergencyReparentShardSlow(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, }, "zone1-0000000200": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, }, }, }, @@ -223,7 +223,7 @@ func TestEmergencyReparentShardSlow(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -264,18 +264,18 @@ func TestEmergencyReparentShardSlow(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, }, "zone1-0000000200": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, }, }, }, diff --git a/go/vt/vtctl/grpcvtctldserver/server_test.go b/go/vt/vtctl/grpcvtctldserver/server_test.go index 3e934141ff5..15a78753320 100644 --- a/go/vt/vtctl/grpcvtctldserver/server_test.go +++ b/go/vt/vtctl/grpcvtctldserver/server_test.go @@ -4467,7 +4467,7 @@ func TestEmergencyReparentShard(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -4505,18 +4505,18 @@ func TestEmergencyReparentShard(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, }, "zone1-0000000200": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5": nil, }, }, }, diff --git a/go/vt/vtctl/reparentutil/emergency_reparenter_test.go b/go/vt/vtctl/reparentutil/emergency_reparenter_test.go index d7f8bb6a1db..498d88db6ff 100644 --- a/go/vt/vtctl/reparentutil/emergency_reparenter_test.go +++ b/go/vt/vtctl/reparentutil/emergency_reparenter_test.go @@ -166,7 +166,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -175,7 +175,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -184,20 +184,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, }, @@ -283,7 +283,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -292,7 +292,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -301,7 +301,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, @@ -314,13 +314,13 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, }, @@ -428,7 +428,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -437,7 +437,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -446,20 +446,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, }, }, @@ -517,7 +517,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -557,7 +557,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -566,17 +566,17 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, }, @@ -770,7 +770,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -779,7 +779,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -864,7 +864,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -873,7 +873,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -882,7 +882,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -892,13 +892,13 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": assert.AnError, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": assert.AnError, }, }, }, @@ -959,7 +959,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -968,7 +968,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -977,20 +977,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, }, }, @@ -1065,7 +1065,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", Error: nil, }, "zone1-0000000102": { @@ -1081,7 +1081,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1090,7 +1090,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-20", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-20", }, }, }, @@ -1099,21 +1099,21 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-20", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-20", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-20": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-20": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-20": nil, - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-20": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, }, }, @@ -1194,7 +1194,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1203,7 +1203,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1212,20 +1212,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, }, SetReplicationSourceResults: map[string]error{ @@ -1317,7 +1317,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1326,7 +1326,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1335,20 +1335,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, }, @@ -1437,7 +1437,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1446,7 +1446,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1455,20 +1455,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, }, @@ -1552,7 +1552,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1561,7 +1561,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1570,20 +1570,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, }, @@ -1685,7 +1685,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1694,7 +1694,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1703,20 +1703,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, }, @@ -1817,7 +1817,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1826,7 +1826,7 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -1835,20 +1835,20 @@ func TestEmergencyReparenter_reparentShardLocked(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, }, @@ -2775,7 +2775,7 @@ func TestEmergencyReparenterStats(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -2784,7 +2784,7 @@ func TestEmergencyReparenterStats(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21", }, }, }, @@ -2793,20 +2793,20 @@ func TestEmergencyReparenterStats(t *testing.T) { Before: &replicationdatapb.Status{IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26", }, }, }, }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000100": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000101": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-21": nil, }, "zone1-0000000102": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-26": nil, }, }, } @@ -2897,35 +2897,35 @@ func TestEmergencyReparenterStats(t *testing.T) { func TestEmergencyReparenter_findMostAdvanced(t *testing.T) { sid1 := replication.SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} - mysqlGTID1 := replication.Mysql56GTID{ + mysqlGTID1 := replication.MysqlGTID{ Server: sid1, Sequence: 9, } - mysqlGTID2 := replication.Mysql56GTID{ + mysqlGTID2 := replication.MysqlGTID{ Server: sid1, Sequence: 10, } - mysqlGTID3 := replication.Mysql56GTID{ + mysqlGTID3 := replication.MysqlGTID{ Server: sid1, Sequence: 11, } - positionMostAdvanced := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionMostAdvanced := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID1) positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID2) positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID3) - positionIntermediate1 := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionIntermediate1 := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionIntermediate1.GTIDSet = positionIntermediate1.GTIDSet.AddGTID(mysqlGTID1) - positionIntermediate2 := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionIntermediate2 := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionIntermediate2.GTIDSet = positionIntermediate2.GTIDSet.AddGTID(mysqlGTID1) positionIntermediate2.GTIDSet = positionIntermediate2.GTIDSet.AddGTID(mysqlGTID2) - positionOnly2 := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionOnly2 := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionOnly2.GTIDSet = positionOnly2.GTIDSet.AddGTID(mysqlGTID2) - positionEmpty := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionEmpty := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} tests := []struct { name string diff --git a/go/vt/vtctl/reparentutil/planned_reparenter_flaky_test.go b/go/vt/vtctl/reparentutil/planned_reparenter_flaky_test.go index c564a95167e..d99c917fff5 100644 --- a/go/vt/vtctl/reparentutil/planned_reparenter_flaky_test.go +++ b/go/vt/vtctl/reparentutil/planned_reparenter_flaky_test.go @@ -207,7 +207,7 @@ func TestPlannedReparenter_ReparentShard(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, PromoteReplicaResults: map[string]struct { @@ -625,12 +625,12 @@ func TestPlannedReparenter_preflightChecks(t *testing.T) { }{ "zone1-0000000100": { // most advanced position Position: &replicationdatapb.Status{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, "zone1-0000000101": { Position: &replicationdatapb.Status{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -881,12 +881,12 @@ func TestPlannedReparenter_preflightChecks(t *testing.T) { }{ "zone1-0000000100": { // most advanced position Position: &replicationdatapb.Status{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, "zone1-0000000101": { Position: &replicationdatapb.Status{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -1039,7 +1039,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1113,7 +1113,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1149,7 +1149,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceDelays: map[string]time.Duration{ @@ -1190,7 +1190,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1235,7 +1235,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1286,7 +1286,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1342,7 +1342,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1399,7 +1399,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1459,7 +1459,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1521,7 +1521,7 @@ func TestPlannedReparenter_performGracefulPromotion(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, }, SetReplicationSourceResults: map[string]error{ @@ -1951,19 +1951,19 @@ func TestPlannedReparenter_performPotentialPromotion(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, "zone1-0000000101": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, "zone1-0000000102": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, Error: nil, }, @@ -2052,7 +2052,7 @@ func TestPlannedReparenter_performPotentialPromotion(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, @@ -2089,7 +2089,7 @@ func TestPlannedReparenter_performPotentialPromotion(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/this-is-nonsense", + Position: "MySQL/this-is-nonsense", }, Error: nil, }, @@ -2140,19 +2140,19 @@ func TestPlannedReparenter_performPotentialPromotion(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, "zone1-0000000101": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, "zone1-0000000102": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10000", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10000", }, Error: nil, }, @@ -2204,19 +2204,19 @@ func TestPlannedReparenter_performPotentialPromotion(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, "zone1-0000000101": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, "zone1-0000000102": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, @@ -2340,13 +2340,13 @@ func TestPlannedReparenter_reparentShardLocked(t *testing.T) { }{ "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, "zone1-0000000200": { Status: &replicationdatapb.PrimaryStatus{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, @@ -2518,7 +2518,7 @@ func TestPlannedReparenter_reparentShardLocked(t *testing.T) { "zone1-0000000100": { Status: &replicationdatapb.PrimaryStatus{ // a few more transactions happen after waiting for replication - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10", }, Error: nil, }, @@ -2540,7 +2540,7 @@ func TestPlannedReparenter_reparentShardLocked(t *testing.T) { Error error }{ "zone1-0000000100": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-8", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-8", Error: nil, }, }, @@ -2562,7 +2562,7 @@ func TestPlannedReparenter_reparentShardLocked(t *testing.T) { }, WaitForPositionResults: map[string]map[string]error{ "zone1-0000000200": { - "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10": nil, + "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-10": nil, }, }, }, @@ -2718,7 +2718,7 @@ func TestPlannedReparenter_reparentShardLocked(t *testing.T) { }{ "zone1-0000000200": { Position: &replicationdatapb.Status{ - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-2", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-2", }, }, "zone1-0000000100": { diff --git a/go/vt/vtctl/reparentutil/reparent_sorter_test.go b/go/vt/vtctl/reparentutil/reparent_sorter_test.go index c21c95ad22b..8242383da47 100644 --- a/go/vt/vtctl/reparentutil/reparent_sorter_test.go +++ b/go/vt/vtctl/reparentutil/reparent_sorter_test.go @@ -61,30 +61,30 @@ func TestReparentSorter(t *testing.T) { Type: topodatapb.TabletType_RDONLY, } - mysqlGTID1 := replication.Mysql56GTID{ + mysqlGTID1 := replication.MysqlGTID{ Server: sid1, Sequence: 9, } - mysqlGTID2 := replication.Mysql56GTID{ + mysqlGTID2 := replication.MysqlGTID{ Server: sid2, Sequence: 10, } - mysqlGTID3 := replication.Mysql56GTID{ + mysqlGTID3 := replication.MysqlGTID{ Server: sid1, Sequence: 11, } - positionMostAdvanced := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionMostAdvanced := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID1) positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID2) positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID3) - positionEmpty := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionEmpty := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} - positionIntermediate1 := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionIntermediate1 := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionIntermediate1.GTIDSet = positionIntermediate1.GTIDSet.AddGTID(mysqlGTID1) - positionIntermediate2 := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionIntermediate2 := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionIntermediate2.GTIDSet = positionIntermediate2.GTIDSet.AddGTID(mysqlGTID1) positionIntermediate2.GTIDSet = positionIntermediate2.GTIDSet.AddGTID(mysqlGTID2) diff --git a/go/vt/vtctl/reparentutil/replication.go b/go/vt/vtctl/reparentutil/replication.go index 9b33a5b0536..217e6fa51c4 100644 --- a/go/vt/vtctl/reparentutil/replication.go +++ b/go/vt/vtctl/reparentutil/replication.go @@ -64,7 +64,7 @@ func FindValidEmergencyReparentCandidates( ) for alias, status := range replicationStatusMap { - if _, ok := status.RelayLogPosition.GTIDSet.(replication.Mysql56GTIDSet); ok { + if _, ok := status.RelayLogPosition.GTIDSet.(replication.MysqlGTIDSet); ok { isGTIDBased = true } else { isNonGTIDBased = true @@ -99,9 +99,9 @@ func FindValidEmergencyReparentCandidates( // This condition should really never happen, since we did the same cast // in the earlier loop, but let's be doubly sure. - relayLogGTIDSet, ok := status.RelayLogPosition.GTIDSet.(replication.Mysql56GTIDSet) + relayLogGTIDSet, ok := status.RelayLogPosition.GTIDSet.(replication.MysqlGTIDSet) if !ok { - return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "we got a filled-in relay log position, but it's not of type Mysql56GTIDSet, even though we've determined we need to use GTID based assesment") + return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "we got a filled-in relay log position, but it's not of type MysqlGTIDSet, even though we've determined we need to use GTID based assesment") } // We need to remove this alias's status from the list, otherwise the diff --git a/go/vt/vtctl/reparentutil/replication_test.go b/go/vt/vtctl/reparentutil/replication_test.go index b7a2bcb07e7..9c524f2772a 100644 --- a/go/vt/vtctl/reparentutil/replication_test.go +++ b/go/vt/vtctl/reparentutil/replication_test.go @@ -73,19 +73,19 @@ func TestFindValidEmergencyReparentCandidates(t *testing.T) { "r1": { After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, "r2": { After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, primaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{ "p1": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, expected: []string{"r1", "r2", "p1"}, @@ -96,7 +96,7 @@ func TestFindValidEmergencyReparentCandidates(t *testing.T) { "r1": { After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5,AAAAAAAA-71CA-11E1-9E33-C80AA9429562:1", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5,AAAAAAAA-71CA-11E1-9E33-C80AA9429562:1", }, }, }, @@ -110,7 +110,7 @@ func TestFindValidEmergencyReparentCandidates(t *testing.T) { "r1": { After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, "r2": { @@ -129,7 +129,7 @@ func TestFindValidEmergencyReparentCandidates(t *testing.T) { "r1": { After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, "r2": { @@ -166,19 +166,19 @@ func TestFindValidEmergencyReparentCandidates(t *testing.T) { "r1": { After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, "errant": { After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5,AAAAAAAA-71CA-11E1-9E33-C80AA9429562:1", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5,AAAAAAAA-71CA-11E1-9E33-C80AA9429562:1", }, }, }, primaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{ "p1": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, expected: []string{"r1", "p1"}, @@ -190,7 +190,7 @@ func TestFindValidEmergencyReparentCandidates(t *testing.T) { "r1": { After: &replicationdatapb.Status{ SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -318,14 +318,14 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }{ "zone1-0000000100": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -353,12 +353,12 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000100": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedPrimaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{}, @@ -386,14 +386,14 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }{ "zone1-0000000100": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -421,12 +421,12 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000100": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedPrimaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{}, @@ -455,14 +455,14 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }{ "zone1-0000000100": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -505,12 +505,12 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000100": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedPrimaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{}, @@ -540,14 +540,14 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }{ "zone1-0000000100": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, "zone1-0000000102": { @@ -599,12 +599,12 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000100": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedPrimaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{}, @@ -633,14 +633,14 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }{ "zone1-0000000100": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, "zone1-0000000102": { @@ -692,12 +692,12 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000100": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedPrimaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{}, @@ -726,14 +726,14 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }{ "zone1-0000000100": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -761,8 +761,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string]("zone1-0000000100"), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedTabletsReachable: []*topodatapb.Tablet{{ @@ -800,8 +800,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -829,8 +829,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedPrimaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{ @@ -874,8 +874,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -903,8 +903,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedPrimaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{}, // zone1-0000000100 fails to demote, so does not appear @@ -983,14 +983,14 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }{ "zone1-0000000100": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -1019,8 +1019,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedTabletsReachable: []*topodatapb.Tablet{{ @@ -1046,8 +1046,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -1075,8 +1075,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, expectedPrimaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{}, @@ -1143,8 +1143,8 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5"}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5"}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, }, @@ -1188,20 +1188,20 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { }{ "zone1-0000000100": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, }, "zone1-0000000101": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, }, "zone1-0000000102": { StopStatus: &replicationdatapb.StopReplicationStatus{ - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429102:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429102:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429102:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429102:1-9"}, }, }, }, @@ -1242,16 +1242,16 @@ func Test_stopReplicationAndBuildStatusMaps(t *testing.T) { ignoredTablets: sets.New[string](), expectedStatusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000100": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429100:1-9"}, }, "zone1-0000000101": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429101:1-9"}, }, "zone1-0000000102": { - Before: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429102:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, - After: &replicationdatapb.Status{Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429102:1-9"}, + Before: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429102:1-5", IoState: int32(replication.ReplicationStateRunning), SqlState: int32(replication.ReplicationStateRunning)}, + After: &replicationdatapb.Status{Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429102:1-9"}, }, }, expectedTabletsReachable: []*topodatapb.Tablet{{ diff --git a/go/vt/vtctl/reparentutil/util_test.go b/go/vt/vtctl/reparentutil/util_test.go index 8e48bbb3303..1f3d54d20d3 100644 --- a/go/vt/vtctl/reparentutil/util_test.go +++ b/go/vt/vtctl/reparentutil/util_test.go @@ -82,10 +82,10 @@ func TestChooseNewPrimary(t *testing.T) { // zone1-101 is behind zone1-102 and zone1-102 has a tolerable replication lag replicationStatuses: map[string]*replicationdatapb.Status{ "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", }, "zone1-0000000102": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", ReplicationLagSeconds: 20, }, }, @@ -142,10 +142,10 @@ func TestChooseNewPrimary(t *testing.T) { // zone1-101 is behind zone1-102 and we don't care about the replication lag replicationStatuses: map[string]*replicationdatapb.Status{ "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", }, "zone1-0000000102": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", ReplicationLagSeconds: 230, }, }, @@ -202,10 +202,10 @@ func TestChooseNewPrimary(t *testing.T) { // zone1-101 is behind zone1-102 replicationStatuses: map[string]*replicationdatapb.Status{ "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", }, "zone1-0000000102": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", ReplicationLagSeconds: 232, }, }, @@ -263,11 +263,11 @@ func TestChooseNewPrimary(t *testing.T) { // since the relay log position for zone1-102 is more advanced replicationStatuses: map[string]*replicationdatapb.Status{ "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-2", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-2", }, "zone1-0000000102": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", - RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + RelayLogPosition: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -321,7 +321,7 @@ func TestChooseNewPrimary(t *testing.T) { tmc: &chooseNewPrimaryTestTMClient{ replicationStatuses: map[string]*replicationdatapb.Status{ "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", }, }, }, @@ -361,7 +361,7 @@ func TestChooseNewPrimary(t *testing.T) { tmc: &chooseNewPrimaryTestTMClient{ replicationStatuses: map[string]*replicationdatapb.Status{ "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", }, }, }, @@ -405,7 +405,7 @@ func TestChooseNewPrimary(t *testing.T) { Position: "", }, "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", }, }, }, @@ -443,10 +443,10 @@ func TestChooseNewPrimary(t *testing.T) { // zone1-101 is behind zone1-102 replicationStatuses: map[string]*replicationdatapb.Status{ "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", }, "zone1-0000000102": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -498,10 +498,10 @@ func TestChooseNewPrimary(t *testing.T) { // zone1-101 is behind zone1-102 replicationStatuses: map[string]*replicationdatapb.Status{ "zone1-0000000101": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1", }, "zone1-0000000102": { - Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", + Position: "MySQL/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5", }, }, }, @@ -600,7 +600,7 @@ func TestFindPositionForTablet(t *testing.T) { }{ "zone1-0000000100": { Position: &replicationdatapb.Status{ - Position: "MySQL56/3e11fa47-71ca-11e1-9e33-c80aa9429562:1-5", + Position: "MySQL/3e11fa47-71ca-11e1-9e33-c80aa9429562:1-5", ReplicationLagSeconds: 201, }, }, @@ -613,7 +613,7 @@ func TestFindPositionForTablet(t *testing.T) { }, }, expectedLag: 201 * time.Second, - expectedPosition: "MySQL56/3e11fa47-71ca-11e1-9e33-c80aa9429562:1-5", + expectedPosition: "MySQL/3e11fa47-71ca-11e1-9e33-c80aa9429562:1-5", }, { name: "no replication status", tmc: &testutil.TabletManagerClient{ @@ -644,7 +644,7 @@ func TestFindPositionForTablet(t *testing.T) { "zone1-0000000100": { Position: &replicationdatapb.Status{ Position: "unused", - RelayLogPosition: "MySQL56/3e11fa47-71ca-11e1-9e33-c80aa9429562:1-5", + RelayLogPosition: "MySQL/3e11fa47-71ca-11e1-9e33-c80aa9429562:1-5", ReplicationLagSeconds: 291, }, }, @@ -657,7 +657,7 @@ func TestFindPositionForTablet(t *testing.T) { }, }, expectedLag: 291 * time.Second, - expectedPosition: "MySQL56/3e11fa47-71ca-11e1-9e33-c80aa9429562:1-5", + expectedPosition: "MySQL/3e11fa47-71ca-11e1-9e33-c80aa9429562:1-5", }, { name: "error in parsing position", tmc: &testutil.TabletManagerClient{ @@ -869,28 +869,28 @@ func TestFindCurrentPrimary(t *testing.T) { func TestGetValidCandidatesAndPositionsAsList(t *testing.T) { sid1 := replication.SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} - mysqlGTID1 := replication.Mysql56GTID{ + mysqlGTID1 := replication.MysqlGTID{ Server: sid1, Sequence: 9, } - mysqlGTID2 := replication.Mysql56GTID{ + mysqlGTID2 := replication.MysqlGTID{ Server: sid1, Sequence: 10, } - mysqlGTID3 := replication.Mysql56GTID{ + mysqlGTID3 := replication.MysqlGTID{ Server: sid1, Sequence: 11, } - positionMostAdvanced := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionMostAdvanced := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID1) positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID2) positionMostAdvanced.GTIDSet = positionMostAdvanced.GTIDSet.AddGTID(mysqlGTID3) - positionIntermediate1 := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionIntermediate1 := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionIntermediate1.GTIDSet = positionIntermediate1.GTIDSet.AddGTID(mysqlGTID1) - positionIntermediate2 := replication.Position{GTIDSet: replication.Mysql56GTIDSet{}} + positionIntermediate2 := replication.Position{GTIDSet: replication.MysqlGTIDSet{}} positionIntermediate2.GTIDSet = positionIntermediate2.GTIDSet.AddGTID(mysqlGTID1) positionIntermediate2.GTIDSet = positionIntermediate2.GTIDSet.AddGTID(mysqlGTID2) diff --git a/go/vt/vtctl/vdiff2_test.go b/go/vt/vtctl/vdiff2_test.go index 1348cd06448..843b7ab118c 100644 --- a/go/vt/vtctl/vdiff2_test.go +++ b/go/vt/vtctl/vdiff2_test.go @@ -280,8 +280,8 @@ func TestVDiff2Sharded(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() env := newTestVDiffEnv(t, ctx, []string{"-40", "40-"}, []string{"-80", "80-"}, "", map[string]string{ - "-80": "MySQL56/0e45e704-7cb9-11ed-a1eb-0242ac120002:1-890", - "80-": "MySQL56/1497ddb0-7cb9-11ed-a1eb-0242ac120002:1-891", + "-80": "MySQL/0e45e704-7cb9-11ed-a1eb-0242ac120002:1-890", + "80-": "MySQL/1497ddb0-7cb9-11ed-a1eb-0242ac120002:1-891", }) defer env.close() diff --git a/go/vt/vtctl/vdiff_env_test.go b/go/vt/vtctl/vdiff_env_test.go index b5324e7bd6e..35d52d35d74 100644 --- a/go/vt/vtctl/vdiff_env_test.go +++ b/go/vt/vtctl/vdiff_env_test.go @@ -44,13 +44,13 @@ import ( const ( // vdiffStopPosition is the default stop position for the target vreplication. // It can be overridden with the positions argument to newTestVDiffEnv. - vdiffStopPosition = "MySQL56/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-892" + vdiffStopPosition = "MySQL/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-892" // vdiffSourceGtid should be the position reported by the source side VStreamResults. // It's expected to be higher the vdiffStopPosition. - vdiffSourceGtid = "MySQL56/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-893" + vdiffSourceGtid = "MySQL/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-893" // vdiffTargetPrimaryPosition is the primary position of the target after // vreplication has been synchronized. - vdiffTargetPrimaryPosition = "MySQL56/e34d6fb6-7cbf-11ed-a1eb-0242ac120002:1-892" + vdiffTargetPrimaryPosition = "MySQL/e34d6fb6-7cbf-11ed-a1eb-0242ac120002:1-892" ) type testVDiffEnv struct { diff --git a/go/vt/vtctl/vtctl_test.go b/go/vt/vtctl/vtctl_test.go index 92c1cb6549e..973651194f8 100644 --- a/go/vt/vtctl/vtctl_test.go +++ b/go/vt/vtctl/vtctl_test.go @@ -352,7 +352,7 @@ func TestMoveTables(t *testing.T) { sqltypes.MakeTestResult(sqltypes.MakeTestFields( "id|source|pos|stop_pos|max_replication_lag|state|db_name|time_updated|transaction_timestamp|time_heartbeat|time_throttled|component_throttled|message|tags|workflow_type|workflow_sub_type|defer_secondary_keys|rows_copied", "int64|varchar|varchar|varchar|int64|varchar|varchar|int64|int64|int64|int64|int64|varchar|varchar|varchar|int64|int64|int64|int64"), - fmt.Sprintf("%d|%s|MySQL56/4ec30b1e-8ee2-11ed-a1eb-0242ac120002:1-15||0|Running|vt_%s|%d|%d|%d|0||||%d|%d|0", + fmt.Sprintf("%d|%s|MySQL/4ec30b1e-8ee2-11ed-a1eb-0242ac120002:1-15||0|Running|vt_%s|%d|%d|%d|0||||%d|%d|0", vrID, bls, sourceKs, now, now, now, binlogdatapb.VReplicationWorkflowType_MoveTables, binlogdatapb.VReplicationWorkflowSubType_None), ), ) diff --git a/go/vt/vtctl/workflow/materializer_test.go b/go/vt/vtctl/workflow/materializer_test.go index 57e0a7fcf95..549bd426ac4 100644 --- a/go/vt/vtctl/workflow/materializer_test.go +++ b/go/vt/vtctl/workflow/materializer_test.go @@ -80,7 +80,7 @@ var ( "id|workflow|source|pos|stop_pos|max_replication_log|state|db_name|time_updated|transaction_timestamp|message|tags|workflow_type|workflow_sub_type|time_heartbeat|defer_secondary_keys|component_throttled|time_throttled|rows_copied", "int64|varchar|blob|varchar|varchar|int64|varchar|varchar|int64|int64|varchar|varchar|int64|int64|int64|int64|varchar|int64|int64", ), - fmt.Sprintf("1|wf1|%s|MySQL56/9d10e6ec-07a0-11ee-ae73-8e53f4cf3083:1-97|NULL|0|running|vt_ks|1686577659|0|||1|0|0|0||0|10", binlogSource), + fmt.Sprintf("1|wf1|%s|MySQL/9d10e6ec-07a0-11ee-ae73-8e53f4cf3083:1-97|NULL|0|running|vt_ks|1686577659|0|||1|0|0|0||0|10", binlogSource), ) ) diff --git a/go/vt/vttablet/tabletmanager/framework_test.go b/go/vt/vttablet/tabletmanager/framework_test.go index 4734ab9ee96..1286d37e0e4 100644 --- a/go/vt/vttablet/tabletmanager/framework_test.go +++ b/go/vt/vttablet/tabletmanager/framework_test.go @@ -49,7 +49,7 @@ import ( ) const ( - gtidFlavor = "MySQL56" + gtidFlavor = "MySQL" gtidPosition = "16b1039f-22b6-11ed-b765-0a43f95f28a3:1-220" ) diff --git a/go/vt/vttablet/tabletmanager/vdiff/framework_test.go b/go/vt/vttablet/tabletmanager/vdiff/framework_test.go index 0676c5204be..87fb6dd6680 100644 --- a/go/vt/vttablet/tabletmanager/vdiff/framework_test.go +++ b/go/vt/vttablet/tabletmanager/vdiff/framework_test.go @@ -60,7 +60,7 @@ const ( vdiffDBName = "vttest" // vdiffSourceGtid should be the position reported by the source side VStreamResults. - vdiffSourceGtid = "MySQL56/f69ed286-6909-11ed-8342-0a50724f3211:1-110" + vdiffSourceGtid = "MySQL/f69ed286-6909-11ed-8342-0a50724f3211:1-110" vdiffTargetPrimaryPosition = vdiffSourceGtid ) @@ -577,7 +577,7 @@ func newTestVDiffEnv(t *testing.T) *testVDiffEnv { // But this is one statement per stream. vdiffenv.tmc.setVRResults( primary.tablet, - "/update _vt.vreplication set state='Running', stop_pos='MySQL56/.*', message='synchronizing for vdiff' where id=1", + "/update _vt.vreplication set state='Running', stop_pos='MySQL/.*', message='synchronizing for vdiff' where id=1", noResults, ) diff --git a/go/vt/vttablet/tabletmanager/vreplication/journal_test.go b/go/vt/vttablet/tabletmanager/vreplication/journal_test.go index b9dc716d56f..29c504e1e70 100644 --- a/go/vt/vttablet/tabletmanager/vreplication/journal_test.go +++ b/go/vt/vttablet/tabletmanager/vreplication/journal_test.go @@ -64,7 +64,7 @@ func TestJournalOneToOne(t *testing.T) { ShardGtids: []*binlogdatapb.ShardGtid{{ Keyspace: "other_keyspace", Shard: "0", - Gtid: "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10", + Gtid: "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10", }}, } query := fmt.Sprintf("insert into _vt.resharding_journal(id, db_name, val) values (1, 'vttest', %v)", encodeString(journal.String())) @@ -73,7 +73,7 @@ func TestJournalOneToOne(t *testing.T) { expectDBClientQueries(t, qh.Expect( "begin", - `/insert into _vt.vreplication.*workflow, source, pos.*values.*'test', 'keyspace:\\"other_keyspace\\" shard:\\"0\\.*'MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10'`, + `/insert into _vt.vreplication.*workflow, source, pos.*values.*'test', 'keyspace:\\"other_keyspace\\" shard:\\"0\\.*'MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10'`, fmt.Sprintf("delete from _vt.vreplication where id=%d", firstID), "commit", "/update _vt.vreplication set message='Picked source tablet.*", @@ -124,11 +124,11 @@ func TestJournalOneToMany(t *testing.T) { ShardGtids: []*binlogdatapb.ShardGtid{{ Keyspace: "other_keyspace", Shard: "-80", - Gtid: "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-5", + Gtid: "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-5", }, { Keyspace: "other_keyspace", Shard: "80-", - Gtid: "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:5-10", + Gtid: "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:5-10", }}, } query := fmt.Sprintf("insert into _vt.resharding_journal(id, db_name, val) values (1, 'vttest', %v)", encodeString(journal.String())) @@ -137,8 +137,8 @@ func TestJournalOneToMany(t *testing.T) { expectDBClientQueries(t, qh.Expect( "begin", - `/insert into _vt.vreplication.*workflow, source, pos.*values.*'test', 'keyspace:\\"other_keyspace\\" shard:\\"-80\\.*'MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-5'`, - `/insert into _vt.vreplication.*workflow, source, pos.*values.*'test', 'keyspace:\\"other_keyspace\\" shard:\\"80-\\.*'MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:5-10'`, + `/insert into _vt.vreplication.*workflow, source, pos.*values.*'test', 'keyspace:\\"other_keyspace\\" shard:\\"-80\\.*'MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-5'`, + `/insert into _vt.vreplication.*workflow, source, pos.*values.*'test', 'keyspace:\\"other_keyspace\\" shard:\\"80-\\.*'MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:5-10'`, fmt.Sprintf("delete from _vt.vreplication where id=%d", firstID), "commit", "/update _vt.vreplication set message='Picked source tablet.*", @@ -190,7 +190,7 @@ func TestJournalTablePresent(t *testing.T) { ShardGtids: []*binlogdatapb.ShardGtid{{ Keyspace: "other_keyspace", Shard: "0", - Gtid: "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10", + Gtid: "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10", }}, } query := fmt.Sprintf("insert into _vt.resharding_journal(id, db_name, val) values (1, 'vttest', %v)", encodeString(journal.String())) @@ -199,7 +199,7 @@ func TestJournalTablePresent(t *testing.T) { expectDBClientQueries(t, qh.Expect( "begin", - `/insert into _vt.vreplication.*workflow, source, pos.*values.*'test', 'keyspace:\\"other_keyspace\\" shard:\\"0\\.*'MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10'`, + `/insert into _vt.vreplication.*workflow, source, pos.*values.*'test', 'keyspace:\\"other_keyspace\\" shard:\\"0\\.*'MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10'`, fmt.Sprintf("delete from _vt.vreplication where id=%d", firstID), "commit", "/update _vt.vreplication set message='Picked source tablet.*", @@ -250,7 +250,7 @@ func TestJournalTableNotPresent(t *testing.T) { ShardGtids: []*binlogdatapb.ShardGtid{{ Keyspace: "other_keyspace", Shard: "0", - Gtid: "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10", + Gtid: "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10", }}, } query := fmt.Sprintf("insert into _vt.resharding_journal(id, db_name, val) values (1, 'vttest', %v)", encodeString(journal.String())) @@ -306,7 +306,7 @@ func TestJournalTableMixed(t *testing.T) { ShardGtids: []*binlogdatapb.ShardGtid{{ Keyspace: "other_keyspace", Shard: "0", - Gtid: "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10", + Gtid: "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10", }}, } query := fmt.Sprintf("insert into _vt.resharding_journal(id, db_name, val) values (1, 'vttest', %v)", encodeString(journal.String())) diff --git a/go/vt/vttablet/tabletmanager/vreplication/vplayer_flaky_test.go b/go/vt/vttablet/tabletmanager/vreplication/vplayer_flaky_test.go index 04738ee7857..15c8a33f855 100644 --- a/go/vt/vttablet/tabletmanager/vreplication/vplayer_flaky_test.go +++ b/go/vt/vttablet/tabletmanager/vreplication/vplayer_flaky_test.go @@ -1827,10 +1827,10 @@ func TestGTIDCompress(t *testing.T) { } testCases := []testCase{ - {"cleartext1", "MySQL56/14b68925-696a-11ea-aee7-fec597a91f5e:1-308092", false}, - {"cleartext2", "MySQL56/14b68925-696a-11ea-aee7-fec597a91f5e:1-308092,320a5e98-6965-11ea-b949-eeafd34ae6e4:1-3,81cbdbf8-6969-11ea-aeb1-a6143b021f67:1-524891956,c9a0f301-6965-11ea-ba9d-02c229065569:1-3,cb698dac-6969-11ea-ac38-16e5d0ac5c3a:1-524441991,e39fca4d-6960-11ea-b4c2-1e895fd49fa0:1-3", false}, - {"compress1", "MySQL56/14b68925-696a-11ea-aee7-fec597a91f5e:1-308092", true}, - {"compress2", "MySQL56/14b68925-696a-11ea-aee7-fec597a91f5e:1-308092,320a5e98-6965-11ea-b949-eeafd34ae6e4:1-3,81cbdbf8-6969-11ea-aeb1-a6143b021f67:1-524891956,c9a0f301-6965-11ea-ba9d-02c229065569:1-3,cb698dac-6969-11ea-ac38-16e5d0ac5c3a:1-524441991,e39fca4d-6960-11ea-b4c2-1e895fd49fa0:1-3", true}, + {"cleartext1", "MySQL/14b68925-696a-11ea-aee7-fec597a91f5e:1-308092", false}, + {"cleartext2", "MySQL/14b68925-696a-11ea-aee7-fec597a91f5e:1-308092,320a5e98-6965-11ea-b949-eeafd34ae6e4:1-3,81cbdbf8-6969-11ea-aeb1-a6143b021f67:1-524891956,c9a0f301-6965-11ea-ba9d-02c229065569:1-3,cb698dac-6969-11ea-ac38-16e5d0ac5c3a:1-524441991,e39fca4d-6960-11ea-b4c2-1e895fd49fa0:1-3", false}, + {"compress1", "MySQL/14b68925-696a-11ea-aee7-fec597a91f5e:1-308092", true}, + {"compress2", "MySQL/14b68925-696a-11ea-aee7-fec597a91f5e:1-308092,320a5e98-6965-11ea-b949-eeafd34ae6e4:1-3,81cbdbf8-6969-11ea-aeb1-a6143b021f67:1-524891956,c9a0f301-6965-11ea-ba9d-02c229065569:1-3,cb698dac-6969-11ea-ac38-16e5d0ac5c3a:1-524441991,e39fca4d-6960-11ea-b4c2-1e895fd49fa0:1-3", true}, {"nil-compress", "", true}, {"nil-clear", "", false}, } @@ -3150,7 +3150,7 @@ func TestPlayerBatchMode(t *testing.T) { // If the trx batch is split, then we only expect the end part. trxLastBatchExpectRE := `%s;update _vt\.vreplication set pos=.*;commit$` // The vreplication position update statement will look like this: - // update _vt.vreplication set pos='MySQL56/b213e4de-937a-11ee-b184-668979c675f4:1-38', time_updated=1701786574, transaction_timestamp=1701786574, rows_copied=0, message='' where id=1; + // update _vt.vreplication set pos='MySQL/b213e4de-937a-11ee-b184-668979c675f4:1-38', time_updated=1701786574, transaction_timestamp=1701786574, rows_copied=0, message='' where id=1; // So it will use 182 bytes in the batch. // This long value can be used to test the handling of bulk statements // which bump up against the max batch size, as well as testing the trx diff --git a/go/vt/vttablet/tabletserver/messager/message_manager_test.go b/go/vt/vttablet/tabletserver/messager/message_manager_test.go index 7d7db4966fb..801a9cab867 100644 --- a/go/vt/vttablet/tabletserver/messager/message_manager_test.go +++ b/go/vt/vttablet/tabletserver/messager/message_manager_test.go @@ -443,7 +443,7 @@ func TestMessageManagerStreamerSimple(t *testing.T) { fvs.setStreamerResponse([][]*binlogdatapb.VEvent{{{ // Event set 1. Type: binlogdatapb.VEventType_GTID, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, { Type: binlogdatapb.VEventType_OTHER, }}, {{ @@ -464,7 +464,7 @@ func TestMessageManagerStreamerSimple(t *testing.T) { }, }, { Type: binlogdatapb.VEventType_GTID, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-101", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-101", }, { Type: binlogdatapb.VEventType_COMMIT, }}}) @@ -491,7 +491,7 @@ func TestMessageManagerStreamerAndPoller(t *testing.T) { fvs := newFakeVStreamer() fvs.setPollerResponse([]*binlogdatapb.VStreamResultsResponse{{ Fields: testDBFields, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }}) mm := newMessageManager(newFakeTabletServer(), fvs, newMMTable(), semaphore.NewWeighted(1)) mm.Open() @@ -529,7 +529,7 @@ func TestMessageManagerStreamerAndPoller(t *testing.T) { }, }, { Type: binlogdatapb.VEventType_GTID, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-99", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-99", }, { Type: binlogdatapb.VEventType_COMMIT, }}, {{ @@ -544,7 +544,7 @@ func TestMessageManagerStreamerAndPoller(t *testing.T) { }, }, { Type: binlogdatapb.VEventType_GTID, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, { Type: binlogdatapb.VEventType_COMMIT, }}, {{ @@ -559,7 +559,7 @@ func TestMessageManagerStreamerAndPoller(t *testing.T) { }, }, { Type: binlogdatapb.VEventType_GTID, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-101", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-101", }, { Type: binlogdatapb.VEventType_COMMIT, }}}) @@ -582,7 +582,7 @@ func TestMessageManagerPoller(t *testing.T) { fvs := newFakeVStreamer() fvs.setPollerResponse([]*binlogdatapb.VStreamResultsResponse{{ Fields: testDBFields, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, { Rows: []*querypb.Row{ newMMRow(1), @@ -665,7 +665,7 @@ func TestMessagesPending1(t *testing.T) { fvs.setPollerResponse([]*binlogdatapb.VStreamResultsResponse{{ Fields: testDBFields, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, { Rows: []*querypb.Row{newMMRow(1)}, }}) @@ -691,7 +691,7 @@ func TestMessagesPending2(t *testing.T) { fvs := newFakeVStreamer() fvs.setPollerResponse([]*binlogdatapb.VStreamResultsResponse{{ Fields: testDBFields, - Gtid: "MySQL56/33333333-3333-3333-3333-333333333333:1-100", + Gtid: "MySQL/33333333-3333-3333-3333-333333333333:1-100", }, { Rows: []*querypb.Row{newMMRow(1)}, }}) diff --git a/go/vt/vttablet/tabletserver/schema/historian_test.go b/go/vt/vttablet/tabletserver/schema/historian_test.go index 1d66ecefd97..86485904d87 100644 --- a/go/vt/vttablet/tabletserver/schema/historian_test.go +++ b/go/vt/vttablet/tabletserver/schema/historian_test.go @@ -83,7 +83,7 @@ func TestHistorian(t *testing.T) { se.EnableHistorian(false) require.Nil(t, se.RegisterVersionEvent()) - gtidPrefix := "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:" + gtidPrefix := "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:" gtid1 := gtidPrefix + "1-10" ddl1 := "create table tracker_test (id int)" ts1 := int64(1427325876) @@ -187,7 +187,7 @@ func TestHistorianPurgeOldSchemas(t *testing.T) { se, db, cancel := getTestSchemaEngine(t, int64(schemaVersionMaxAgeSeconds)) defer cancel() - gtidPrefix := "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:" + gtidPrefix := "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:" gtid1 := gtidPrefix + "1-10" ddl1 := "create table tracker_test (id int)" // create the first record 1 day ago so it gets purged from memory diff --git a/go/vt/vttablet/tabletserver/schema/tracker_test.go b/go/vt/vttablet/tabletserver/schema/tracker_test.go index 39056b41df2..7d14c196a86 100644 --- a/go/vt/vttablet/tabletserver/schema/tracker_test.go +++ b/go/vt/vttablet/tabletserver/schema/tracker_test.go @@ -35,7 +35,7 @@ func TestTracker(t *testing.T) { initialSchemaInserted := false se, db, cancel := getTestSchemaEngine(t, 0) defer cancel() - gtid1 := "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10" + gtid1 := "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10" ddl1 := "create table tracker_test (id int)" query := "CREATE TABLE IF NOT EXISTS _vt.schema_version.*" db.AddQueryPattern(query, &sqltypes.Result{}) @@ -95,7 +95,7 @@ func TestTracker(t *testing.T) { func TestTrackerShouldNotInsertInitialSchema(t *testing.T) { initialSchemaInserted := false se, db, cancel := getTestSchemaEngine(t, 0) - gtid1 := "MySQL56/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10" + gtid1 := "MySQL/7b04699f-f5e9-11e9-bf88-9cb6d089e1c3:1-10" defer cancel() // simulates existing rows in schema_version, so initial schema should not be inserted diff --git a/go/vt/vttablet/tabletserver/vstreamer/snapshot_conn.go b/go/vt/vttablet/tabletserver/vstreamer/snapshot_conn.go index 1510dbb53ef..cfff08a02a8 100644 --- a/go/vt/vttablet/tabletserver/vstreamer/snapshot_conn.go +++ b/go/vt/vttablet/tabletserver/vstreamer/snapshot_conn.go @@ -156,9 +156,9 @@ func (conn *snapshotConn) startSnapshotWithConsistentGTID(ctx context.Context) ( if err != nil { return "", err } - // The "session_track_gtids = START_GTID" patch is only applicable to MySQL56 GTID, which is - // why we hardcode the position as mysql.Mysql56FlavorID - mpos, err := replication.ParsePosition(replication.Mysql56FlavorID, result.SessionStateChanges) + // The "session_track_gtids = START_GTID" patch is only applicable to MySQL GTID, which is + // why we hardcode the position as mysql.MysqlFlavorID + mpos, err := replication.ParsePosition(replication.MysqlFlavorID, result.SessionStateChanges) if err != nil { return "", err } diff --git a/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go b/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go index eac4f04ab24..32649086a2c 100644 --- a/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go +++ b/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go @@ -632,7 +632,7 @@ func (vs *vstreamer) parseEvent(ev mysql.BinlogEvent) ([]*binlogdatapb.VEvent, e return nil, err } case ev.IsTransactionPayload(): - if !vs.pos.MatchesFlavor(replication.Mysql56FlavorID) { + if !vs.pos.MatchesFlavor(replication.MysqlFlavorID) { return nil, fmt.Errorf("compressed transaction payload events are not supported with database flavor %s", vs.vse.env.Config().DB.Flavor) } diff --git a/go/vt/vttest/environment.go b/go/vt/vttest/environment.go index 7f3ea88437a..7413d3baa99 100644 --- a/go/vt/vttest/environment.go +++ b/go/vt/vttest/environment.go @@ -105,7 +105,7 @@ type LocalTestEnv struct { // DefaultMySQLFlavor is the MySQL flavor used by vttest when no explicit // flavor is given. -const DefaultMySQLFlavor = "MySQL56" +const DefaultMySQLFlavor = "MySQL" // GetMySQLOptions returns the set of MySQL CNF files and any errors. func GetMySQLOptions() ([]string, error) { diff --git a/go/vt/wrangler/wrangler_env_test.go b/go/vt/wrangler/wrangler_env_test.go index 453e2a88c06..f5a3d49eebf 100644 --- a/go/vt/wrangler/wrangler_env_test.go +++ b/go/vt/wrangler/wrangler_env_test.go @@ -153,7 +153,7 @@ func newWranglerTestEnv(t testing.TB, ctx context.Context, sourceShards, targetS result := sqltypes.MakeTestResult(sqltypes.MakeTestFields( "id|source|pos|stop_pos|max_replication_lag|state|db_name|time_updated|transaction_timestamp|time_heartbeat|time_throttled|component_throttled|message|tags|workflow_type|workflow_sub_type|defer_secondary_keys|rows_copied", "int64|varchar|varchar|varchar|int64|varchar|varchar|int64|int64|int64|int64|int64|varchar|varchar|varchar|int64|int64|int64|int64"), - fmt.Sprintf("1|%v|MySQL56/14b68925-696a-11ea-aee7-fec597a91f5e:1-3||0|Running|vt_target|%d|0|%d|0||||||0|1000", bls, timeUpdated, timeUpdated), + fmt.Sprintf("1|%v|MySQL/14b68925-696a-11ea-aee7-fec597a91f5e:1-3||0|Running|vt_target|%d|0|%d|0||||||0|1000", bls, timeUpdated, timeUpdated), ) env.tmc.setVRResults(primary.tablet, "select id, source, pos, stop_pos, max_replication_lag, state, db_name, time_updated, transaction_timestamp, time_heartbeat, time_throttled, component_throttled, message, tags, workflow_type, workflow_sub_type, defer_secondary_keys, rows_copied from _vt.vreplication where db_name = 'vt_target' and workflow = 'wrWorkflow'", result) env.tmc.setVRResults( diff --git a/proto/vtgate.proto b/proto/vtgate.proto index 0d8781bcd61..b4def026da6 100644 --- a/proto/vtgate.proto +++ b/proto/vtgate.proto @@ -312,7 +312,7 @@ message VStreamRequest { // position specifies the starting point of the bin log positions // as well as the keyspace-shards to pull events from. - // position is of the form 'ks1:0@MySQL56/|ks2:-80@MySQL56/'. + // position is of the form 'ks1:0@MySQL/|ks2:-80@MySQL/'. binlogdata.VGtid vgtid = 3; binlogdata.Filter filter = 4; VStreamFlags flags = 5;