LP #932614: pt-slave-restart CHANGE MASTER query causes error

Description

**Reported in Launchpad by Mrten last update 14-01-2013 22:17:04

This is very low priority I guess but had me confused for a few minutes.

I've got a crashed replication and thought 'what the hell, lets see what pt-slave-restart does on it'.

relevant excerpt of SHOW SLAVE STATUS:

Last_SQL_Errno: 1594
Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

This is the result:

root@miho:/var/log/mysql# pt-slave-restart
2012-02-15T10:50:28 mysqld-relay-bin.001752 56390555 1594
DBD::mysql::st execute failed: 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 ''56390410'' at line 1 [for Statement "CHANGE MASTER TO MASTER_LOG_FILE=?, MASTER_LOG_POS=?" with ParamValues: 0='mysql-bin.000142', 1='56390410'] at /usr/bin/pt-slave-restart line 2673.

"Huh? What's wrong with that query then?"

I understand why it doesn't work, and that it can't work, but perhaps there should be a list of errors that pt-slave-restart should refuse to run on?

Environment

None

Activity

Show:

lpjirasync 
January 24, 2018 at 3:14 PM

**Comment from Launchpad by: Daniel Nichter on: 12-12-2012 00:24:19

Creating the type of error that evokes a CHANGE MASTER is pretty difficult, so this is fixed but not tested. I'm 90% certain the fix is correct though. If anyone finds differently, please reply and we'll reopen this bug.

lpjirasync 
January 24, 2018 at 3:14 PM

**Comment from Launchpad by: Daniel Nichter on: 22-11-2012 18:36:24

I think this bug is due to placeholders not working for statements like CHANGE MASTER. For example, our MasterSlave module notes this:

  1. Just like with CHANGE MASTER TO, you can't quote the position.
    my $sql = "START SLAVE UNTIL MASTER_LOG_FILE='$pos->{file}', "
    . "MASTER_LOG_POS=$pos->{position}";

So pt-slave-restart shouldn't be using placeholders. Thus the status of this bug is "confirmed" but we have no ETA for its fix because we're the in the middle of many other tasks at the moment. We will fix it, but in the meantime, someone else could fix it by simply using quoted SQL statements like the above rather than a statement handle with ? placeholders.

lpjirasync 
January 24, 2018 at 3:14 PM

**Comment from Launchpad by: [[Plus] | https://launchpad.net/~cedric-peintre] on: 20-11-2012 10:13:20

Hello, what is the status of this bug?
I have exactly the same problem with one of my DB server (MySQL 5.5.28 Percona server)
Thx
Cédric

lpjirasync 
January 24, 2018 at 3:14 PM

**Comment from Launchpad by: Mrten on: 15-02-2012 09:57:01

Though I can't seem to find the bug in Launchpad?

lpjirasync 
January 24, 2018 at 3:14 PM

**Comment from Launchpad by: Mrten on: 15-02-2012 09:55:24

Erm. I think I should read the documentation before reporting. Sorry about that...

Done

Details

Assignee

Reporter

Priority

Created January 24, 2018 at 3:14 PM
Updated January 24, 2018 at 3:14 PM
Resolved January 24, 2018 at 3:14 PM