~hingo/percona-toolkit/pqd-mongodb-24

« back to all changes in this revision

Viewing changes to bin/pt-query-advisor

  • Committer: Brian Fraser
  • Date: 2012-12-21 17:38:09 UTC
  • mto: (503.1.16 2.1)
  • mto: This revision was merged to the branch mainline in revision 508.
  • Revision ID: brian.fraser@percona.com-20121221173809-tmpa3gotcs1qbd1x
BuildĀ percona-toolkit-2.1.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
# ###########################################################################
47
47
{
48
48
package Percona::Toolkit;
49
 
our $VERSION = '2.1.7';
 
49
our $VERSION = '2.1.8';
50
50
 
51
51
1;
52
52
}
1727
1727
 
1728
1728
            if ( !$found_arg && $pos == $len ) {
1729
1729
               PTDEBUG && _d("Did not find arg, looking for special cases");
1730
 
               local $INPUT_RECORD_SEPARATOR = ";\n";
 
1730
               local $INPUT_RECORD_SEPARATOR = ";\n";  # get next line
1731
1731
               if ( defined(my $l = $next_event->()) ) {
1732
 
                  chomp $l;
1733
 
                  $l =~ s/^\s+//;
1734
 
                  PTDEBUG && _d("Found admin statement", $l);
1735
 
                  push @properties, 'cmd', 'Admin', 'arg', $l;
1736
 
                  push @properties, 'bytes', length($properties[-1]);
1737
 
                  $found_arg++;
 
1732
                  if ( $l =~ /^\s*[A-Z][a-z_]+: / ) {
 
1733
                     PTDEBUG && _d("Found NULL query before", $l);
 
1734
                     local $INPUT_RECORD_SEPARATOR = ";\n#";
 
1735
                     my $rest_of_event = $next_event->();
 
1736
                     push @{$self->{pending}}, $l . $rest_of_event;
 
1737
                     push @properties, 'cmd', 'Query', 'arg', '/* No query */';
 
1738
                     push @properties, 'bytes', 0;
 
1739
                     $found_arg++;
 
1740
                  }
 
1741
                  else {
 
1742
                     chomp $l;
 
1743
                     $l =~ s/^\s+//;
 
1744
                     PTDEBUG && _d("Found admin statement", $l);
 
1745
                     push @properties, 'cmd', 'Admin', 'arg', $l;
 
1746
                     push @properties, 'bytes', length($properties[-1]);
 
1747
                     $found_arg++;
 
1748
                  }
1738
1749
               }
1739
1750
               else {
1740
1751
                  PTDEBUG && _d("I can't figure out what to do with this line");
1890
1901
               $cmd = $arg;
1891
1902
            }
1892
1903
            else {
1893
 
               my ($user, undef, $db) = $arg =~ /(\S+)/g;
 
1904
               my ($user) = $arg =~ m/(\S+)/;
 
1905
               my ($db)   = $arg =~ m/on (\S+)/;
1894
1906
               my $host;
1895
1907
               ($user, $host) = split(/@/, $user);
1896
1908
               PTDEBUG && _d('Connect', $user, '@', $host, 'on', $db);
2907
2919
                     . (defined $f ? '%09.6f' : '%02d'),
2908
2920
                     $y + 2000, $m, $d, $h, $i, (defined $f ? $s + $f : $s);
2909
2921
   }
 
2922
   elsif ( $val =~ m/^$proper_ts$/ ) {
 
2923
      return $val;
 
2924
   }
2910
2925
   return $val;
2911
2926
}
2912
2927
 
8713
8728
 
8714
8729
=head1 VERSION
8715
8730
 
8716
 
pt-query-advisor 2.1.7
 
8731
pt-query-advisor 2.1.8
8717
8732
 
8718
8733
=cut