pt-slave-restart CHANGE MASTER query causes error

Reported by Mrten on 2012-02-15
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Percona Toolkit
Medium
Daniel Nichter

Bug Description

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?

Mrten (bugzilla-ii) wrote :

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

Mrten (bugzilla-ii) wrote :

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

tags: added: pt-slave-restart
tags: added: crash wrong-sql
Changed in percona-toolkit:
status: New → Confirmed
[Plus] (cedric-peintre) wrote :

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

Daniel Nichter (daniel-nichter) wrote :

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

      # 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.

Changed in percona-toolkit:
milestone: none → 2.1.8
importance: Undecided → Medium
Changed in percona-toolkit:
assignee: nobody → Daniel Nichter (daniel-nichter)
summary: - pt-slave-restart slightly confusing error if slave crashed
+ pt-slave-restart CHANGE MASTER query causes error
Daniel Nichter (daniel-nichter) wrote :

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.

Changed in percona-toolkit:
status: Confirmed → Fix Committed
Changed in percona-toolkit:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers