~percona-toolkit-dev/percona-toolkit/fix-zombie-bug-919819

« back to all changes in this revision

Viewing changes to lib/CompareWarnings.pm

  • Committer: Daniel Nichter
  • Date: 2012-01-19 19:46:56 UTC
  • Revision ID: daniel@percona.com-20120119194656-3l1nzgtq1p7xvigo
Replace MKDEBUG with PTDEBUG in modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
use strict;
26
26
use warnings FATAL => 'all';
27
27
use English qw(-no_match_vars);
28
 
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
 
28
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
29
29
 
30
30
use Data::Dumper;
31
31
$Data::Dumper::Indent    = 1;
76
76
 
77
77
   if ( my $tbl = $self->{'clear-warnings-table'} ) {
78
78
      $sql = "SELECT * FROM $tbl LIMIT 1";
79
 
      MKDEBUG && _d($sql);
 
79
      PTDEBUG && _d($sql);
80
80
      eval {
81
81
         $dbh->do($sql);
82
82
      };
91
91
      TABLE:
92
92
      foreach my $tbl ( @tbls ) {
93
93
         $sql = "SELECT * FROM $tbl LIMIT 1";
94
 
         MKDEBUG && _d($sql);
 
94
         PTDEBUG && _d($sql);
95
95
         eval {
96
96
            $dbh->do($sql);
97
97
         };
98
98
         if ( $EVAL_ERROR ) {
99
 
            MKDEBUG && _d('Failed to clear warnings');
 
99
            PTDEBUG && _d('Failed to clear warnings');
100
100
         }
101
101
         else {
102
 
            MKDEBUG && _d('Cleared warnings');
 
102
            PTDEBUG && _d('Cleared warnings');
103
103
            $ok = 1;
104
104
            last TABLE;
105
105
         }
128
128
   my ($event, $dbh) = @args{@required_args};
129
129
 
130
130
   if ( exists $event->{Query_time} ) {
131
 
      MKDEBUG && _d('Query already executed');
 
131
      PTDEBUG && _d('Query already executed');
132
132
      return $event;
133
133
   }
134
134
 
135
 
   MKDEBUG && _d('Executing query');
 
135
   PTDEBUG && _d('Executing query');
136
136
   my $query = $event->{arg};
137
137
   my ( $start, $end, $query_time );
138
138
 
215
215
      my $event = $events->[$i];
216
216
 
217
217
      if ( ($event0->{warning_count} || 0) != ($event->{warning_count} || 0) ) {
218
 
         MKDEBUG && _d('Warning counts differ:',
 
218
         PTDEBUG && _d('Warning counts differ:',
219
219
            $event0->{warning_count}, $event->{warning_count});
220
220
         $different_warning_counts++;
221
221
         $self->{diffs}->{warning_counts}->{$item}->{$sampleno}
233
233
      foreach my $code ( keys %$w0 ) {
234
234
         if ( exists $w->{$code} ) {
235
235
            if ( $w->{$code}->{Level} ne $w0->{$code}->{Level} ) {
236
 
               MKDEBUG && _d('Warning levels differ:',
 
236
               PTDEBUG && _d('Warning levels differ:',
237
237
                  $w0->{$code}->{Level}, $w->{$code}->{Level});
238
238
               # Save differences.
239
239
               $different_warning_levels++;
246
246
         }
247
247
         else {
248
248
            # This warning code is on event0 but not on this event.
249
 
            MKDEBUG && _d('Warning gone:', $w0->{$code}->{Message});
 
249
            PTDEBUG && _d('Warning gone:', $w0->{$code}->{Message});
250
250
            # Save differences.
251
251
            $different_warnings++;
252
252
            $self->{diffs}->{warnings}->{$item}->{$sampleno}
258
258
      # Any warning codes on this event not deleted above are new;
259
259
      # i.e. they weren't on event0.
260
260
      foreach my $code ( keys %$w ) {
261
 
         MKDEBUG && _d('Warning new:', $w->{$code}->{Message});
 
261
         PTDEBUG && _d('Warning new:', $w->{$code}->{Message});
262
262
         # Save differences.
263
263
         $different_warnings++;
264
264
         $self->{diffs}->{warnings}->{$item}->{$sampleno}