Skip to content

Commit 88ae836

Browse files
committed
Move MySQL56 to MySQL
Signed-off-by: Matt Lord <mattalord@gmail.com>
1 parent b15e9f6 commit 88ae836

File tree

60 files changed

+811
-811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+811
-811
lines changed

examples/local/vstream_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func main() {
4747
Shard: "-80",
4848
// Gtid "" is to stream from the start, "current" is to stream from the current gtid
4949
// you can also specify a gtid to start with.
50-
Gtid: "", //"current" // "MySQL56/36a89abd-978f-11eb-b312-04ed332e05c2:1-265"
50+
Gtid: "", //"current" // "MySQL/36a89abd-978f-11eb-b312-04ed332e05c2:1-265"
5151
}, {
5252
Keyspace: "customer",
5353
Shard: "80-",

go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_env_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ import (
4848
const (
4949
// vdiffStopPosition is the default stop position for the target vreplication.
5050
// It can be overridden with the positons argument to newTestVDiffEnv.
51-
vdiffStopPosition = "MySQL56/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-892"
51+
vdiffStopPosition = "MySQL/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-892"
5252
// vdiffSourceGtid should be the position reported by the source side VStreamResults.
5353
// It's expected to be higher the vdiffStopPosition.
54-
vdiffSourceGtid = "MySQL56/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-893"
54+
vdiffSourceGtid = "MySQL/d834e6b8-7cbf-11ed-a1eb-0242ac120002:1-893"
5555
// vdiffTargetPrimaryPosition is the primary position of the target after
5656
// vreplication has been synchronized.
57-
vdiffTargetPrimaryPosition = "MySQL56/e34d6fb6-7cbf-11ed-a1eb-0242ac120002:1-892"
57+
vdiffTargetPrimaryPosition = "MySQL/e34d6fb6-7cbf-11ed-a1eb-0242ac120002:1-892"
5858
)
5959

6060
type testVDiffEnv struct {

go/cmd/vtctldclient/command/vreplication/vdiff/vdiff_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,8 @@ func TestVDiffSharded(t *testing.T) {
572572
ctx, cancel := context.WithCancel(context.Background())
573573
defer cancel()
574574
env := newTestVDiffEnv(t, ctx, []string{"-40", "40-"}, []string{"-80", "80-"}, "", map[string]string{
575-
"-80": "MySQL56/0e45e704-7cb9-11ed-a1eb-0242ac120002:1-890",
576-
"80-": "MySQL56/1497ddb0-7cb9-11ed-a1eb-0242ac120002:1-891",
575+
"-80": "MySQL/0e45e704-7cb9-11ed-a1eb-0242ac120002:1-890",
576+
"80-": "MySQL/1497ddb0-7cb9-11ed-a1eb-0242ac120002:1-891",
577577
})
578578
defer env.close()
579579

go/mysql/binlog_event_compression.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func (tp *TransactionPayload) decode() error {
220220
eventLen, pos, decompressedPayloadLen))
221221
}
222222
eventData := decompressedPayload[pos : pos+eventLen]
223-
ble := NewMysql56BinlogEvent(eventData)
223+
ble := NewMysqlBinlogEvent(eventData)
224224
tp.Events = append(tp.Events, ble)
225225

226226
pos += eventLen

go/mysql/binlog_event_make.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const (
3030
// This file contains utility methods to create binlog replication
3131
// packets. They are mostly used for testing.
3232

33-
// NewMySQL56BinlogFormat returns a typical BinlogFormat for MySQL 5.6.
34-
func NewMySQL56BinlogFormat() BinlogFormat {
33+
// NewMySQLBinlogFormat returns a typical BinlogFormat for MySQL 5.6.
34+
func NewMySQLBinlogFormat() BinlogFormat {
3535
return BinlogFormat{
3636
FormatVersion: 4,
3737
ServerVersion: "5.6.33-0ubuntu0.14.04.1-log",
@@ -133,11 +133,11 @@ func (s *FakeBinlogStream) Packetize(f BinlogFormat, typ byte, flags uint16, dat
133133

134134
// NewInvalidEvent returns an invalid event (its size is <19).
135135
func NewInvalidEvent() BinlogEvent {
136-
return NewMysql56BinlogEvent([]byte{0})
136+
return NewMysqlBinlogEvent([]byte{0})
137137
}
138138

139139
// NewFormatDescriptionEvent creates a new FormatDescriptionEvent
140-
// based on the provided BinlogFormat. It uses a mysql56BinlogEvent
140+
// based on the provided BinlogFormat. It uses a mysqlBinlogEvent
141141
// but could use a MariaDB one.
142142
func NewFormatDescriptionEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent {
143143
length := 2 + // binlog-version
@@ -155,7 +155,7 @@ func NewFormatDescriptionEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent
155155
data[57+len(f.HeaderSizes)] = f.ChecksumAlgorithm
156156

157157
ev := s.Packetize(f, eFormatDescriptionEvent, 0, data)
158-
return NewMysql56BinlogEvent(ev)
158+
return NewMysqlBinlogEvent(ev)
159159
}
160160

161161
// NewInvalidFormatDescriptionEvent returns an invalid FormatDescriptionEvent.
@@ -166,7 +166,7 @@ func NewInvalidFormatDescriptionEvent(f BinlogFormat, s *FakeBinlogStream) Binlo
166166
data[0] = 3
167167

168168
ev := s.Packetize(f, eFormatDescriptionEvent, 0, data)
169-
return NewMysql56BinlogEvent(ev)
169+
return NewMysqlBinlogEvent(ev)
170170
}
171171

172172
// NewRotateEvent returns a RotateEvent.
@@ -179,7 +179,7 @@ func NewRotateEvent(f BinlogFormat, s *FakeBinlogStream, position uint64, filena
179179
copy(data[8:], filename)
180180

181181
ev := s.Packetize(f, eRotateEvent, 0, data)
182-
return NewMysql56BinlogEvent(ev)
182+
return NewMysqlBinlogEvent(ev)
183183
}
184184

185185
func NewFakeRotateEvent(f BinlogFormat, s *FakeBinlogStream, filename string) BinlogEvent {
@@ -190,14 +190,14 @@ func NewFakeRotateEvent(f BinlogFormat, s *FakeBinlogStream, filename string) Bi
190190
copy(data[8:], filename)
191191

192192
ev := s.Packetize(f, eRotateEvent, FlagLogEventArtificial, data)
193-
return NewMysql56BinlogEvent(ev)
193+
return NewMysqlBinlogEvent(ev)
194194
}
195195

196196
// NewHeartbeatEvent returns a HeartbeatEvent.
197197
// see https://dev.mysql.com/doc/internals/en/heartbeat-event.html
198198
func NewHeartbeatEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent {
199199
ev := s.Packetize(f, eHeartbeatEvent, 0, []byte{})
200-
return NewMysql56BinlogEvent(ev)
200+
return NewMysqlBinlogEvent(ev)
201201
}
202202

203203
// NewHeartbeatEvent returns a HeartbeatEvent.
@@ -208,7 +208,7 @@ func NewHeartbeatEventWithLogFile(f BinlogFormat, s *FakeBinlogStream, filename
208208
copy(data, filename)
209209

210210
ev := s.Packetize(f, eHeartbeatEvent, 0, data)
211-
return NewMysql56BinlogEvent(ev)
211+
return NewMysqlBinlogEvent(ev)
212212
}
213213

214214
// NewQueryEvent makes up a QueryEvent based on the Query structure.
@@ -250,7 +250,7 @@ func NewQueryEvent(f BinlogFormat, s *FakeBinlogStream, q Query) BinlogEvent {
250250
copy(data[pos:], q.SQL)
251251

252252
ev := s.Packetize(f, eQueryEvent, 0, data)
253-
return NewMysql56BinlogEvent(ev)
253+
return NewMysqlBinlogEvent(ev)
254254
}
255255

256256
// NewInvalidQueryEvent returns an invalid QueryEvent. IsValid is however true.
@@ -261,7 +261,7 @@ func NewInvalidQueryEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent {
261261
data[4+4] = 200 // > 100
262262

263263
ev := s.Packetize(f, eQueryEvent, 0, data)
264-
return NewMysql56BinlogEvent(ev)
264+
return NewMysqlBinlogEvent(ev)
265265
}
266266

267267
// 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 {
270270
data := make([]byte, length)
271271

272272
ev := s.Packetize(f, eXIDEvent, 0, data)
273-
return NewMysql56BinlogEvent(ev)
273+
return NewMysqlBinlogEvent(ev)
274274
}
275275

276276
// NewIntVarEvent returns an IntVar event.
@@ -289,7 +289,7 @@ func NewIntVarEvent(f BinlogFormat, s *FakeBinlogStream, typ byte, value uint64)
289289
data[8] = byte(value >> 56)
290290

291291
ev := s.Packetize(f, eIntVarEvent, 0, data)
292-
return NewMysql56BinlogEvent(ev)
292+
return NewMysqlBinlogEvent(ev)
293293
}
294294

295295
// NewMariaDBGTIDEvent returns a MariaDB specific GTID event.
@@ -462,5 +462,5 @@ func newRowsEvent(f BinlogFormat, s *FakeBinlogStream, typ byte, tableID uint64,
462462
}
463463

464464
ev := s.Packetize(f, typ, 0, data)
465-
return NewMysql56BinlogEvent(ev)
465+
return NewMysqlBinlogEvent(ev)
466466
}

go/mysql/binlog_event_make_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
// FormatDescriptionEvent is working properly.
3434
func TestFormatDescriptionEvent(t *testing.T) {
3535
// MySQL 5.6
36-
f := NewMySQL56BinlogFormat()
36+
f := NewMySQLBinlogFormat()
3737
s := NewFakeBinlogStream()
3838

3939
event := NewFormatDescriptionEvent(f, s)
@@ -59,7 +59,7 @@ func TestFormatDescriptionEvent(t *testing.T) {
5959
}
6060

6161
func TestQueryEvent(t *testing.T) {
62-
f := NewMySQL56BinlogFormat()
62+
f := NewMySQLBinlogFormat()
6363
s := NewFakeBinlogStream()
6464

6565
q := Query{
@@ -85,7 +85,7 @@ func TestQueryEvent(t *testing.T) {
8585
}
8686

8787
func TestXIDEvent(t *testing.T) {
88-
f := NewMySQL56BinlogFormat()
88+
f := NewMySQLBinlogFormat()
8989
s := NewFakeBinlogStream()
9090

9191
event := NewXIDEvent(f, s)
@@ -95,7 +95,7 @@ func TestXIDEvent(t *testing.T) {
9595
}
9696

9797
func TestIntVarEvent(t *testing.T) {
98-
f := NewMySQL56BinlogFormat()
98+
f := NewMySQLBinlogFormat()
9999
s := NewFakeBinlogStream()
100100

101101
event := NewIntVarEvent(f, s, IntVarLastInsertID, 0x123456789abcdef0)
@@ -117,7 +117,7 @@ func TestIntVarEvent(t *testing.T) {
117117
}
118118

119119
func TestInvalidEvents(t *testing.T) {
120-
f := NewMySQL56BinlogFormat()
120+
f := NewMySQLBinlogFormat()
121121
s := NewFakeBinlogStream()
122122

123123
// InvalidEvent
@@ -146,7 +146,7 @@ func TestInvalidEvents(t *testing.T) {
146146
}
147147

148148
func TestMariadDBGTIDEVent(t *testing.T) {
149-
f := NewMySQL56BinlogFormat()
149+
f := NewMySQLBinlogFormat()
150150
s := NewFakeBinlogStream()
151151
s.ServerID = 0x87654321
152152

@@ -190,7 +190,7 @@ func TestMariadDBGTIDEVent(t *testing.T) {
190190
}
191191

192192
func TestTableMapEvent(t *testing.T) {
193-
f := NewMySQL56BinlogFormat()
193+
f := NewMySQLBinlogFormat()
194194
s := NewFakeBinlogStream()
195195

196196
tm := &TableMap{
@@ -245,7 +245,7 @@ func TestTableMapEvent(t *testing.T) {
245245
}
246246

247247
func TestLargeTableMapEvent(t *testing.T) {
248-
f := NewMySQL56BinlogFormat()
248+
f := NewMySQLBinlogFormat()
249249
s := NewFakeBinlogStream()
250250

251251
colLen := 256
@@ -287,7 +287,7 @@ func TestLargeTableMapEvent(t *testing.T) {
287287
}
288288

289289
func TestRowsEvent(t *testing.T) {
290-
f := NewMySQL56BinlogFormat()
290+
f := NewMySQLBinlogFormat()
291291
s := NewFakeBinlogStream()
292292

293293
/*
@@ -375,7 +375,7 @@ func TestRowsEvent(t *testing.T) {
375375

376376
func TestHeartbeatEvent(t *testing.T) {
377377
// MySQL 5.6
378-
f := NewMySQL56BinlogFormat()
378+
f := NewMySQLBinlogFormat()
379379
s := NewFakeBinlogStream()
380380
event := NewHeartbeatEvent(f, s)
381381
require.NotNil(t, event)
@@ -385,7 +385,7 @@ func TestHeartbeatEvent(t *testing.T) {
385385

386386
func TestRotateRotateEvent(t *testing.T) {
387387
// MySQL 5.6
388-
f := NewMySQL56BinlogFormat()
388+
f := NewMySQLBinlogFormat()
389389
s := NewFakeBinlogStream()
390390
event := NewRotateEvent(f, s, 456, "mysql-bin.000123")
391391
require.NotNil(t, event)
@@ -398,7 +398,7 @@ func TestRotateRotateEvent(t *testing.T) {
398398

399399
func TestFakeRotateEvent(t *testing.T) {
400400
// MySQL 5.6
401-
f := NewMySQL56BinlogFormat()
401+
f := NewMySQLBinlogFormat()
402402
s := NewFakeBinlogStream()
403403
event := NewFakeRotateEvent(f, s, "mysql-bin.000123")
404404
require.NotNil(t, event)
@@ -409,7 +409,7 @@ func TestFakeRotateEvent(t *testing.T) {
409409
assert.Equal(t, "mysql-bin.000123", nextFile)
410410
}
411411
func TestLargeRowsEvent(t *testing.T) {
412-
f := NewMySQL56BinlogFormat()
412+
f := NewMySQLBinlogFormat()
413413
s := NewFakeBinlogStream()
414414

415415
/*

go/mysql/binlog_event_mysql56.go renamed to go/mysql/binlog_event_mysql.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,31 @@ import (
2424
"vitess.io/vitess/go/vt/vterrors"
2525
)
2626

27-
// mysql56BinlogEvent wraps a raw packet buffer and provides methods to examine
27+
// mysqlBinlogEvent wraps a raw packet buffer and provides methods to examine
2828
// it by implementing BinlogEvent. Some methods are pulled in from
2929
// binlogEvent.
30-
type mysql56BinlogEvent struct {
30+
type mysqlBinlogEvent struct {
3131
binlogEvent
3232
semiSyncAckRequested bool
3333
}
3434

35-
// NewMysql56BinlogEventWithSemiSyncInfo creates a BinlogEvent from given byte array
36-
func NewMysql56BinlogEventWithSemiSyncInfo(buf []byte, semiSyncAckRequested bool) BinlogEvent {
37-
return mysql56BinlogEvent{binlogEvent: binlogEvent(buf), semiSyncAckRequested: semiSyncAckRequested}
35+
// NewMysqlBinlogEventWithSemiSyncInfo creates a BinlogEvent from given byte array
36+
func NewMysqlBinlogEventWithSemiSyncInfo(buf []byte, semiSyncAckRequested bool) BinlogEvent {
37+
return mysqlBinlogEvent{binlogEvent: binlogEvent(buf), semiSyncAckRequested: semiSyncAckRequested}
3838
}
3939

40-
// NewMysql56BinlogEvent creates a BinlogEvent from given byte array
41-
func NewMysql56BinlogEvent(buf []byte) BinlogEvent {
42-
return mysql56BinlogEvent{binlogEvent: binlogEvent(buf)}
40+
// NewMysqlBinlogEvent creates a BinlogEvent from given byte array
41+
func NewMysqlBinlogEvent(buf []byte) BinlogEvent {
42+
return mysqlBinlogEvent{binlogEvent: binlogEvent(buf)}
4343
}
4444

4545
// IsSemiSyncAckRequested implements BinlogEvent.IsSemiSyncAckRequested().
46-
func (ev mysql56BinlogEvent) IsSemiSyncAckRequested() bool {
46+
func (ev mysqlBinlogEvent) IsSemiSyncAckRequested() bool {
4747
return ev.semiSyncAckRequested
4848
}
4949

5050
// IsGTID implements BinlogEvent.IsGTID().
51-
func (ev mysql56BinlogEvent) IsGTID() bool {
51+
func (ev mysqlBinlogEvent) IsGTID() bool {
5252
return ev.Type() == eGTIDEvent
5353
}
5454

@@ -60,18 +60,18 @@ func (ev mysql56BinlogEvent) IsGTID() bool {
6060
// 1 flags
6161
// 16 SID (server UUID)
6262
// 8 GNO (sequence number, signed int)
63-
func (ev mysql56BinlogEvent) GTID(f BinlogFormat) (replication.GTID, bool, error) {
63+
func (ev mysqlBinlogEvent) GTID(f BinlogFormat) (replication.GTID, bool, error) {
6464
data := ev.Bytes()[f.HeaderLength:]
6565
var sid replication.SID
6666
copy(sid[:], data[1:1+16])
6767
gno := int64(binary.LittleEndian.Uint64(data[1+16 : 1+16+8]))
68-
return replication.Mysql56GTID{Server: sid, Sequence: gno}, false /* hasBegin */, nil
68+
return replication.MysqlGTID{Server: sid, Sequence: gno}, false /* hasBegin */, nil
6969
}
7070

7171
// PreviousGTIDs implements BinlogEvent.PreviousGTIDs().
72-
func (ev mysql56BinlogEvent) PreviousGTIDs(f BinlogFormat) (replication.Position, error) {
72+
func (ev mysqlBinlogEvent) PreviousGTIDs(f BinlogFormat) (replication.Position, error) {
7373
data := ev.Bytes()[f.HeaderLength:]
74-
set, err := replication.NewMysql56GTIDSetFromSIDBlock(data)
74+
set, err := replication.NewMysqlGTIDSetFromSIDBlock(data)
7575
if err != nil {
7676
return replication.Position{}, err
7777
}
@@ -81,7 +81,7 @@ func (ev mysql56BinlogEvent) PreviousGTIDs(f BinlogFormat) (replication.Position
8181
}
8282

8383
// StripChecksum implements BinlogEvent.StripChecksum().
84-
func (ev mysql56BinlogEvent) StripChecksum(f BinlogFormat) (BinlogEvent, []byte, error) {
84+
func (ev mysqlBinlogEvent) StripChecksum(f BinlogFormat) (BinlogEvent, []byte, error) {
8585
switch f.ChecksumAlgorithm {
8686
case BinlogChecksumAlgOff, BinlogChecksumAlgUndef:
8787
// There is no checksum.
@@ -92,7 +92,7 @@ func (ev mysql56BinlogEvent) StripChecksum(f BinlogFormat) (BinlogEvent, []byte,
9292
length := len(data)
9393
checksum := data[length-BinlogCRC32ChecksumLen:]
9494
data = data[:length-BinlogCRC32ChecksumLen]
95-
return mysql56BinlogEvent{binlogEvent: binlogEvent(data)}, checksum, nil
95+
return mysqlBinlogEvent{binlogEvent: binlogEvent(data)}, checksum, nil
9696
default:
9797
// MySQL 5.6 does not guarantee that future checksum algorithms will be
9898
// 4 bytes, so we can't support them a priori.

0 commit comments

Comments
 (0)