Unnecessary long sleep() in innobackupex leads to FTWRL taking too long

Bug #1095551 reported by Alexey Kopytov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Fix Released
High
Sergei Glushchenko
2.0
Fix Released
High
Sergei Glushchenko
2.1
Fix Released
High
Sergei Glushchenko

Bug Description

sub mysql_lockall() {
...
        mysql_send "FLUSH TABLES WITH READ LOCK;";
...
        mysql_send "COMMIT;";
...
        write_binlog_info;
...
        write_galera_info if $option_galera_info;
...
}

sub write_binlog_info {
...
     mysql_send 'SHOW MASTER STATUS\G';
...
}

sub write_galera_info {
...
     mysql_send "SHOW STATUS LIKE 'wsrep_local_state_uuid';";
...
      mysql_send "SHOW STATUS LIKE 'wsrep_last_committed';";
...
}

sub write_slave_info {
...
      mysql_send 'SHOW SLAVE STATUS\G';
...
}

sub mysql_unlockall {
...
     mysql_send "UNLOCK TABLES;";
...
}

sub mysql_send {
...
     mysql_ping(0);
...
}

sub mysql_ping {
...
              sleep 2;
...
}

Which means, for a PXC node, there are 7 mysql_ping calls amounting to 14 seconds of sleep time under FTWRL.

Possible fixes in the order of ascending complexity:

1. Decrease the sleep value and use usleep().
2. Make innobackupex use a real DB interface
3. Get rid of innobackupex by merging it with the xtrabackup binary.

Related branches

Revision history for this message
Alexey Kopytov (akopytov) wrote :

This is a request from services.

Revision history for this message
Alexey Kopytov (akopytov) wrote :

Fix #1 is:

@@ -18,6 +18,7 @@
 use File::Find;
 use File::Copy;
 use English qw(-no_match_vars);
+use Time::HiRes qw(usleep);

 # version of this script
 my $innobackup_version = '1.5.1-xtrabackup';
@@ -1179,7 +1180,7 @@
         my $stderr = '';
         alarm $mysql_response_timeout;
         while (index($stdout, $hello_message) < 0) {
- sleep 2;
+ usleep(100000);
             if ($mysql_pid && $mysql_pid == waitpid($mysql_pid, &WNOHANG)) {
                 my $reason = `cat $mysql_stderr`;
                 $mysql_pid = '';

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-350

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.