File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ type Config struct {
105105 // Set Dialer
106106 Dialer client.Dialer
107107
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.
109110 Localhost string
110111
111112 // 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
573573 return b .writeBinlogDumpCommand (mysql.Position {Name : "" , Pos : 0 })
574574}
575575
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.
577578func (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 {
580584 return h
581585 }
582- return b . cfg . Localhost
586+ return h [: 255 ]
583587}
584588
585589func (b * BinlogSyncer ) writeRegisterSlaveCommand () error {
You can’t perform that action at this time.
0 commit comments