Buggy --slave-info code in innobackupex

Bug #1099323 reported by Alexey Kopytov
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Fix Released
Low
Alexey Kopytov
2.0
Won't Fix
Low
Unassigned
2.1
Fix Released
Low
Alexey Kopytov

Bug Description

innobackupex --slave-info executes the following code to get the master binlog coordinates for CHANGE MASTER TO written xtrabackup_slave_info:

    mysql_send 'SHOW SLAVE STATUS\G';

    # get output of the "show slave status" command from mysql output
    # and extract binlog position of the master server
    file_to_array($mysql_stdout, \@lines);
    for (@lines) {
        $master = $1 if /Master_Host:\s*(\S*)\s*$/;
        $filename = $1 if /Master_Log_File:\s*(\S*)\s*$/;
        $position = $1 if /Master_Log_Pos:\s*(\S*)\s*$/;
    }

That code works, but there's a couple of problems with it, making it dependent on specific SHOW SLAVE STATUS output format:

- we actually want to read Relay_Master_Log_File rather than Master_Log_File. And we do read it, but only because Relay_Master_Log_File happens to be after Master_Log_File in the SHOW SLAVE STATUS output, so the previously read Master_Log_File value (incorrect) is later overwritten by the Relay_Master_Log_File value (i.e. the correct one)

- there's no column in the SHOW SLAVE STATUS output named "Master_Log_Pos", but there are "Read_Master_Log_Pos" and "Exec_Master_Log_Pos". Again, we need the latter value for --slave-info, and we are just lucky it goes after Read_Master_Log_Pos.

The fix is to change the column names in the above code to not depend on specific order and other column naming in SHOW SLAVE STATUS.

Related branches

tags: added: low-hanging-fruit
description: updated
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXB-45

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.