Skip to content
Merged
Changes from all commits
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: 6 additions & 2 deletions replication/binlogsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import (
)

var (
errSyncRunning = errors.New("Sync is running, must Close first")
errSyncRunning = errors.New("Sync is running, must Close first")
maxHostNameLength = 60
)

// BinlogSyncerConfig is the configuration for BinlogSyncer.
Expand Down Expand Up @@ -524,7 +525,10 @@ func (b *BinlogSyncer) writeRegisterSlaveCommand() error {
b.c.ResetSequence()

hostname := b.localHostname()

if len(hostname) > maxHostNameLength {
runes := []rune(hostname)
hostname = string(runes[0:maxHostNameLength])
}
// This should be the name of slave host not the host we are connecting to.
data := make([]byte, 4+1+4+1+len(hostname)+1+len(b.cfg.User)+1+len(b.cfg.Password)+2+4+4)
pos := 4
Expand Down