~percona-toolkit-dev/percona-toolkit/fix-886059-pt-heartbeat-timezones

« back to all changes in this revision

Viewing changes to bin/pt-slave-restart

Merge fix-change-master-bug-932614

Show diffs side-by-side

added added

removed removed

Lines of Context:
4693
4693
                    . $o->get('skip-count'));
4694
4694
   my $start      = $dbh->prepare($start_sql);
4695
4695
   my $stop       = $dbh->prepare('STOP SLAVE');
4696
 
   my $chmt       = $dbh->prepare(
4697
 
                    'CHANGE MASTER TO MASTER_LOG_FILE=?, MASTER_LOG_POS=?');
4698
 
 
4699
4696
 
4700
4697
   # ########################################################################
4701
4698
   # Lookup tables of things to do when a problem is detected.
4717
4714
         PTDEBUG && _d('Found relay log corruption');
4718
4715
         # Can't do CHANGE MASTER TO with a running slave.
4719
4716
         $stop->execute();
4720
 
         $chmt->execute(
4721
 
            @{$stat}{qw(relay_master_log_file exec_master_log_pos)});
 
4717
 
 
4718
         # Cannot use ? placeholders for CHANGE MASTER values:
 
4719
         # https://bugs.launchpad.net/percona-toolkit/+bug/932614
 
4720
         my $sql = "CHANGE MASTER TO "
 
4721
                 . "MASTER_LOG_FILE='$stat->{relay_master_log_file}', "
 
4722
                 . "MASTER_LOG_POS=$stat->{exec_master_log_pos}";
 
4723
         PTDEBUG && _d($sql);
 
4724
         $dbh->do($sql);
4722
4725
      },
4723
4726
      skip => sub {
4724
4727
         my ( $stat, $dbh ) = @_;
4940
4943
 
4941
4944
=head1 SYNOPSIS
4942
4945
 
4943
 
Usage: pt-slave-restart [OPTION...] [DSN]
 
4946
Usage: pt-slave-restart [OPTIONS] [DSN]
4944
4947
 
4945
4948
pt-slave-restart watches one or more MySQL replication slaves for
4946
4949
errors, and tries to restart replication if it stops.
4957
4960
need to.  If you use this tool carelessly, you might miss the chance to really
4958
4961
solve the slave server's problems.
4959
4962
 
4960
 
At the time of this release there is a bug that causes an invalid
4961
 
C<CHANGE MASTER TO> statement to be executed.
4962
 
 
4963
4963
The authoritative source for updated information is always the online issue
4964
4964
tracking system.  Issues that affect this tool will be marked as such.  You can
4965
4965
see a list of such issues at the following URL:
4974
4974
exponentially varying sleep time.  You can specify errors to skip and run the
4975
4975
slaves until a certain binlog position.
4976
4976
 
4977
 
Note: it has come to my attention that Yahoo! had or has an internal tool
4978
 
called fix_repl, described to me by a past Yahoo! employee and mentioned in
4979
 
the first edition of High Performance MySQL.  Apparently this tool does the
4980
 
same thing.  Make no mistake, though: this is not a way to "fix replication."
4981
 
In fact I would not even encourage its use on a regular basis; I use it only
4982
 
when I have an error I know I just need to skip past.
 
4977
Although this tool can help a slave advance past errors, you should not
 
4978
rely on it to "fix" replication.  If slave errors occur frequently or
 
4979
unexpectedly, you should identify and fix the root cause.
4983
4980
 
4984
4981
=head1 OUTPUT
4985
4982