Commit b28e907 1 parent 81ff5fd commit b28e907 Copy full SHA for b28e907
File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ type Config struct {
105
105
// Set Dialer
106
106
Dialer client.Dialer
107
107
108
- // Set Localhost
108
+ // Set the hostname that is used when registering as replica. This is similar to `report_host` in MySQL.
109
+ // This will be truncated if it is longer than 255 characters.
109
110
Localhost string
110
111
111
112
// EventCacheCount is the capacity of the BinlogStreamer internal event channel.
Original file line number Diff line number Diff line change @@ -573,13 +573,17 @@ func (b *BinlogSyncer) writeBinlogDumpMariadbGTIDCommand(gset mysql.GTIDSet) err
573
573
return b .writeBinlogDumpCommand (mysql.Position {Name : "" , Pos : 0 })
574
574
}
575
575
576
- // localHostname returns the hostname that register slave would register as.
576
+ // localHostname returns the hostname that register replica would register as.
577
+ // this gets truncated to 255 bytes.
577
578
func (b * BinlogSyncer ) localHostname () string {
578
- if len (b .cfg .Localhost ) == 0 {
579
- h , _ := os .Hostname ()
579
+ h := b .cfg .Localhost
580
+ if len (h ) == 0 {
581
+ h , _ = os .Hostname ()
582
+ }
583
+ if len (h ) <= 255 {
580
584
return h
581
585
}
582
- return b . cfg . Localhost
586
+ return h [: 255 ]
583
587
}
584
588
585
589
func (b * BinlogSyncer ) writeRegisterSlaveCommand () error {
You can’t perform that action at this time.
0 commit comments