@@ -226,31 +226,31 @@ type PreviousGTIDsEvent struct {
226
226
func (e * PreviousGTIDsEvent ) Decode (data []byte ) error {
227
227
var previousGTIDSets []string
228
228
pos := 0
229
- uuidCount := binary .LittleEndian .Uint16 (data [pos : pos + 8 ])
229
+ uuidCount := binary .LittleEndian .Uint16 (data [pos : pos + 8 ])
230
230
pos += 8
231
231
232
- for i := uint16 (0 );i < uuidCount ; i ++ {
233
- uuid := e .decodeUuid (data [pos : pos + 16 ])
232
+ for i := uint16 (0 ); i < uuidCount ; i ++ {
233
+ uuid := e .decodeUuid (data [pos : pos + 16 ])
234
234
pos += 16
235
- sliceCount := binary .LittleEndian .Uint16 (data [pos : pos + 8 ])
235
+ sliceCount := binary .LittleEndian .Uint16 (data [pos : pos + 8 ])
236
236
pos += 8
237
237
var intervals []string
238
- for i := uint16 (0 );i < sliceCount ; i ++ {
239
- start := e .decodeInterval (data [pos : pos + 8 ])
238
+ for i := uint16 (0 ); i < sliceCount ; i ++ {
239
+ start := e .decodeInterval (data [pos : pos + 8 ])
240
240
pos += 8
241
- stop := e .decodeInterval (data [pos : pos + 8 ])
241
+ stop := e .decodeInterval (data [pos : pos + 8 ])
242
242
pos += 8
243
243
interval := ""
244
244
if stop == start + 1 {
245
- interval = fmt .Sprintf ("%d" ,start )
246
- }else {
247
- interval = fmt .Sprintf ("%d-%d" ,start ,stop - 1 )
245
+ interval = fmt .Sprintf ("%d" , start )
246
+ } else {
247
+ interval = fmt .Sprintf ("%d-%d" , start , stop - 1 )
248
248
}
249
- intervals = append (intervals ,interval )
249
+ intervals = append (intervals , interval )
250
250
}
251
- previousGTIDSets = append (previousGTIDSets ,fmt .Sprintf ("%s:%s" ,uuid ,strings .Join (intervals ,":" )))
251
+ previousGTIDSets = append (previousGTIDSets , fmt .Sprintf ("%s:%s" , uuid , strings .Join (intervals , ":" )))
252
252
}
253
- e .GTIDSets = fmt .Sprintf ("%s" ,strings .Join (previousGTIDSets ,"," ))
253
+ e .GTIDSets = fmt .Sprintf ("%s" , strings .Join (previousGTIDSets , "," ))
254
254
return nil
255
255
}
256
256
@@ -260,8 +260,8 @@ func (e *PreviousGTIDsEvent) Dump(w io.Writer) {
260
260
}
261
261
262
262
func (e * PreviousGTIDsEvent ) decodeUuid (data []byte ) string {
263
- return fmt .Sprintf ("%s-%s-%s-%s-%s" ,hex .EncodeToString (data [0 :4 ]),hex .EncodeToString (data [4 :6 ]),
264
- hex .EncodeToString (data [6 :8 ]),hex .EncodeToString (data [8 :10 ]),hex .EncodeToString (data [10 :]))
263
+ return fmt .Sprintf ("%s-%s-%s-%s-%s" , hex .EncodeToString (data [0 :4 ]), hex .EncodeToString (data [4 :6 ]),
264
+ hex .EncodeToString (data [6 :8 ]), hex .EncodeToString (data [8 :10 ]), hex .EncodeToString (data [10 :]))
265
265
}
266
266
267
267
func (e * PreviousGTIDsEvent ) decodeInterval (data []byte ) uint64 {
@@ -351,15 +351,17 @@ type GTIDEvent struct {
351
351
LastCommitted int64
352
352
SequenceNumber int64
353
353
354
- // The followings are available only after MySQL-8.0
355
-
354
+ // ImmediateCommitTimestamp/OriginalCommitTimestamp are introduced in MySQL-8.0.1, see:
355
+ // https://mysqlhighavailability.com/replication-features-in-mysql-8-0-1/
356
356
ImmediateCommitTimestamp uint64
357
357
OriginalCommitTimestamp uint64
358
358
359
- // Total transaction length (including this GTIDEvent), see:
359
+ // Total transaction length (including this GTIDEvent), introduced in MySQL-8.0.2, see:
360
360
// https://mysqlhighavailability.com/taking-advantage-of-new-transaction-length-metadata/
361
361
TransactionLength uint64
362
362
363
+ // ImmediateServerVersion/OriginalServerVersion are introduced in MySQL-8.0.14, see
364
+ // https://dev.mysql.com/doc/refman/8.0/en/replication-compatibility.html
363
365
ImmediateServerVersion uint32
364
366
OriginalServerVersion uint32
365
367
}
0 commit comments