Bug #64800 mysqldump with --include-master-host-port putting quotes around port number
Submitted: 29 Mar 2012 14:44 Modified: 31 Mar 2012 10:12
Reporter: Andy Pai Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:server: 5.5.15, mysqldump: 10.13, 5.6.6 OS:Linux
Assigned to:
Tags: Contribution, replication slave mysqldump
Triage: Needs Triage: D3 (Medium)

[29 Mar 2012 14:44] Andy Pai
Description:
I'm using mysqldump to extract data from an existing slave and load it into a new slave. I'm using --include-master-host-port to copy the master host and port definition from the existing slave to the new one. mysqldump is adding the host and port to the CHANGE MASTER TO command, but is putting quotes around the port number when it shouldn't be. When reading the dump file back in, mysql is expecting a number and not a string, and the restore is failing.

The error is:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''3306', MASTER_LOG_FILE='mysql-bin.NNNNNN', MASTER_LOG_POS=XXXXXXXXX' at line 1

How to repeat:
On an existing slave, run:

mysqldump --dump-slave --apply-slave-statements --include-master-host-port db table

for any database and table. The output will contain:

CHANGE MASTER TO MASTER_HOST='HOSTNAME', MASTER_PORT='3306', MASTER_LOG_FILE='mysql-bin.NNNNNN', MASTER_LOG_POS=XXXXXXXXX;

with quotes around the port number. The MASTER_PORT param should be "MASTER_PORT=3306" and not "MASTER_PORT='3306'".
[31 Mar 2012 10:12] Sveta Smirnova
Thank you for the report.

Verified as described. Test case for MTR:

--source include/master-slave.inc

connection slave;

--exec $MYSQL_DUMP_SLAVE --dump-slave --apply-slave-statements --include-master-host-port  test
[15 Jun 2012 5:00] Stewart Smith
patch to fix bug and test case

Attachment: bug64800.patch (text/x-patch), 1.69 KiB.

[15 Jun 2012 5:07] Stewart Smith
and the Percona Server bug report: https://bugs.launchpad.net/percona-server/+bug/1013432