File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1
1
module github.com/siddontang/go-mysql
2
2
3
+ go 1.14
4
+
3
5
require (
4
6
github.com/BurntSushi/toml v0.3.1
5
7
github.com/go-sql-driver/mysql v1.4.1
@@ -15,3 +17,5 @@ require (
15
17
github.com/sirupsen/logrus v1.4.1 // indirect
16
18
golang.org/x/text v0.3.2 // indirect
17
19
)
20
+
21
+ replace github.com/coreos/bbolt => go.etcd.io/bbolt v1.3.4
Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ type BinlogSyncerConfig struct {
44
44
// Charset is for MySQL client character set
45
45
Charset string
46
46
47
+ // the uuid of slave
48
+ Uuid string
49
+
47
50
// SemiSyncEnabled enables semi-sync or not.
48
51
SemiSyncEnabled bool
49
52
@@ -271,6 +274,11 @@ func (b *BinlogSyncer) registerSlave() error {
271
274
}
272
275
}
273
276
277
+ slaveuuid := b .uuid ()
278
+ if _ , err := b .c .Execute (fmt .Sprintf ("SET @slave_uuid='%s'" , slaveuuid )); err != nil {
279
+ return errors .Errorf ("failed to set SET @slave_uuid='%s': %v" , slaveuuid , err )
280
+ }
281
+
274
282
if b .cfg .Flavor == MariaDBFlavor {
275
283
// Refer https://github.com/alibaba/canal/wiki/BinlogChange(MariaDB5&10)
276
284
// Tell the server that we understand GTIDs by setting our slave capability
@@ -501,6 +509,13 @@ func (b *BinlogSyncer) localHostname() string {
501
509
return b .cfg .Localhost
502
510
}
503
511
512
+ func (b * BinlogSyncer ) uuid () string {
513
+ if len (b .cfg .Uuid ) == 0 {
514
+ return uuid .NewV1 ().String ()
515
+ }
516
+ return b .cfg .Uuid
517
+ }
518
+
504
519
func (b * BinlogSyncer ) writeRegisterSlaveCommand () error {
505
520
b .c .ResetSequence ()
506
521
You can’t perform that action at this time.
0 commit comments