~percona-toolkit-dev/percona-toolkit/fix-1168106-pqa-innodb_max_dirty_pages_pct-5.6

« back to all changes in this revision

Viewing changes to bin/pt-heartbeat

  • Committer: Daniel Nichter
  • Date: 2013-03-20 14:01:47 UTC
  • mfrom: (560.1.14 release-2.2.1)
  • Revision ID: daniel@percona.com-20130320140147-eiidvpo5zenar8hs
Merge release-2.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
# ###########################################################################
38
38
{
39
39
package Percona::Toolkit;
40
 
our $VERSION = '2.1.8';
 
40
our $VERSION = '2.2.1';
41
41
 
42
42
1;
43
43
}
5001
5001
 
5002
5002
      $heartbeat_sth = $dbh->prepare($heartbeat_sql);
5003
5003
 
 
5004
      my $ro_check = !!$o->get('check-read-only');
5004
5005
      $update_heartbeat = sub {
5005
5006
         my ($sth) = @_;
5006
5007
         my @vals;
 
5008
 
 
5009
         return if $ro_check && server_is_readonly($dbh);
5007
5010
        
5008
5011
         my $sql; 
5009
5012
         if ( @master_status_cols ) {
5252
5255
# Subroutines.
5253
5256
# ############################################################################
5254
5257
 
 
5258
sub server_is_readonly {
 
5259
   my ($dbh) = @_;
 
5260
   my ( $is_read_only ) = $dbh->selectrow_array(q{SELECT @@global.read_only});
 
5261
   if ( $is_read_only ) {
 
5262
      my ( $privs ) = eval { $dbh->selectrow_array(q{SHOW GRANTS}) };
 
5263
      if ( $privs && $privs =~ /\b(?:ALL|SUPER)\b/ ) {
 
5264
         $is_read_only = undef;
 
5265
      }
 
5266
   }
 
5267
   return $is_read_only;
 
5268
}
 
5269
 
5255
5270
# Check the delay on a single server.  Optionally recurse to all its slaves.
5256
5271
sub check_delay {
5257
5272
   my ( %args ) = @_;
5568
5583
their lag, too.  The hostname or IP and port for each slave is printed
5569
5584
before its delay.  L<"--recurse"> only works with MySQL.
5570
5585
 
 
5586
=item --check-read-only
 
5587
 
 
5588
Check if the server has read_only enabled; If it does, the tool skips doing
 
5589
any inserts.
 
5590
 
5571
5591
=item --config
5572
5592
 
5573
5593
type: Array
5910
5930
cause the tool to compute the lag incorrectly.  Specifying this option is
5911
5931
a good idea because it ensures that the tool works correctly regardless of
5912
5932
time zones, but it also makes the tool backwards-incompatible with
5913
 
pt-heartbeat 2.1.7 and older (unless the older version of pt-heartbeat
 
5933
pt-heartbeat 2.2.1 and older (unless the older version of pt-heartbeat
5914
5934
is running on a system that uses UTC).
5915
5935
 
5916
5936
=item --version
6092
6112
 
6093
6113
=head1 VERSION
6094
6114
 
6095
 
pt-heartbeat 2.1.8
 
6115
pt-heartbeat 2.2.1
6096
6116
 
6097
6117
=cut