Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to extend replication options #508

Merged
merged 3 commits into from
Jul 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions replication/binlogsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ type BinlogSyncerConfig struct {
// https://mariadb.com/kb/en/library/com_binlog_dump/
// https://mariadb.com/kb/en/library/annotate_rows_event/
DumpCommandFlag uint16

Option func(*client.Conn) error
atercattus marked this conversation as resolved.
Show resolved Hide resolved
}

// BinlogSyncer syncs binlog event from server.
Expand Down Expand Up @@ -223,6 +225,12 @@ func (b *BinlogSyncer) registerSlave() error {
return errors.Trace(err)
}

if b.cfg.Option != nil {
if err = b.cfg.Option(b.c); err != nil {
return errors.Trace(err)
}
}

if len(b.cfg.Charset) != 0 {
b.c.SetCharset(b.cfg.Charset)
}
Expand Down