File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ import (
19
19
)
20
20
21
21
var (
22
- errSyncRunning = errors .New ("Sync is running, must Close first" )
22
+ errSyncRunning = errors .New ("Sync is running, must Close first" )
23
+ maxHostNameLength = 60
23
24
)
24
25
25
26
// BinlogSyncerConfig is the configuration for BinlogSyncer.
@@ -524,7 +525,10 @@ func (b *BinlogSyncer) writeRegisterSlaveCommand() error {
524
525
b .c .ResetSequence ()
525
526
526
527
hostname := b .localHostname ()
527
-
528
+ if len (hostname ) > maxHostNameLength {
529
+ runes := []rune (hostname )
530
+ hostname = string (runes [0 :maxHostNameLength ])
531
+ }
528
532
// This should be the name of slave host not the host we are connecting to.
529
533
data := make ([]byte , 4 + 1 + 4 + 1 + len (hostname )+ 1 + len (b .cfg .User )+ 1 + len (b .cfg .Password )+ 2 + 4 + 4 )
530
534
pos := 4
You can’t perform that action at this time.
0 commit comments