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

Reported by Alexey Kopytov on 2013-01-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup
High
Sergei Glushchenko
2.0
High
Sergei Glushchenko
2.1
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.

Alexey Kopytov (akopytov) wrote :

This is a request from services.

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 = '';

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

Other bug subscribers