This repository has been archived by the owner on Feb 15, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go livesql/binlog: set Localhost in binlogSyncerConfig
This sets the localhost field of the BinlogSyncerConfig. If unset, as it was, it will use the os.Hostname() value as the hostname instead. In rare situations, the OS's hostname could be too long for the slave host's "host" field, and we got an error like: panic: ERROR 1105 (HY000): Failed to register slave: too long 'report-host' which would crash the server. So we strip the hostname to be 60 characters, which is the max allowed length. It doesn't seem like the hostname of the slave hosts matters that much; Verified everything still worked as expected. We could hardcode "localhost" here as the host name but are keeping the OS's hostname in case it's useful for debugging on remote hosts. To see the hostname of slave hosts: mysql> show slave hosts; +------------+--------------------------+------+-----------+------------+ | Server_id | Host | Port | Master_id | Slave_UUID | +------------+--------------------------+------+-----------+------------+ | 2926146535 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4101280766 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 738891311 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3490062834 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3176772553 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 985189460 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4240725287 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 2752132824 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3221796892 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3038601891 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | +------------+--------------------------+------+-----------+------------+ Also see go-mysql-org/go-mysql#388
- Loading branch information