~percona-toolkit-dev/percona-toolkit/fix-pqd-stats-bug-1249149

« back to all changes in this revision

Viewing changes to bin/pt-config-diff

  • Committer: Brian Fraser
  • Date: 2013-04-25 17:34:17 UTC
  • mfrom: (580.1.6 release-2.2.2)
  • Revision ID: brian.fraser@percona.com-20130425173417-ttqmxtw59h3dtt0r
Tags: 2.2.2
MergedĀ lp:~percona-toolkit-dev/percona-toolkit/release-2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
# ###########################################################################
43
43
{
44
44
package Percona::Toolkit;
45
 
our $VERSION = '2.2.1';
 
45
our $VERSION = '2.2.2';
46
46
 
47
47
1;
48
48
}
60
60
# ###########################################################################
61
61
{
62
62
package Lmo::Utils;
 
63
 
63
64
use strict;
64
65
use warnings qw( FATAL all );
65
66
require Exporter;
67
68
 
68
69
BEGIN {
69
70
   @ISA = qw(Exporter);
70
 
   @EXPORT = @EXPORT_OK = qw(_install_coderef _unimport_coderefs _glob_for _stash_for);
 
71
   @EXPORT = @EXPORT_OK = qw(
 
72
      _install_coderef
 
73
      _unimport_coderefs
 
74
      _glob_for
 
75
      _stash_for
 
76
   );
71
77
}
72
78
 
73
79
{
251
257
   return Lmo::Meta->new(class => $class);
252
258
}
253
259
 
254
 
 
255
260
1;
256
261
}
257
262
# ###########################################################################
2326
2331
   return $self->{hostname} || $self->{dsn_name} || 'unknown host';
2327
2332
}
2328
2333
 
 
2334
sub remove_duplicate_cxns {
 
2335
   my ($self, %args) = @_;
 
2336
   my @cxns     = @{$args{cxns}};
 
2337
   my $seen_ids = $args{seen_ids} || {};
 
2338
   PTDEBUG && _d("Removing duplicates from ", join(" ", map { $_->name } @cxns));
 
2339
   my @trimmed_cxns;
 
2340
 
 
2341
   for my $cxn ( @cxns ) {
 
2342
      my $dbh  = $cxn->dbh();
 
2343
      my $sql  = q{SELECT @@server_id};
 
2344
      PTDEBUG && _d($sql);
 
2345
      my ($id) = $dbh->selectrow_array($sql);
 
2346
      PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
 
2347
 
 
2348
      if ( ! $seen_ids->{$id}++ ) {
 
2349
         push @trimmed_cxns, $cxn
 
2350
      }
 
2351
      else {
 
2352
         PTDEBUG && _d("Removing ", $cxn->name,
 
2353
                       ", ID ", $id, ", because we've already seen it");
 
2354
      }
 
2355
   }
 
2356
 
 
2357
   return \@trimmed_cxns;
 
2358
}
 
2359
 
2329
2360
sub DESTROY {
2330
2361
   my ($self) = @_;
2331
2362
 
5664
5695
 
5665
5696
=head1 VERSION
5666
5697
 
5667
 
pt-config-diff 2.2.1
 
5698
pt-config-diff 2.2.2
5668
5699
 
5669
5700
=cut