~percona-toolkit-dev/percona-toolkit/fix-pt-heartbeat-dupe-key-bug-1004567

« back to all changes in this revision

Viewing changes to lib/Processlist.pm

  • Committer: Daniel Nichter
  • Date: 2012-07-19 17:20:29 UTC
  • mfrom: (311.1.4 pt-kill-log-dsn)
  • Revision ID: daniel@percona.com-20120719172029-phhcv6w3oufo57b8
Merge pt-kill-log-dsn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
      last_poll   => 0,
76
76
      active_cxn  => {},  # keyed off ID
77
77
      event_cache => [],
 
78
      _reasons_for_matching => {},
78
79
   };
79
80
   return bless $self, $class;
80
81
}
475
476
            PTDEBUG && _d("Query isn't running long enough");
476
477
            next QUERY;
477
478
         }
478
 
         PTDEBUG && _d('Exceeds busy time');
 
479
         my $reason = 'Exceeds busy time';
 
480
         PTDEBUG && _d($reason);
 
481
         # Saving the reasons for each query in the objct is a bit nasty,
 
482
         # but the alternatives are worse:
 
483
         # - Saving internal data in the query
 
484
         # - Instead of using the stringified hashref as a key, using
 
485
         #   a checksum of the hashes' contents. Which could occasionally
 
486
         #   fail miserably due to timing-related issues.
 
487
         push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
479
488
         $matched++;
480
489
      }
481
490
 
486
495
            PTDEBUG && _d("Query isn't idle long enough");
487
496
            next QUERY;
488
497
         }
489
 
         PTDEBUG && _d('Exceeds idle time');
 
498
         my $reason = 'Exceeds idle time';
 
499
         PTDEBUG && _d($reason);
 
500
         push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
490
501
         $matched++;
491
502
      }
492
503
 
507
518
               PTDEBUG && _d('Query does not match', $property, 'spec');
508
519
               next QUERY;
509
520
            }
510
 
            PTDEBUG && _d('Query matches', $property, 'spec');
 
521
            my $reason = 'Query matches ' . $property . ' spec';
 
522
            PTDEBUG && _d($reason);
 
523
            push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
511
524
            $matched++;
512
525
         }
513
526
      }