Skip to content

Commit f5700cc

Browse files
fengvefengwei
and
fengwei
authored
Add function to extend replication options (#508)
* Add function to extend replication parameters Co-authored-by: fengwei <[email protected]>
1 parent 3529af7 commit f5700cc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

replication/binlogsyncer.go

+10
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ type BinlogSyncerConfig struct {
104104
// https://mariadb.com/kb/en/library/com_binlog_dump/
105105
// https://mariadb.com/kb/en/library/annotate_rows_event/
106106
DumpCommandFlag uint16
107+
108+
//Option function is used to set outside of BinlogSyncerConfig, between mysql connection and COM_REGISTER_SLAVE
109+
//For MariaDB: slave_gtid_ignore_duplicates、skip_replication、slave_until_gtid
110+
Option func(*client.Conn) error
107111
}
108112

109113
// BinlogSyncer syncs binlog event from server.
@@ -223,6 +227,12 @@ func (b *BinlogSyncer) registerSlave() error {
223227
return errors.Trace(err)
224228
}
225229

230+
if b.cfg.Option != nil {
231+
if err = b.cfg.Option(b.c); err != nil {
232+
return errors.Trace(err)
233+
}
234+
}
235+
226236
if len(b.cfg.Charset) != 0 {
227237
b.c.SetCharset(b.cfg.Charset)
228238
}

0 commit comments

Comments
 (0)