Merge lp:~percona-toolkit-dev/percona-toolkit/release-2.2.10 into lp:percona-toolkit/2.2

Proposed by Tomislav Plavcic
Status: Merged
Merged at revision: 609
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.10
Merge into: lp:percona-toolkit/2.2
Diff against target: 1855 lines (+521/-273)
57 files modified
Changelog (+9/-1)
Makefile.PL (+1/-1)
bin/pt-align (+1/-1)
bin/pt-archiver (+2/-2)
bin/pt-config-diff (+2/-2)
bin/pt-deadlock-logger (+2/-2)
bin/pt-diskstats (+2/-2)
bin/pt-duplicate-key-checker (+2/-2)
bin/pt-fifo-split (+1/-1)
bin/pt-find (+2/-2)
bin/pt-fingerprint (+1/-1)
bin/pt-fk-error-logger (+2/-2)
bin/pt-heartbeat (+2/-2)
bin/pt-index-usage (+25/-11)
bin/pt-ioprofile (+1/-1)
bin/pt-kill (+2/-2)
bin/pt-mext (+3/-2)
bin/pt-mysql-summary (+3/-2)
bin/pt-online-schema-change (+45/-37)
bin/pt-pmp (+1/-1)
bin/pt-query-digest (+14/-8)
bin/pt-show-grants (+1/-1)
bin/pt-sift (+1/-1)
bin/pt-slave-delay (+2/-2)
bin/pt-slave-find (+1/-1)
bin/pt-slave-restart (+2/-2)
bin/pt-stalk (+1/-1)
bin/pt-summary (+3/-2)
bin/pt-table-checksum (+43/-19)
bin/pt-table-sync (+2/-2)
bin/pt-table-usage (+42/-17)
bin/pt-upgrade (+25/-11)
bin/pt-variable-advisor (+2/-2)
bin/pt-visual-explain (+1/-1)
config/deb/changelog (+11/-0)
config/sphinx-build/conf.py (+1/-1)
docs/percona-toolkit.pod (+1/-1)
docs/release_notes.rst (+29/-0)
lib/MySQLStatusWaiter.pm (+3/-2)
lib/Percona/Toolkit.pm (+1/-1)
lib/RowChecksum.pm (+22/-13)
lib/SlowLogParser.pm (+14/-6)
lib/bash/parse_options.sh (+2/-1)
t/lib/MySQLStatusWaiter.t (+18/-14)
t/lib/SlowLogParser.t (+64/-0)
t/lib/samples/slowlogs/slow060.txt (+10/-0)
t/lib/samples/slowlogs/slow061.txt (+10/-0)
t/pt-online-schema-change/bug-1315130.t (+0/-78)
t/pt-online-schema-change/bugs.t (+64/-0)
t/pt-online-schema-change/samples/bug-1340728.sql (+10/-0)
t/pt-online-schema-change/samples/bug-1340728_cleanup.sql (+2/-0)
t/pt-query-digest/since_until.t (+3/-3)
t/pt-table-checksum/basics.t (+3/-2)
t/pt-table-checksum/samples/default-results-5.5.txt (+1/-1)
t/pt-table-checksum/samples/default-results-5.6.txt (+1/-1)
t/pt-table-checksum/samples/static-chunk-size-results-5.5.txt (+1/-1)
t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt (+1/-1)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/release-2.2.10
Reviewer Review Type Date Requested Status
Daniel Nichter Pending
Review via email: mp+230115@code.launchpad.net

Description of the change

Release branch for Percona Toolkit version 2.2.10

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Changelog'
--- Changelog 2014-07-08 12:06:12 +0000
+++ Changelog 2014-08-08 14:10:17 +0000
@@ -1,8 +1,16 @@
1Changelog for Percona Toolkit1Changelog for Percona Toolkit
22
3v2.2.10 released 2014-08-06
4
5 * Fixed bug 1287253: pt-table-checksum deadlock
6 * Fixed bug 1299387: 5.6 slow query log Thead_id becomes Id
7 * Fixed bug 1311654: pt-table-checksum + PXC inconsistent results upon --resume
8 * Fixed bug 1340728: pt-online-schema-change doesn't work with HASH indexes
9 * Fixed bug 1253872: pt-table-checksum max load 20% rounds down
10 * Fixed bug 1340364: some shell tools output error when queried for --version
11
3v2.2.9 released 2014-07-0812v2.2.9 released 2014-07-08
413
5
6 * Fixed bug 1258135: pt-deadlock-logger introduces a noise to MySQL14 * Fixed bug 1258135: pt-deadlock-logger introduces a noise to MySQL
7 * Fixed bug 1329422: pt-online-schema-change foreign-keys-method=none breaks constraints 15 * Fixed bug 1329422: pt-online-schema-change foreign-keys-method=none breaks constraints
8 * Fixed bug 1315130: pt-online-schema-change not properly detecting foreign keys 16 * Fixed bug 1315130: pt-online-schema-change not properly detecting foreign keys
917
=== modified file 'Makefile.PL'
--- Makefile.PL 2014-07-08 12:06:12 +0000
+++ Makefile.PL 2014-08-08 14:10:17 +0000
@@ -2,7 +2,7 @@
22
3WriteMakefile(3WriteMakefile(
4 NAME => 'percona-toolkit',4 NAME => 'percona-toolkit',
5 VERSION => '2.2.9',5 VERSION => '2.2.10',
6 EXE_FILES => [ <bin/*> ],6 EXE_FILES => [ <bin/*> ],
7 MAN1PODS => {7 MAN1PODS => {
8 'docs/percona-toolkit.pod' => 'blib/man1/percona-toolkit.1p',8 'docs/percona-toolkit.pod' => 'blib/man1/percona-toolkit.1p',
99
=== modified file 'bin/pt-align'
--- bin/pt-align 2014-07-04 17:16:08 +0000
+++ bin/pt-align 2014-08-08 14:10:17 +0000
@@ -1323,6 +1323,6 @@
13231323
1324=head1 VERSION1324=head1 VERSION
13251325
1326pt-align 2.2.91326pt-align 2.2.10
13271327
1328=cut1328=cut
13291329
=== modified file 'bin/pt-archiver'
--- bin/pt-archiver 2014-07-04 17:16:08 +0000
+++ bin/pt-archiver 2014-08-08 14:10:17 +0000
@@ -43,7 +43,7 @@
43{43{
44package Percona::Toolkit;44package Percona::Toolkit;
4545
46our $VERSION = '2.2.9';46our $VERSION = '2.2.10';
4747
48use strict;48use strict;
49use warnings FATAL => 'all';49use warnings FATAL => 'all';
@@ -7892,6 +7892,6 @@
78927892
7893=head1 VERSION7893=head1 VERSION
78947894
7895pt-archiver 2.2.97895pt-archiver 2.2.10
78967896
7897=cut7897=cut
78987898
=== modified file 'bin/pt-config-diff'
--- bin/pt-config-diff 2014-07-04 17:16:08 +0000
+++ bin/pt-config-diff 2014-08-08 14:10:17 +0000
@@ -43,7 +43,7 @@
43{43{
44package Percona::Toolkit;44package Percona::Toolkit;
4545
46our $VERSION = '2.2.9';46our $VERSION = '2.2.10';
4747
48use strict;48use strict;
49use warnings FATAL => 'all';49use warnings FATAL => 'all';
@@ -5733,6 +5733,6 @@
57335733
5734=head1 VERSION5734=head1 VERSION
57355735
5736pt-config-diff 2.2.95736pt-config-diff 2.2.10
57375737
5738=cut5738=cut
57395739
=== modified file 'bin/pt-deadlock-logger'
--- bin/pt-deadlock-logger 2014-07-04 17:16:08 +0000
+++ bin/pt-deadlock-logger 2014-08-08 14:10:17 +0000
@@ -42,7 +42,7 @@
42{42{
43package Percona::Toolkit;43package Percona::Toolkit;
4444
45our $VERSION = '2.2.9';45our $VERSION = '2.2.10';
4646
47use strict;47use strict;
48use warnings FATAL => 'all';48use warnings FATAL => 'all';
@@ -5523,6 +5523,6 @@
55235523
5524=head1 VERSION5524=head1 VERSION
55255525
5526pt-deadlock-logger 2.2.95526pt-deadlock-logger 2.2.10
55275527
5528=cut5528=cut
55295529
=== modified file 'bin/pt-diskstats'
--- bin/pt-diskstats 2014-07-04 17:16:08 +0000
+++ bin/pt-diskstats 2014-08-08 14:10:17 +0000
@@ -38,7 +38,7 @@
38{38{
39package Percona::Toolkit;39package Percona::Toolkit;
4040
41our $VERSION = '2.2.9';41our $VERSION = '2.2.10';
4242
43use strict;43use strict;
44use warnings FATAL => 'all';44use warnings FATAL => 'all';
@@ -5579,6 +5579,6 @@
55795579
5580=head1 VERSION5580=head1 VERSION
55815581
5582pt-diskstats 2.2.95582pt-diskstats 2.2.10
55835583
5584=cut5584=cut
55855585
=== modified file 'bin/pt-duplicate-key-checker'
--- bin/pt-duplicate-key-checker 2014-07-04 17:16:08 +0000
+++ bin/pt-duplicate-key-checker 2014-08-08 14:10:17 +0000
@@ -39,7 +39,7 @@
39{39{
40package Percona::Toolkit;40package Percona::Toolkit;
4141
42our $VERSION = '2.2.9';42our $VERSION = '2.2.10';
4343
44use strict;44use strict;
45use warnings FATAL => 'all';45use warnings FATAL => 'all';
@@ -5600,6 +5600,6 @@
56005600
5601=head1 VERSION5601=head1 VERSION
56025602
5603pt-duplicate-key-checker 2.2.95603pt-duplicate-key-checker 2.2.10
56045604
5605=cut5605=cut
56065606
=== modified file 'bin/pt-fifo-split'
--- bin/pt-fifo-split 2014-07-04 17:16:08 +0000
+++ bin/pt-fifo-split 2014-08-08 14:10:17 +0000
@@ -1612,6 +1612,6 @@
16121612
1613=head1 VERSION1613=head1 VERSION
16141614
1615pt-fifo-split 2.2.91615pt-fifo-split 2.2.10
16161616
1617=cut1617=cut
16181618
=== modified file 'bin/pt-find'
--- bin/pt-find 2014-07-04 17:16:08 +0000
+++ bin/pt-find 2014-08-08 14:10:17 +0000
@@ -35,7 +35,7 @@
35{35{
36package Percona::Toolkit;36package Percona::Toolkit;
3737
38our $VERSION = '2.2.9';38our $VERSION = '2.2.10';
3939
40use strict;40use strict;
41use warnings FATAL => 'all';41use warnings FATAL => 'all';
@@ -4984,6 +4984,6 @@
49844984
4985=head1 VERSION4985=head1 VERSION
49864986
4987pt-find 2.2.94987pt-find 2.2.10
49884988
4989=cut4989=cut
49904990
=== modified file 'bin/pt-fingerprint'
--- bin/pt-fingerprint 2014-07-04 17:16:08 +0000
+++ bin/pt-fingerprint 2014-08-08 14:10:17 +0000
@@ -2203,6 +2203,6 @@
22032203
2204=head1 VERSION2204=head1 VERSION
22052205
2206pt-fingerprint 2.2.92206pt-fingerprint 2.2.10
22072207
2208=cut2208=cut
22092209
=== modified file 'bin/pt-fk-error-logger'
--- bin/pt-fk-error-logger 2014-07-04 17:16:08 +0000
+++ bin/pt-fk-error-logger 2014-08-08 14:10:17 +0000
@@ -37,7 +37,7 @@
37{37{
38package Percona::Toolkit;38package Percona::Toolkit;
3939
40our $VERSION = '2.2.9';40our $VERSION = '2.2.10';
4141
42use strict;42use strict;
43use warnings FATAL => 'all';43use warnings FATAL => 'all';
@@ -4509,6 +4509,6 @@
45094509
4510=head1 VERSION4510=head1 VERSION
45114511
4512pt-fk-error-logger 2.2.94512pt-fk-error-logger 2.2.10
45134513
4514=cut4514=cut
45154515
=== modified file 'bin/pt-heartbeat'
--- bin/pt-heartbeat 2014-07-04 17:16:08 +0000
+++ bin/pt-heartbeat 2014-08-08 14:10:17 +0000
@@ -38,7 +38,7 @@
38{38{
39package Percona::Toolkit;39package Percona::Toolkit;
4040
41our $VERSION = '2.2.9';41our $VERSION = '2.2.10';
4242
43use strict;43use strict;
44use warnings FATAL => 'all';44use warnings FATAL => 'all';
@@ -6192,6 +6192,6 @@
61926192
6193=head1 VERSION6193=head1 VERSION
61946194
6195pt-heartbeat 2.2.96195pt-heartbeat 2.2.10
61966196
6197=cut6197=cut
61986198
=== modified file 'bin/pt-index-usage'
--- bin/pt-index-usage 2014-07-04 17:16:08 +0000
+++ bin/pt-index-usage 2014-08-08 14:10:17 +0000
@@ -45,7 +45,7 @@
45{45{
46package Percona::Toolkit;46package Percona::Toolkit;
4747
48our $VERSION = '2.2.9';48our $VERSION = '2.2.10';
4949
50use strict;50use strict;
51use warnings FATAL => 'all';51use warnings FATAL => 'all';
@@ -2772,12 +2772,13 @@
2772 my ( $class ) = @_;2772 my ( $class ) = @_;
2773 my $self = {2773 my $self = {
2774 pending => [],2774 pending => [],
2775 last_event_offset => undef,
2775 };2776 };
2776 return bless $self, $class;2777 return bless $self, $class;
2777}2778}
27782779
2779my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;2780my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;
2780my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]/;2781my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]\s*(?:Id:\s*(\d+))?/;
2781my $slow_log_hd_line = qr{2782my $slow_log_hd_line = qr{
2782 ^(?:2783 ^(?:
2783 T[cC][pP]\s[pP]ort:\s+\d+ # case differs on windows/unix2784 T[cC][pP]\s[pP]ort:\s+\d+ # case differs on windows/unix
@@ -2808,6 +2809,7 @@
2808 or defined($stmt = $next_event->())2809 or defined($stmt = $next_event->())
2809 ) {2810 ) {
2810 my @properties = ('cmd', 'Query', 'pos_in_log', $pos_in_log);2811 my @properties = ('cmd', 'Query', 'pos_in_log', $pos_in_log);
2812 $self->{last_event_offset} = $pos_in_log;
2811 $pos_in_log = $tell->();2813 $pos_in_log = $tell->();
28122814
2813 if ( $stmt =~ s/$slow_log_hd_line//go ){ # Throw away header lines in log2815 if ( $stmt =~ s/$slow_log_hd_line//go ){ # Throw away header lines in log
@@ -2840,19 +2842,25 @@
2840 push @properties, 'ts', $time;2842 push @properties, 'ts', $time;
2841 ++$got_ts;2843 ++$got_ts;
2842 if ( !$got_uh2844 if ( !$got_uh
2843 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )2845 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
2844 ) {2846 ) {
2845 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);2847 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
2846 push @properties, 'user', $user, 'host', $host, 'ip', $ip;2848 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
2847 ++$got_uh;2849 if ( $thread_id ) {
2850 push @properties, 'Thread_id', $thread_id;
2851 }
2852 ++$got_uh;
2848 }2853 }
2849 }2854 }
28502855
2851 elsif ( !$got_uh2856 elsif ( !$got_uh
2852 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )2857 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
2853 ) {2858 ) {
2854 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);2859 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
2855 push @properties, 'user', $user, 'host', $host, 'ip', $ip;2860 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
2861 if ( $thread_id ) {
2862 push @properties, 'Thread_id', $thread_id;
2863 }
2856 ++$got_uh;2864 ++$got_uh;
2857 }2865 }
28582866
@@ -2933,9 +2941,15 @@
29332941
2934 PTDEBUG && _d('Properties of event:', Dumper(\@properties));2942 PTDEBUG && _d('Properties of event:', Dumper(\@properties));
2935 my $event = { @properties };2943 my $event = { @properties };
2936 if ( $args{stats} ) {2944 if ( !$event->{arg} ) {
2937 $args{stats}->{events_read}++;2945 PTDEBUG && _d('Partial event, no arg');
2938 $args{stats}->{events_parsed}++;2946 }
2947 else {
2948 $self->{last_event_offset} = undef;
2949 if ( $args{stats} ) {
2950 $args{stats}->{events_read}++;
2951 $args{stats}->{events_parsed}++;
2952 }
2939 }2953 }
2940 return $event;2954 return $event;
2941 } # EVENT2955 } # EVENT
@@ -7532,6 +7546,6 @@
75327546
7533=head1 VERSION7547=head1 VERSION
75347548
7535pt-index-usage 2.2.97549pt-index-usage 2.2.10
75367550
7537=cut7551=cut
75387552
=== modified file 'bin/pt-ioprofile'
--- bin/pt-ioprofile 2014-07-04 17:16:08 +0000
+++ bin/pt-ioprofile 2014-08-08 14:10:17 +0000
@@ -1119,7 +1119,7 @@
11191119
1120=head1 VERSION1120=head1 VERSION
11211121
1122pt-ioprofile 2.2.91122pt-ioprofile 2.2.10
11231123
1124=cut1124=cut
11251125
11261126
=== modified file 'bin/pt-kill'
--- bin/pt-kill 2014-07-04 17:16:08 +0000
+++ bin/pt-kill 2014-08-08 14:10:17 +0000
@@ -47,7 +47,7 @@
47{47{
48package Percona::Toolkit;48package Percona::Toolkit;
4949
50our $VERSION = '2.2.9';50our $VERSION = '2.2.10';
5151
52use strict;52use strict;
53use warnings FATAL => 'all';53use warnings FATAL => 'all';
@@ -8183,6 +8183,6 @@
81838183
8184=head1 VERSION8184=head1 VERSION
81858185
8186pt-kill 2.2.98186pt-kill 2.2.10
81878187
8188=cut8188=cut
81898189
=== modified file 'bin/pt-mext'
--- bin/pt-mext 2014-07-04 17:16:08 +0000
+++ bin/pt-mext 2014-08-08 14:10:17 +0000
@@ -127,9 +127,10 @@
127127
128usage_or_errors() {128usage_or_errors() {
129 local file="$1"129 local file="$1"
130 local version=""
130131
131 if [ "$OPT_VERSION" ]; then132 if [ "$OPT_VERSION" ]; then
132 local version=$(grep '^pt-[^ ]\+ [0-9]' "$file")133 version=$(grep '^pt-[^ ]\+ [0-9]' "$file")
133 echo "$version"134 echo "$version"
134 return 1135 return 1
135 fi136 fi
@@ -791,7 +792,7 @@
791792
792=head1 VERSION793=head1 VERSION
793794
794pt-mext 2.2.9795pt-mext 2.2.10
795796
796=cut797=cut
797798
798799
=== modified file 'bin/pt-mysql-summary'
--- bin/pt-mysql-summary 2014-07-04 17:16:08 +0000
+++ bin/pt-mysql-summary 2014-08-08 14:10:17 +0000
@@ -88,9 +88,10 @@
8888
89usage_or_errors() {89usage_or_errors() {
90 local file="$1"90 local file="$1"
91 local version=""
9192
92 if [ "$OPT_VERSION" ]; then93 if [ "$OPT_VERSION" ]; then
93 local version=$(grep '^pt-[^ ]\+ [0-9]' "$file")94 version=$(grep '^pt-[^ ]\+ [0-9]' "$file")
94 echo "$version"95 echo "$version"
95 return 196 return 1
96 fi97 fi
@@ -3089,7 +3090,7 @@
30893090
3090=head1 VERSION3091=head1 VERSION
30913092
3092pt-mysql-summary 2.2.93093pt-mysql-summary 2.2.10
30933094
3094=cut3095=cut
30953096
30963097
=== modified file 'bin/pt-online-schema-change'
--- bin/pt-online-schema-change 2014-07-04 17:16:08 +0000
+++ bin/pt-online-schema-change 2014-08-08 14:10:17 +0000
@@ -54,7 +54,7 @@
54{54{
55package Percona::Toolkit;55package Percona::Toolkit;
5656
57our $VERSION = '2.2.9';57our $VERSION = '2.2.10';
5858
59use strict;59use strict;
60use warnings FATAL => 'all';60use warnings FATAL => 'all';
@@ -4785,6 +4785,7 @@
47854785
4786use strict;4786use strict;
4787use warnings FATAL => 'all';4787use warnings FATAL => 'all';
4788use POSIX qw( ceil );
4788use English qw(-no_match_vars);4789use English qw(-no_match_vars);
4789use constant PTDEBUG => $ENV{PTDEBUG} || 0;4790use constant PTDEBUG => $ENV{PTDEBUG} || 0;
47904791
@@ -4950,8 +4951,8 @@
4950 }4951 }
4951 else {4952 else {
4952 PTDEBUG && _d('Initial', $var, 'value:', $init_val);4953 PTDEBUG && _d('Initial', $var, 'value:', $init_val);
4953 $val = int(($init_val * $threshold_factor) + $init_val);4954 $val = ($init_val * $threshold_factor) + $init_val;
4954 $vars->{$var} = $val;4955 $vars->{$var} = int(ceil($val));
4955 }4956 }
4956 PTDEBUG && _d('Wait if', $var, '>=', $val);4957 PTDEBUG && _d('Wait if', $var, '>=', $val);
4957 }4958 }
@@ -8908,28 +8909,31 @@
8908 # boundary sql. This check applies to the next nibble. So if8909 # boundary sql. This check applies to the next nibble. So if
8909 # the current nibble number is 5, then nibble 5 is already done8910 # the current nibble number is 5, then nibble 5 is already done
8910 # and we're checking nibble number 6.8911 # and we're checking nibble number 6.
8911 my $expl = explain_statement(8912 # Skip if --nocheck-plan See: https://bugs.launchpad.net/percona-toolkit/+bug/1340728
8912 tbl => $tbl,8913 if ( $o->get('check-plan') ) {
8913 sth => $sth->{explain_upper_boundary},8914 my $expl = explain_statement(
8914 vals => [ @{$boundary->{lower}}, $nibble_iter->limit() ],8915 tbl => $tbl,
8915 );8916 sth => $sth->{explain_upper_boundary},
8916 if (lc($expl->{key} || '') ne lc($nibble_iter->nibble_index() || '')) {8917 vals => [ @{$boundary->{lower}}, $nibble_iter->limit() ],
8917 my $msg8918 );
8918 = "Aborting copying table $tbl->{name} at chunk "8919 if ( lc($expl->{key} || '') ne lc($nibble_iter->nibble_index() || '') ) {
8919 . ($nibble_iter->nibble_number() + 1)8920 my $msg
8920 . " because it is not safe to ascend. Chunking should "8921 = "Aborting copying table $tbl->{name} at chunk "
8921 . "use the "8922 . ($nibble_iter->nibble_number() + 1)
8922 . ($nibble_iter->nibble_index() || '?')8923 . " because it is not safe to ascend. Chunking should "
8923 . " index, but MySQL EXPLAIN reports that "8924 . "use the "
8924 . ($expl->{key} ? "the $expl->{key}" : "no")8925 . ($nibble_iter->nibble_index() || '?')
8925 . " index will be used for "8926 . " index, but MySQL EXPLAIN reports that "
8926 . $sth->{upper_boundary}->{Statement}8927 . ($expl->{key} ? "the $expl->{key}" : "no")
8927 . " with values "8928 . " index will be used for "
8928 . join(", ", map { defined $_ ? $_ : "NULL" }8929 . $sth->{upper_boundary}->{Statement}
8929 (@{$boundary->{lower}}, $nibble_iter->limit()))8930 . " with values "
8930 . "\n";8931 . join(", ", map { defined $_ ? $_ : "NULL" }
8931 die ts($msg);8932 (@{$boundary->{lower}}, $nibble_iter->limit()))
8932 } 8933 . "\n";
8934 die ts($msg);
8935 }
8936 }
89338937
8934 # Once nibbling begins for a table, control does not return to this8938 # Once nibbling begins for a table, control does not return to this
8935 # tool until nibbling is done because, as noted above, all work is8939 # tool until nibbling is done because, as noted above, all work is
@@ -9531,15 +9535,17 @@
9531 vals => [ @{$boundary->{lower}}, @{$boundary->{upper}} ],9535 vals => [ @{$boundary->{lower}}, @{$boundary->{upper}} ],
9532 );9536 );
95339537
9534 # Ensure that MySQL is using the chunk index if the table is being chunked.9538 # Ensure that MySQL is using the chunk index if the table is being chunked.
9535 if ( !$nibble_iter->one_nibble()9539 # Skip if --nocheck-plan See: https://bugs.launchpad.net/percona-toolkit/+bug/1340728
9536 && lc($expl->{key} || '') ne lc($nibble_iter->nibble_index() || '') )9540 if ( !$nibble_iter->one_nibble()
9537 {9541 && lc($expl->{key} || '') ne lc($nibble_iter->nibble_index() || '')
9538 die ts("Error copying rows at chunk " . $nibble_iter->nibble_number()9542 && $o->get('check-plan') )
9539 . " of $tbl->{db}.$tbl->{tbl} because MySQL chose "9543 {
9540 . ($expl->{key} ? "the $expl->{key}" : "no") . " index "9544 die ts("Error copying rows at chunk " . $nibble_iter->nibble_number()
9541 . " instead of the " . $nibble_iter->nibble_index() . "index.\n");9545 . " of $tbl->{db}.$tbl->{tbl} because MySQL chose "
9542 }9546 . ($expl->{key} ? "the $expl->{key}" : "no") . " index "
9547 . " instead of the " . $nibble_iter->nibble_index() . "index.\n");
9548 }
95439549
9544 # Ensure that the chunk isn't too large if there's a --chunk-size-limit.9550 # Ensure that the chunk isn't too large if there's a --chunk-size-limit.
9545 # If single-chunking the table, this has already been checked, so it9551 # If single-chunking the table, this has already been checked, so it
@@ -9564,11 +9570,13 @@
9564 }9570 }
9565 }9571 }
95669572
9567 # Ensure that MySQL is still using the entire index.9573 # Ensure that MySQL is still using the entire index.
9568 # https://bugs.launchpad.net/percona-toolkit/+bug/10102329574 # https://bugs.launchpad.net/percona-toolkit/+bug/1010232
9575 # Skip if --nocheck-plan See: https://bugs.launchpad.net/percona-toolkit/+bug/1340728
9569 if ( !$nibble_iter->one_nibble()9576 if ( !$nibble_iter->one_nibble()
9570 && $tbl->{key_len}9577 && $tbl->{key_len}
9571 && ($expl->{key_len} || 0) < $tbl->{key_len} )9578 && ($expl->{key_len} || 0) < $tbl->{key_len}
9579 && $o->get('check-plan') )
9572 {9580 {
9573 die ts("Error copying rows at chunk " . $nibble_iter->nibble_number()9581 die ts("Error copying rows at chunk " . $nibble_iter->nibble_number()
9574 . " of $tbl->{db}.$tbl->{tbl} because MySQL used "9582 . " of $tbl->{db}.$tbl->{tbl} because MySQL used "
@@ -11555,6 +11563,6 @@
1155511563
11556=head1 VERSION11564=head1 VERSION
1155711565
11558pt-online-schema-change 2.2.911566pt-online-schema-change 2.2.10
1155911567
11560=cut11568=cut
1156111569
=== modified file 'bin/pt-pmp'
--- bin/pt-pmp 2014-07-04 17:16:08 +0000
+++ bin/pt-pmp 2014-08-08 14:10:17 +0000
@@ -889,7 +889,7 @@
889889
890=head1 VERSION890=head1 VERSION
891891
892pt-pmp 2.2.9892pt-pmp 2.2.10
893893
894=cut894=cut
895895
896896
=== modified file 'bin/pt-query-digest'
--- bin/pt-query-digest 2014-07-04 17:16:08 +0000
+++ bin/pt-query-digest 2014-08-08 14:10:17 +0000
@@ -64,7 +64,7 @@
64{64{
65package Percona::Toolkit;65package Percona::Toolkit;
6666
67our $VERSION = '2.2.9';67our $VERSION = '2.2.10';
6868
69use strict;69use strict;
70use warnings FATAL => 'all';70use warnings FATAL => 'all';
@@ -4972,7 +4972,7 @@
4972}4972}
49734973
4974my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;4974my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;
4975my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]/;4975my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]\s*(?:Id:\s*(\d+))?/;
4976my $slow_log_hd_line = qr{4976my $slow_log_hd_line = qr{
4977 ^(?:4977 ^(?:
4978 T[cC][pP]\s[pP]ort:\s+\d+ # case differs on windows/unix4978 T[cC][pP]\s[pP]ort:\s+\d+ # case differs on windows/unix
@@ -5036,19 +5036,25 @@
5036 push @properties, 'ts', $time;5036 push @properties, 'ts', $time;
5037 ++$got_ts;5037 ++$got_ts;
5038 if ( !$got_uh5038 if ( !$got_uh
5039 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )5039 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
5040 ) {5040 ) {
5041 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);5041 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
5042 push @properties, 'user', $user, 'host', $host, 'ip', $ip;5042 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
5043 ++$got_uh;5043 if ( $thread_id ) {
5044 push @properties, 'Thread_id', $thread_id;
5045 }
5046 ++$got_uh;
5044 }5047 }
5045 }5048 }
50465049
5047 elsif ( !$got_uh5050 elsif ( !$got_uh
5048 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )5051 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
5049 ) {5052 ) {
5050 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);5053 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
5051 push @properties, 'user', $user, 'host', $host, 'ip', $ip;5054 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
5055 if ( $thread_id ) {
5056 push @properties, 'Thread_id', $thread_id;
5057 }
5052 ++$got_uh;5058 ++$got_uh;
5053 }5059 }
50545060
@@ -16587,6 +16593,6 @@
1658716593
16588=head1 VERSION16594=head1 VERSION
1658916595
16590pt-query-digest 2.2.916596pt-query-digest 2.2.10
1659116597
16592=cut16598=cut
1659316599
=== modified file 'bin/pt-show-grants'
--- bin/pt-show-grants 2014-07-04 17:16:08 +0000
+++ bin/pt-show-grants 2014-08-08 14:10:17 +0000
@@ -2406,6 +2406,6 @@
24062406
2407=head1 VERSION2407=head1 VERSION
24082408
2409pt-show-grants 2.2.92409pt-show-grants 2.2.10
24102410
2411=cut2411=cut
24122412
=== modified file 'bin/pt-sift'
--- bin/pt-sift 2014-07-04 17:16:08 +0000
+++ bin/pt-sift 2014-08-08 14:10:17 +0000
@@ -1237,7 +1237,7 @@
12371237
1238=head1 VERSION1238=head1 VERSION
12391239
1240pt-sift 2.2.91240pt-sift 2.2.10
12411241
1242=cut1242=cut
12431243
12441244
=== modified file 'bin/pt-slave-delay'
--- bin/pt-slave-delay 2014-07-04 17:16:08 +0000
+++ bin/pt-slave-delay 2014-08-08 14:10:17 +0000
@@ -40,7 +40,7 @@
40{40{
41package Percona::Toolkit;41package Percona::Toolkit;
4242
43our $VERSION = '2.2.9';43our $VERSION = '2.2.10';
4444
45use strict;45use strict;
46use warnings FATAL => 'all';46use warnings FATAL => 'all';
@@ -4869,6 +4869,6 @@
48694869
4870=head1 VERSION4870=head1 VERSION
48714871
4872pt-slave-delay 2.2.94872pt-slave-delay 2.2.10
48734873
4874=cut4874=cut
48754875
=== modified file 'bin/pt-slave-find'
--- bin/pt-slave-find 2014-07-04 17:16:08 +0000
+++ bin/pt-slave-find 2014-08-08 14:10:17 +0000
@@ -4334,6 +4334,6 @@
43344334
4335=head1 VERSION4335=head1 VERSION
43364336
4337pt-slave-find 2.2.94337pt-slave-find 2.2.10
43384338
4339=cut4339=cut
43404340
=== modified file 'bin/pt-slave-restart'
--- bin/pt-slave-restart 2014-07-04 17:16:08 +0000
+++ bin/pt-slave-restart 2014-08-08 14:10:17 +0000
@@ -41,7 +41,7 @@
41{41{
42package Percona::Toolkit;42package Percona::Toolkit;
4343
44our $VERSION = '2.2.9';44our $VERSION = '2.2.10';
4545
46use strict;46use strict;
47use warnings FATAL => 'all';47use warnings FATAL => 'all';
@@ -5937,6 +5937,6 @@
59375937
5938=head1 VERSION5938=head1 VERSION
59395939
5940pt-slave-restart 2.2.95940pt-slave-restart 2.2.10
59415941
5942=cut5942=cut
59435943
=== modified file 'bin/pt-stalk'
--- bin/pt-stalk 2014-07-04 17:16:08 +0000
+++ bin/pt-stalk 2014-08-08 14:10:17 +0000
@@ -2211,7 +2211,7 @@
22112211
2212=head1 VERSION2212=head1 VERSION
22132213
2214pt-stalk 2.2.92214pt-stalk 2.2.10
22152215
2216=cut2216=cut
22172217
22182218
=== modified file 'bin/pt-summary'
--- bin/pt-summary 2014-07-04 17:16:08 +0000
+++ bin/pt-summary 2014-08-08 14:10:17 +0000
@@ -95,9 +95,10 @@
9595
96usage_or_errors() {96usage_or_errors() {
97 local file="$1"97 local file="$1"
98 local version=""
9899
99 if [ "$OPT_VERSION" ]; then100 if [ "$OPT_VERSION" ]; then
100 local version=$(grep '^pt-[^ ]\+ [0-9]' "$file")101 version=$(grep '^pt-[^ ]\+ [0-9]' "$file")
101 echo "$version"102 echo "$version"
102 return 1103 return 1
103 fi104 fi
@@ -2690,7 +2691,7 @@
26902691
2691=head1 VERSION2692=head1 VERSION
26922693
2693pt-summary 2.2.92694pt-summary 2.2.10
26942695
2695=cut2696=cut
26962697
26972698
=== modified file 'bin/pt-table-checksum'
--- bin/pt-table-checksum 2014-07-04 17:16:08 +0000
+++ bin/pt-table-checksum 2014-08-08 14:10:17 +0000
@@ -57,7 +57,7 @@
57{57{
58package Percona::Toolkit;58package Percona::Toolkit;
5959
60our $VERSION = '2.2.9';60our $VERSION = '2.2.10';
6161
62use strict;62use strict;
63use warnings FATAL => 'all';63use warnings FATAL => 'all';
@@ -5977,19 +5977,28 @@
5977 }5977 }
5978 my ($dbh, $repl_table) = @args{@required_args};5978 my ($dbh, $repl_table) = @args{@required_args};
59795979
5980 my $sql5980
5981 = "SELECT CONCAT(db, '.', tbl) AS `table`, "5981 my $tries = $self->{'OptionParser'}->get('replicate-check-retries') || 1;
5982 . "chunk, chunk_index, lower_boundary, upper_boundary, "5982 my $diffs;
5983 . "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "5983 while ($tries--) {
5984 . "COALESCE("5984 my $sql
5985 . "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"5985 = "SELECT CONCAT(db, '.', tbl) AS `table`, "
5986 . ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "5986 . "chunk, chunk_index, lower_boundary, upper_boundary, "
5987 . "FROM $repl_table "5987 . "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
5988 . "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "5988 . "COALESCE("
5989 . "OR ISNULL(master_crc) <> ISNULL(this_crc))"5989 . "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
5990 . ($args{where} ? " AND ($args{where})" : "");5990 . ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
5991 PTDEBUG && _d($sql);5991 . "FROM $repl_table "
5992 my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });5992 . "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
5993 . "OR ISNULL(master_crc) <> ISNULL(this_crc)) "
5994 . ($args{where} ? " AND ($args{where})" : "");
5995 PTDEBUG && _d($sql);
5996 $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
5997 if (!@$diffs || !$tries) { # if no differences are found OR we are out of tries left...
5998 last; # get out now
5999 }
6000 sleep 1;
6001 }
5993 return $diffs;6002 return $diffs;
5994}6003}
59956004
@@ -8347,6 +8356,7 @@
83478356
8348use strict;8357use strict;
8349use warnings FATAL => 'all';8358use warnings FATAL => 'all';
8359use POSIX qw( ceil );
8350use English qw(-no_match_vars);8360use English qw(-no_match_vars);
8351use constant PTDEBUG => $ENV{PTDEBUG} || 0;8361use constant PTDEBUG => $ENV{PTDEBUG} || 0;
83528362
@@ -8512,8 +8522,8 @@
8512 }8522 }
8513 else {8523 else {
8514 PTDEBUG && _d('Initial', $var, 'value:', $init_val);8524 PTDEBUG && _d('Initial', $var, 'value:', $init_val);
8515 $val = int(($init_val * $threshold_factor) + $init_val);8525 $val = ($init_val * $threshold_factor) + $init_val;
8516 $vars->{$var} = $val;8526 $vars->{$var} = int(ceil($val));
8517 }8527 }
8518 PTDEBUG && _d('Wait if', $var, '>=', $val);8528 PTDEBUG && _d('Wait if', $var, '>=', $val);
8519 }8529 }
@@ -8964,6 +8974,7 @@
8964 $print_header = 1;8974 $print_header = 1;
8965 $exit_status = 0;8975 $exit_status = 0;
89668976
8977
8967 # ########################################################################8978 # ########################################################################
8968 # Get configuration information.8979 # Get configuration information.
8969 # ########################################################################8980 # ########################################################################
@@ -10072,6 +10083,7 @@
10072 # Should be done automatically, but I like to be explicit.10083 # Should be done automatically, but I like to be explicit.
10073 $fetch_sth->finish();10084 $fetch_sth->finish();
10074 $update_sth->finish();10085 $update_sth->finish();
10086 $delete_sth->finish();
1007510087
10076 # Update rate, chunk size, and progress if the nibble actually10088 # Update rate, chunk size, and progress if the nibble actually
10077 # selected some rows.10089 # selected some rows.
@@ -10382,6 +10394,7 @@
10382 return $msg ? "$ts $msg" : $ts;10394 return $msg ? "$ts $msg" : $ts;
10383}10395}
1038410396
10397
10385sub nibble_is_safe {10398sub nibble_is_safe {
10386 my (%args) = @_;10399 my (%args) = @_;
10387 my @required_args = qw(Cxn tbl NibbleIterator OptionParser);10400 my @required_args = qw(Cxn tbl NibbleIterator OptionParser);
@@ -10561,6 +10574,7 @@
1056110574
10562 if ( $error =~ m/Lock wait timeout exceeded/10575 if ( $error =~ m/Lock wait timeout exceeded/
10563 || $error =~ m/Query execution was interrupted/10576 || $error =~ m/Query execution was interrupted/
10577 || $error =~ m/Deadlock found/
10564 ) {10578 ) {
10565 # These errors/warnings can be retried, so don't print10579 # These errors/warnings can be retried, so don't print
10566 # a warning yet; do that in final_fail.10580 # a warning yet; do that in final_fail.
@@ -10584,8 +10598,9 @@
10584 my (%args) = @_;10598 my (%args) = @_;
10585 my $error = $args{error};10599 my $error = $args{error};
1058610600
10587 if ( $error =~ /Lock wait timeout exceeded/10601 if ( $error =~ m/Lock wait timeout exceeded/
10588 || $error =~ /Query execution was interrupted/10602 || $error =~ m/Query execution was interrupted/
10603 || $error =~ m/Deadlock found/
10589 ) {10604 ) {
10590 # These errors/warnings are not fatal but only cause this10605 # These errors/warnings are not fatal but only cause this
10591 # nibble to be skipped.10606 # nibble to be skipped.
@@ -12287,6 +12302,15 @@
12287if you run pt-table-checksum quietly in a cron job, for example, and later want12302if you run pt-table-checksum quietly in a cron job, for example, and later want
12288a report on the results of the cron job, perhaps to implement a Nagios check.12303a report on the results of the cron job, perhaps to implement a Nagios check.
1228912304
12305=item --replicate-check-retries
12306
12307type: int; default: 1
12308
12309Retry checksum comparison this many times when a difference is encountered.
12310Only when a difference persists after this number of checks is it considered valid.
12311Using this option with a value of 2 or more alleviates spurious differences that
12312arise when using the --resume option.
12313
12290=item --replicate-database12314=item --replicate-database
1229112315
12292type: string12316type: string
@@ -12674,6 +12698,6 @@
1267412698
12675=head1 VERSION12699=head1 VERSION
1267612700
12677pt-table-checksum 2.2.912701pt-table-checksum 2.2.10
1267812702
12679=cut12703=cut
1268012704
=== modified file 'bin/pt-table-sync'
--- bin/pt-table-sync 2014-07-04 17:16:08 +0000
+++ bin/pt-table-sync 2014-08-08 14:10:17 +0000
@@ -55,7 +55,7 @@
55{55{
56package Percona::Toolkit;56package Percona::Toolkit;
5757
58our $VERSION = '2.2.9';58our $VERSION = '2.2.10';
5959
60use strict;60use strict;
61use warnings FATAL => 'all';61use warnings FATAL => 'all';
@@ -12768,6 +12768,6 @@
1276812768
12769=head1 VERSION12769=head1 VERSION
1277012770
12771pt-table-sync 2.2.912771pt-table-sync 2.2.10
1277212772
12773=cut12773=cut
1277412774
=== modified file 'bin/pt-table-usage'
--- bin/pt-table-usage 2014-07-04 17:16:08 +0000
+++ bin/pt-table-usage 2014-08-08 14:10:17 +0000
@@ -1556,12 +1556,13 @@
1556 my ( $class ) = @_;1556 my ( $class ) = @_;
1557 my $self = {1557 my $self = {
1558 pending => [],1558 pending => [],
1559 last_event_offset => undef,
1559 };1560 };
1560 return bless $self, $class;1561 return bless $self, $class;
1561}1562}
15621563
1563my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;1564my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;
1564my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]/;1565my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]\s*(?:Id:\s*(\d+))?/;
1565my $slow_log_hd_line = qr{1566my $slow_log_hd_line = qr{
1566 ^(?:1567 ^(?:
1567 T[cC][pP]\s[pP]ort:\s+\d+ # case differs on windows/unix1568 T[cC][pP]\s[pP]ort:\s+\d+ # case differs on windows/unix
@@ -1592,6 +1593,7 @@
1592 or defined($stmt = $next_event->())1593 or defined($stmt = $next_event->())
1593 ) {1594 ) {
1594 my @properties = ('cmd', 'Query', 'pos_in_log', $pos_in_log);1595 my @properties = ('cmd', 'Query', 'pos_in_log', $pos_in_log);
1596 $self->{last_event_offset} = $pos_in_log;
1595 $pos_in_log = $tell->();1597 $pos_in_log = $tell->();
15961598
1597 if ( $stmt =~ s/$slow_log_hd_line//go ){ # Throw away header lines in log1599 if ( $stmt =~ s/$slow_log_hd_line//go ){ # Throw away header lines in log
@@ -1624,19 +1626,25 @@
1624 push @properties, 'ts', $time;1626 push @properties, 'ts', $time;
1625 ++$got_ts;1627 ++$got_ts;
1626 if ( !$got_uh1628 if ( !$got_uh
1627 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )1629 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
1628 ) {1630 ) {
1629 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);1631 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
1630 push @properties, 'user', $user, 'host', $host, 'ip', $ip;1632 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
1631 ++$got_uh;1633 if ( $thread_id ) {
1634 push @properties, 'Thread_id', $thread_id;
1635 }
1636 ++$got_uh;
1632 }1637 }
1633 }1638 }
16341639
1635 elsif ( !$got_uh1640 elsif ( !$got_uh
1636 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )1641 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
1637 ) {1642 ) {
1638 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);1643 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
1639 push @properties, 'user', $user, 'host', $host, 'ip', $ip;1644 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
1645 if ( $thread_id ) {
1646 push @properties, 'Thread_id', $thread_id;
1647 }
1640 ++$got_uh;1648 ++$got_uh;
1641 }1649 }
16421650
@@ -1676,14 +1684,25 @@
16761684
1677 if ( !$found_arg && $pos == $len ) {1685 if ( !$found_arg && $pos == $len ) {
1678 PTDEBUG && _d("Did not find arg, looking for special cases");1686 PTDEBUG && _d("Did not find arg, looking for special cases");
1679 local $INPUT_RECORD_SEPARATOR = ";\n";1687 local $INPUT_RECORD_SEPARATOR = ";\n"; # get next line
1680 if ( defined(my $l = $next_event->()) ) {1688 if ( defined(my $l = $next_event->()) ) {
1681 chomp $l;1689 if ( $l =~ /^\s*[A-Z][a-z_]+: / ) {
1682 $l =~ s/^\s+//;1690 PTDEBUG && _d("Found NULL query before", $l);
1683 PTDEBUG && _d("Found admin statement", $l);1691 local $INPUT_RECORD_SEPARATOR = ";\n#";
1684 push @properties, 'cmd', 'Admin', 'arg', $l;1692 my $rest_of_event = $next_event->();
1685 push @properties, 'bytes', length($properties[-1]);1693 push @{$self->{pending}}, $l . $rest_of_event;
1686 $found_arg++;1694 push @properties, 'cmd', 'Query', 'arg', '/* No query */';
1695 push @properties, 'bytes', 0;
1696 $found_arg++;
1697 }
1698 else {
1699 chomp $l;
1700 $l =~ s/^\s+//;
1701 PTDEBUG && _d("Found admin statement", $l);
1702 push @properties, 'cmd', 'Admin', 'arg', $l;
1703 push @properties, 'bytes', length($properties[-1]);
1704 $found_arg++;
1705 }
1687 }1706 }
1688 else {1707 else {
1689 PTDEBUG && _d("I can't figure out what to do with this line");1708 PTDEBUG && _d("I can't figure out what to do with this line");
@@ -1706,9 +1725,15 @@
17061725
1707 PTDEBUG && _d('Properties of event:', Dumper(\@properties));1726 PTDEBUG && _d('Properties of event:', Dumper(\@properties));
1708 my $event = { @properties };1727 my $event = { @properties };
1709 if ( $args{stats} ) {1728 if ( !$event->{arg} ) {
1710 $args{stats}->{events_read}++;1729 PTDEBUG && _d('Partial event, no arg');
1711 $args{stats}->{events_parsed}++;1730 }
1731 else {
1732 $self->{last_event_offset} = undef;
1733 if ( $args{stats} ) {
1734 $args{stats}->{events_read}++;
1735 $args{stats}->{events_parsed}++;
1736 }
1712 }1737 }
1713 return $event;1738 return $event;
1714 } # EVENT1739 } # EVENT
@@ -7536,6 +7561,6 @@
75367561
7537=head1 VERSION7562=head1 VERSION
75387563
7539pt-table-usage 2.2.97564pt-table-usage 2.2.10
75407565
7541=cut7566=cut
75427567
=== modified file 'bin/pt-upgrade'
--- bin/pt-upgrade 2014-07-04 17:16:08 +0000
+++ bin/pt-upgrade 2014-08-08 14:10:17 +0000
@@ -61,7 +61,7 @@
61{61{
62package Percona::Toolkit;62package Percona::Toolkit;
6363
64our $VERSION = '2.2.9';64our $VERSION = '2.2.10';
6565
66use strict;66use strict;
67use warnings FATAL => 'all';67use warnings FATAL => 'all';
@@ -6537,12 +6537,13 @@
6537 my ( $class ) = @_;6537 my ( $class ) = @_;
6538 my $self = {6538 my $self = {
6539 pending => [],6539 pending => [],
6540 last_event_offset => undef,
6540 };6541 };
6541 return bless $self, $class;6542 return bless $self, $class;
6542}6543}
65436544
6544my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;6545my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;
6545my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]/;6546my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]\s*(?:Id:\s*(\d+))?/;
6546my $slow_log_hd_line = qr{6547my $slow_log_hd_line = qr{
6547 ^(?:6548 ^(?:
6548 T[cC][pP]\s[pP]ort:\s+\d+ # case differs on windows/unix6549 T[cC][pP]\s[pP]ort:\s+\d+ # case differs on windows/unix
@@ -6573,6 +6574,7 @@
6573 or defined($stmt = $next_event->())6574 or defined($stmt = $next_event->())
6574 ) {6575 ) {
6575 my @properties = ('cmd', 'Query', 'pos_in_log', $pos_in_log);6576 my @properties = ('cmd', 'Query', 'pos_in_log', $pos_in_log);
6577 $self->{last_event_offset} = $pos_in_log;
6576 $pos_in_log = $tell->();6578 $pos_in_log = $tell->();
65776579
6578 if ( $stmt =~ s/$slow_log_hd_line//go ){ # Throw away header lines in log6580 if ( $stmt =~ s/$slow_log_hd_line//go ){ # Throw away header lines in log
@@ -6605,19 +6607,25 @@
6605 push @properties, 'ts', $time;6607 push @properties, 'ts', $time;
6606 ++$got_ts;6608 ++$got_ts;
6607 if ( !$got_uh6609 if ( !$got_uh
6608 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )6610 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
6609 ) {6611 ) {
6610 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);6612 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
6611 push @properties, 'user', $user, 'host', $host, 'ip', $ip;6613 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
6612 ++$got_uh;6614 if ( $thread_id ) {
6615 push @properties, 'Thread_id', $thread_id;
6616 }
6617 ++$got_uh;
6613 }6618 }
6614 }6619 }
66156620
6616 elsif ( !$got_uh6621 elsif ( !$got_uh
6617 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )6622 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
6618 ) {6623 ) {
6619 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);6624 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
6620 push @properties, 'user', $user, 'host', $host, 'ip', $ip;6625 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
6626 if ( $thread_id ) {
6627 push @properties, 'Thread_id', $thread_id;
6628 }
6621 ++$got_uh;6629 ++$got_uh;
6622 }6630 }
66236631
@@ -6698,9 +6706,15 @@
66986706
6699 PTDEBUG && _d('Properties of event:', Dumper(\@properties));6707 PTDEBUG && _d('Properties of event:', Dumper(\@properties));
6700 my $event = { @properties };6708 my $event = { @properties };
6701 if ( $args{stats} ) {6709 if ( !$event->{arg} ) {
6702 $args{stats}->{events_read}++;6710 PTDEBUG && _d('Partial event, no arg');
6703 $args{stats}->{events_parsed}++;6711 }
6712 else {
6713 $self->{last_event_offset} = undef;
6714 if ( $args{stats} ) {
6715 $args{stats}->{events_read}++;
6716 $args{stats}->{events_parsed}++;
6717 }
6704 }6718 }
6705 return $event;6719 return $event;
6706 } # EVENT6720 } # EVENT
@@ -11224,6 +11238,6 @@
1122411238
11225=head1 VERSION11239=head1 VERSION
1122611240
11227pt-upgrade 2.2.911241pt-upgrade 2.2.10
1122811242
11229=cut11243=cut
1123011244
=== modified file 'bin/pt-variable-advisor'
--- bin/pt-variable-advisor 2014-07-04 17:16:08 +0000
+++ bin/pt-variable-advisor 2014-08-08 14:10:17 +0000
@@ -44,7 +44,7 @@
44{44{
45package Percona::Toolkit;45package Percona::Toolkit;
4646
47our $VERSION = '2.2.9';47our $VERSION = '2.2.10';
4848
49use strict;49use strict;
50use warnings FATAL => 'all';50use warnings FATAL => 'all';
@@ -6138,6 +6138,6 @@
61386138
6139=head1 VERSION6139=head1 VERSION
61406140
6141pt-variable-advisor 2.2.96141pt-variable-advisor 2.2.10
61426142
6143=cut6143=cut
61446144
=== modified file 'bin/pt-visual-explain'
--- bin/pt-visual-explain 2014-07-04 17:16:08 +0000
+++ bin/pt-visual-explain 2014-08-08 14:10:17 +0000
@@ -3243,6 +3243,6 @@
32433243
3244=head1 VERSION3244=head1 VERSION
32453245
3246pt-visual-explain 2.2.93246pt-visual-explain 2.2.10
32473247
3248=cut3248=cut
32493249
=== modified file 'config/deb/changelog'
--- config/deb/changelog 2014-07-08 12:06:12 +0000
+++ config/deb/changelog 2014-08-08 14:10:17 +0000
@@ -1,3 +1,14 @@
1percona-toolkit (2.2.10) unstable; urgency=low
2
3 * Fixed bug 1287253: pt-table-checksum deadlock
4 * Fixed bug 1299387: 5.6 slow query log Thead_id becomes Id
5 * Fixed bug 1311654: pt-table-checksum + PXC inconsistent results upon --resume
6 * Fixed bug 1340728: pt-online-schema-change doesn't work with HASH indexes
7 * Fixed bug 1253872: pt-table-checksum max load 20% rounds down
8 * Fixed bug 1340364: some shell tools output error when queried for --version
9
10 -- Percona Toolkit Developers <toolkit-dev@percona.com> Wed, 06 Aug 2014 19:53:53 +0000
11
1percona-toolkit (2.2.9) unstable; urgency=low12percona-toolkit (2.2.9) unstable; urgency=low
213
3 * Fixed bug 1258135: pt-deadlock-logger introduces a noise to MySQL14 * Fixed bug 1258135: pt-deadlock-logger introduces a noise to MySQL
415
=== modified file 'config/sphinx-build/conf.py'
--- config/sphinx-build/conf.py 2014-07-08 12:06:12 +0000
+++ config/sphinx-build/conf.py 2014-08-08 14:10:17 +0000
@@ -50,7 +50,7 @@
50# The short X.Y version.50# The short X.Y version.
51version = '2.2'51version = '2.2'
52# The full version, including alpha/beta/rc tags.52# The full version, including alpha/beta/rc tags.
53release = '2.2.9'53release = '2.2.10'
5454
55# The language for content autogenerated by Sphinx. Refer to documentation55# The language for content autogenerated by Sphinx. Refer to documentation
56# for a list of supported languages.56# for a list of supported languages.
5757
=== modified file 'docs/percona-toolkit.pod'
--- docs/percona-toolkit.pod 2014-07-08 12:06:12 +0000
+++ docs/percona-toolkit.pod 2014-08-08 14:10:17 +0000
@@ -557,6 +557,6 @@
557557
558=head1 VERSION558=head1 VERSION
559559
560Percona Toolkit v2.2.9 released 2014-07-08560Percona Toolkit v2.2.10 released 2014-08-06
561561
562=cut562=cut
563563
=== modified file 'docs/release_notes.rst'
--- docs/release_notes.rst 2014-07-08 12:06:12 +0000
+++ docs/release_notes.rst 2014-08-08 14:10:17 +0000
@@ -1,6 +1,35 @@
1Release Notes1Release Notes
2*************2*************
33
4v2.2.10 released 2014-08-06
5===========================
6
7Percona Toolkit 2.2.10 has been released. This release contains six bug fixes.
8
9Bugs Fixed:
10
11* Fixed bug 1287253: pt-table-checksum would exit with error if it would encounter deadlock when doing checksum. This was fixed by retrying the command in case of deadlock error.
12
13* Fixed bug 1311654: When used with Percona XtraDB Cluster, pt-table-checksum could show incorrect result if --resume option was used. This was fixed by adding a new ``--replicate-check-retries`` command line parameter. If you are having resume problems you can now set ``--replicate-check-retries`` N , where N is the number of times to retry a discrepant checksum (default = 1 , no retries). Setting a value of ``3`` is enough to completely eliminate spurious differences.
14
15* Fixed bug 1299387: pt-query-digest didn't work correctly do to a changed logging format when field ``Thread_id`` has been renamed to ``Id``. Fixed by implementing support for the new format.
16
17* Fixed bug 1340728: in some cases, where the index was of type "hash" , pt-online-schema-change would refuse to run because MySQL reported it would not use an index for the select. This check should have been able to be skipped using --nocheck-plan option, but it wasn't. ``--nocheck-plan`` now ignores the chosen index correctly.
18
19* Fixed bug 1253872: When running pt-table-checksum or pt-online-schema on a server that is unused, setting the 20% max load would fail due to tools rounding the value down. This has been fixed by rounding the value up.
20
21* Fixed bug 1340364: Due to incompatibility of dash and bash syntax some shell tools were showing error when queried for version.
22
23Changelog
24---------
25
26* Fixed bug 1287253: pt-table-checksum deadlock
27* Fixed bug 1299387: 5.6 slow query log Thead_id becomes Id
28* Fixed bug 1311654: pt-table-checksum + PXC inconsistent results upon --resume
29* Fixed bug 1340728: pt-online-schema-change doesn't work with HASH indexes
30* Fixed bug 1253872: pt-table-checksum max load 20% rounds down
31* Fixed bug 1340364: some shell tools output error when queried for --version
32
4v2.2.9 released 2014-07-0833v2.2.9 released 2014-07-08
5==========================34==========================
635
736
=== modified file 'lib/MySQLStatusWaiter.pm'
--- lib/MySQLStatusWaiter.pm 2013-01-03 00:19:16 +0000
+++ lib/MySQLStatusWaiter.pm 2014-08-08 14:10:17 +0000
@@ -24,6 +24,7 @@
2424
25use strict;25use strict;
26use warnings FATAL => 'all';26use warnings FATAL => 'all';
27use POSIX qw( ceil );
27use English qw(-no_match_vars);28use English qw(-no_match_vars);
28use constant PTDEBUG => $ENV{PTDEBUG} || 0;29use constant PTDEBUG => $ENV{PTDEBUG} || 0;
2930
@@ -221,8 +222,8 @@
221 }222 }
222 else {223 else {
223 PTDEBUG && _d('Initial', $var, 'value:', $init_val);224 PTDEBUG && _d('Initial', $var, 'value:', $init_val);
224 $val = int(($init_val * $threshold_factor) + $init_val);225 $val = ($init_val * $threshold_factor) + $init_val;
225 $vars->{$var} = $val;226 $vars->{$var} = int(ceil($val));
226 }227 }
227 PTDEBUG && _d('Wait if', $var, '>=', $val);228 PTDEBUG && _d('Wait if', $var, '>=', $val);
228 }229 }
229230
=== modified file 'lib/Percona/Toolkit.pm'
--- lib/Percona/Toolkit.pm 2014-07-04 16:13:38 +0000
+++ lib/Percona/Toolkit.pm 2014-08-08 14:10:17 +0000
@@ -18,7 +18,7 @@
18# ###########################################################################18# ###########################################################################
19package Percona::Toolkit;19package Percona::Toolkit;
2020
21our $VERSION = '2.2.9';21our $VERSION = '2.2.10';
2222
23use strict;23use strict;
24use warnings FATAL => 'all';24use warnings FATAL => 'all';
2525
=== modified file 'lib/RowChecksum.pm'
--- lib/RowChecksum.pm 2013-01-03 00:19:16 +0000
+++ lib/RowChecksum.pm 2014-08-08 14:10:17 +0000
@@ -459,19 +459,28 @@
459 }459 }
460 my ($dbh, $repl_table) = @args{@required_args};460 my ($dbh, $repl_table) = @args{@required_args};
461461
462 my $sql462
463 = "SELECT CONCAT(db, '.', tbl) AS `table`, "463 my $tries = $self->{'OptionParser'}->get('replicate-check-retries') || 1;
464 . "chunk, chunk_index, lower_boundary, upper_boundary, "464 my $diffs;
465 . "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "465 while ($tries--) {
466 . "COALESCE("466 my $sql
467 . "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"467 = "SELECT CONCAT(db, '.', tbl) AS `table`, "
468 . ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "468 . "chunk, chunk_index, lower_boundary, upper_boundary, "
469 . "FROM $repl_table "469 . "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
470 . "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "470 . "COALESCE("
471 . "OR ISNULL(master_crc) <> ISNULL(this_crc))"471 . "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
472 . ($args{where} ? " AND ($args{where})" : "");472 . ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
473 PTDEBUG && _d($sql);473 . "FROM $repl_table "
474 my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });474 . "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
475 . "OR ISNULL(master_crc) <> ISNULL(this_crc)) "
476 . ($args{where} ? " AND ($args{where})" : "");
477 PTDEBUG && _d($sql);
478 $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
479 if (!@$diffs || !$tries) { # if no differences are found OR we are out of tries left...
480 last; # get out now
481 }
482 sleep 1;
483 }
475 return $diffs;484 return $diffs;
476}485}
477486
478487
=== modified file 'lib/SlowLogParser.pm'
--- lib/SlowLogParser.pm 2013-05-08 03:19:37 +0000
+++ lib/SlowLogParser.pm 2014-08-08 14:10:17 +0000
@@ -42,7 +42,7 @@
42}42}
4343
44my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;44my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;
45my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]/;45my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]\s*(?:Id:\s*(\d+))?/;
46# These can appear in the log file when it's opened -- for example, when someone46# These can appear in the log file when it's opened -- for example, when someone
47# runs FLUSH LOGS or the server starts.47# runs FLUSH LOGS or the server starts.
48# /usr/sbin/mysqld, Version: 5.0.67-0ubuntu6-log ((Ubuntu)). started with:48# /usr/sbin/mysqld, Version: 5.0.67-0ubuntu6-log ((Ubuntu)). started with:
@@ -159,21 +159,29 @@
159 ++$got_ts;159 ++$got_ts;
160 # The User@Host might be concatenated onto the end of the Time.160 # The User@Host might be concatenated onto the end of the Time.
161 if ( !$got_uh161 if ( !$got_uh
162 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )162 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
163 ) {163 ) {
164 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);164 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
165 push @properties, 'user', $user, 'host', $host, 'ip', $ip;165 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
166 ++$got_uh;166 # 5.6 has the thread id on the User@Host line
167 if ( $thread_id ) {
168 push @properties, 'Thread_id', $thread_id;
169 }
170 ++$got_uh;
167 }171 }
168 }172 }
169173
170 # Maybe it's the user/host line of a slow query log174 # Maybe it's the user/host line of a slow query log
171 # # User@Host: root[root] @ localhost []175 # # User@Host: root[root] @ localhost []
172 elsif ( !$got_uh176 elsif ( !$got_uh
173 && ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )177 && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
174 ) {178 ) {
175 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);179 PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
176 push @properties, 'user', $user, 'host', $host, 'ip', $ip;180 push @properties, 'user', $user, 'host', $host, 'ip', $ip;
181 # 5.6 has the thread id on the User@Host line
182 if ( $thread_id ) {
183 push @properties, 'Thread_id', $thread_id;
184 }
177 ++$got_uh;185 ++$got_uh;
178 }186 }
179187
180188
=== modified file 'lib/bash/parse_options.sh'
--- lib/bash/parse_options.sh 2013-08-09 21:21:55 +0000
+++ lib/bash/parse_options.sh 2014-08-08 14:10:17 +0000
@@ -76,9 +76,10 @@
7676
77usage_or_errors() {77usage_or_errors() {
78 local file="$1"78 local file="$1"
79 local version=""
7980
80 if [ "$OPT_VERSION" ]; then81 if [ "$OPT_VERSION" ]; then
81 local version=$(grep '^pt-[^ ]\+ [0-9]' "$file")82 version=$(grep '^pt-[^ ]\+ [0-9]' "$file")
82 echo "$version"83 echo "$version"
83 return 184 return 1
84 fi85 fi
8586
=== modified file 't/lib/MySQLStatusWaiter.t'
--- t/lib/MySQLStatusWaiter.t 2012-05-25 21:27:23 +0000
+++ t/lib/MySQLStatusWaiter.t 2014-08-08 14:10:17 +0000
@@ -8,6 +8,7 @@
88
9use strict;9use strict;
10use warnings FATAL => 'all';10use warnings FATAL => 'all';
11use POSIX qw( ceil floor );
11use English qw(-no_match_vars);12use English qw(-no_match_vars);
12use Test::More tests => 17;13use Test::More tests => 17;
1314
@@ -19,6 +20,7 @@
19my $slept = 0;20my $slept = 0;
20my @vals = ();21my @vals = ();
2122
23
22sub oktorun {24sub oktorun {
23 return $oktorun;25 return $oktorun;
24}26}
@@ -76,33 +78,35 @@
76 "Catch non-existent variable"78 "Catch non-existent variable"
77);79);
7880
79# ############################################################################81
80# Use initial vals + 20%.82# ############################################################################
81# ############################################################################83# Initial vals + 20%
84# ############################################################################
85
82@vals = (86@vals = (
83 # initial check for existence87 # initial check for existence
84 { Threads_connected => 10, },88 { Threads_connected => 9, },
85 { Threads_running => 5, },89 { Threads_running => 4, },
8690
87 # first check, no wait91 # first check, no wait
88 { Threads_connected => 1, },92 { Threads_connected => 1, },
89 { Threads_running => 1, },93 { Threads_running => 1, },
9094
91 # second check, wait95 # second check, wait
92 { Threads_connected => 12, }, # too high96 { Threads_connected => 11, }, # too high
93 { Threads_running => 6, }, # too high97 { Threads_running => 5, }, # too high
9498
95 # third check, wait99 # third check, wait
96 { Threads_connected => 12, }, # too high100 { Threads_connected => 11, }, # too high
97 { Threads_running => 5, },101 { Threads_running => 4, },
98102
99 # fourth check, wait103 # fourth check, wait
100 { Threads_connected => 10, },104 { Threads_connected => 10, },
101 { Threads_running => 6, }, # too high105 { Threads_running => 5, }, # too high
102 106
103 # fifth check, no wait107 # fifth check, no wait
104 { Threads_connected => 10, },108 { Threads_connected => 10, },
105 { Threads_running => 5, },109 { Threads_running => 4, },
106);110);
107111
108$oktorun = 1;112$oktorun = 1;
@@ -117,10 +121,10 @@
117is_deeply(121is_deeply(
118 $sw->max_values(),122 $sw->max_values(),
119 {123 {
120 Threads_connected => int(10 + (10 * 0.20)),124 Threads_connected => ceil(9 + (9 * 0.20)),
121 Threads_running => int(5 + (5 * 0.20)),125 Threads_running => ceil(4 + (4 * 0.20)),
122 },126 },
123 "Initial values +20%"127 "Threshold = ceil(InitialValue * 1.2)"
124);128);
125129
126# first check130# first check
127131
=== modified file 't/lib/SlowLogParser.t'
--- t/lib/SlowLogParser.t 2012-12-11 01:07:36 +0000
+++ t/lib/SlowLogParser.t 2014-08-08 14:10:17 +0000
@@ -1349,6 +1349,70 @@
1349 ],1349 ],
1350);1350);
13511351
1352
1353# #############################################################################
1354# pt-query-digest fails to parse Thread_id on 5.6
1355# https://bugs.launchpad.net/percona-toolkit/+bug/1299387
1356# #############################################################################
1357
1358# first test with a Percona 5.5 slow log (includes an explicit Thread_id line)
1359# (MySQL 5.5 doesn't include thread id)
1360test_log_parser(
1361 parser => $p,
1362 file => "$sample/slow060.txt",
1363 result => [
1364 {
1365 Thread_id => '1', # here's our item
1366 Bytes_sent => '64',
1367 Killed => '0',
1368 Last_errno => '0',
1369 Lock_time => '0.000000',
1370 Query_time => '10.000373',
1371 Rows_affected => '0',
1372 Rows_examined => '0',
1373 Rows_read => '0',
1374 Rows_sent => '1',
1375 arg => 'select sleep(10)',
1376 bytes => 16,
1377 cmd => 'Query',
1378 host => 'localhost',
1379 ip => '127.0.0.1',
1380 pos_in_log => 0,
1381 timestamp => '1405358212',
1382 ts => '140714 14:16:52',
1383 user => 'root'
1384 },
1385 ],
1386);
1387
1388# now test with a Percona 5.6 slow log. Thread_id is now on the user@host line, and is called 'Id'.
1389# (this is in line with MySQL 5.6)
1390test_log_parser(
1391 parser => $p,
1392 file => "$sample/slow061.txt",
1393 result => [
1394 {
1395 Thread_id => 1, # here's our item
1396 Bytes_sent => '64',
1397 Lock_time => '0.000000',
1398 Query_time => '11.013723',
1399 Rows_affected => '0',
1400 Rows_examined => '0',
1401 Rows_sent => '1',
1402 arg => 'select sleep(11)',
1403 bytes => 16,
1404 cmd => 'Query',
1405 host => 'localhost',
1406 ip => '127.0.0.1',
1407 pos_in_log => 0,
1408 timestamp => '1405360304',
1409 ts => '140714 14:51:44',
1410 user => 'root',
1411 },
1412 ],
1413);
1414
1415
1352# #############################################################################1416# #############################################################################
1353# Done.1417# Done.
1354# #############################################################################1418# #############################################################################
13551419
=== added file 't/lib/samples/slowlogs/slow060.txt'
--- t/lib/samples/slowlogs/slow060.txt 1970-01-01 00:00:00 +0000
+++ t/lib/samples/slowlogs/slow060.txt 2014-08-08 14:10:17 +0000
@@ -0,0 +1,10 @@
1bin/mysqld, Version: 5.5.38-35.2-log (Percona Server (GPL), Release 35.2, Revision 674). started with:
2Tcp port: 3306 Unix socket: (null)
3Time Id Command Argument
4# Time: 140714 14:16:52
5# User@Host: root[root] @ localhost [127.0.0.1]
6# Thread_id: 1 Schema: Last_errno: 0 Killed: 0
7# Query_time: 10.000373 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 Rows_affected: 0 Rows_read: 0
8# Bytes_sent: 64
9SET timestamp=1405358212;
10select sleep(10);
011
=== added file 't/lib/samples/slowlogs/slow061.txt'
--- t/lib/samples/slowlogs/slow061.txt 1970-01-01 00:00:00 +0000
+++ t/lib/samples/slowlogs/slow061.txt 2014-08-08 14:10:17 +0000
@@ -0,0 +1,10 @@
1bin/mysqld, Version: 5.6.19-67.0-log (Percona Server (GPL), Release 67.0, Revision 618). started with:
2Tcp port: 3306 Unix socket: (null)
3Time Id Command Argument
4# Time: 140714 14:51:44
5# User@Host: root[root] @ localhost [127.0.0.1] Id: 1
6# Schema: Last_errno: 0 Killed: 0
7# Query_time: 11.013723 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 Rows_affected: 0
8# Bytes_sent: 64
9SET timestamp=1405360304;
10select sleep(11);
011
=== removed file 't/pt-online-schema-change/bug-1315130.t'
--- t/pt-online-schema-change/bug-1315130.t 2014-06-20 21:31:30 +0000
+++ t/pt-online-schema-change/bug-1315130.t 1970-01-01 00:00:00 +0000
@@ -1,78 +0,0 @@
1#!/usr/bin/env perl
2
3BEGIN {
4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
5 unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
6 unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
7};
8
9use strict;
10use warnings FATAL => 'all';
11use English qw(-no_match_vars);
12use Test::More;
13use Time::HiRes qw(sleep);
14
15$ENV{PTTEST_FAKE_TS} = 1;
16$ENV{PERCONA_TOOLKIT_TEST_USE_DSN_NAMES} = 1;
17
18use PerconaTest;
19use Sandbox;
20require "$trunk/bin/pt-online-schema-change";
21require VersionParser;
22
23use Data::Dumper;
24$Data::Dumper::Indent = 1;
25$Data::Dumper::Sortkeys = 1;
26$Data::Dumper::Quotekeys = 0;
27
28my $dp = new DSNParser(opts=>$dsn_opts);
29my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
30my $master_dbh = $sb->get_dbh_for('master');
31my $slave_dbh = $sb->get_dbh_for('slave1');
32
33if ( !$master_dbh ) {
34 plan skip_all => 'Cannot connect to sandbox master';
35}
36elsif ( !$slave_dbh ) {
37 plan skip_all => 'Cannot connect to sandbox slave';
38}
39
40my $q = new Quoter();
41my $tp = new TableParser(Quoter => $q);
42my @args = qw(--set-vars innodb_lock_wait_timeout=3);
43my $output = "";
44my $dsn = "h=127.1,P=12345,u=msandbox,p=msandbox";
45my $exit = 0;
46my $sample = "t/pt-online-schema-change/samples";
47my $rows;
48
49
50# #############################################################################
51# Issue 1315130
52# Failed to detect child tables in other schema, and falsely identified
53# child tables in own schema
54# #############################################################################
55
56$sb->load_file('master', "$sample/bug-1315130_cleanup.sql");
57$sb->load_file('master', "$sample/bug-1315130.sql");
58($output, $exit) = full_output(
59 sub { pt_online_schema_change::main(@args, "$dsn,D=bug_1315130_a,t=parent_table",
60 '--dry-run',
61 '--alter', "add column c varchar(16)",
62 '--alter-foreign-keys-method', 'auto'),
63 },
64);
65print STDERR "[$output]\n";
66 like(
67 $output,
68 qr/Child tables:\s*`bug_1315130_a`\.`child_table_in_same_schema` \(approx\. 1 rows\)\s*`bug_1315130_b`\.`child_table_in_second_schema` \(approx\. 1 rows\)[^`]*?Will/s,
69 "Correctly identify child tables from other schemas and ignores tables from same schema referencig same named parent in other schema.",
70 );
71# clear databases with their foreign keys
72$sb->load_file('master', "$sample/bug-1315130_cleanup.sql");
73
74# Done.
75# #############################################################################
76$sb->wipe_clean($master_dbh);
77ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
78done_testing;
790
=== modified file 't/pt-online-schema-change/bugs.t'
--- t/pt-online-schema-change/bugs.t 2013-06-26 20:28:27 +0000
+++ t/pt-online-schema-change/bugs.t 2014-08-08 14:10:17 +0000
@@ -124,7 +124,11 @@
124{124{
125 my $o = new OptionParser(file => "$trunk/bin/pt-table-checksum");125 my $o = new OptionParser(file => "$trunk/bin/pt-table-checksum");
126 $o->get_specs();126 $o->get_specs();
127
128 $o->set('check-plan', 1); # check-plan is true by default
129
127 no warnings;130 no warnings;
131
128 local *pt_online_schema_change::explain_statement = sub {132 local *pt_online_schema_change::explain_statement = sub {
129 return { key => 'some_key' }133 return { key => 'some_key' }
130 };134 };
@@ -369,6 +373,66 @@
369 "Bug 1188264: warning about expected MySQL error 1265"373 "Bug 1188264: warning about expected MySQL error 1265"
370);374);
371375
376
377# #############################################################################
378# Issue 1315130
379# Failed to detect child tables in other schema, and falsely identified
380# child tables in own schema
381# #############################################################################
382
383$sb->load_file('master', "$sample/bug-1315130_cleanup.sql");
384$sb->load_file('master', "$sample/bug-1315130.sql");
385
386$output = output(
387 sub { pt_online_schema_change::main(@args, "$master_dsn,D=bug_1315130_a,t=parent_table",
388 '--dry-run',
389 '--alter', "add column c varchar(16)",
390 '--alter-foreign-keys-method', 'auto'),
391 },
392);
393
394 like(
395 $output,
396 qr/Child tables:\s*`bug_1315130_a`\.`child_table_in_same_schema` \(approx\. 1 rows\)\s*`bug_1315130_b`\.`child_table_in_second_schema` \(approx\. 1 rows\)[^`]*?Will/s,
397 "Correctly identify child tables from other schemas and ignores tables from same schema referencig same named parent in other schema.",
398 );
399# clear databases with their foreign keys
400$sb->load_file('master', "$sample/bug-1315130_cleanup.sql");
401
402
403# #############################################################################
404# Issue 1340728
405# fails when no index is returned in EXPLAIN, even though --nocheck-plan is set
406# (happens on HASH indexes)
407# #############################################################################
408
409$sb->load_file('master', "$sample/bug-1340728_cleanup.sql");
410$sb->load_file('master', "$sample/bug-1340728.sql");
411
412# insert a few thousand rows (else test isn't valid)
413my $rows = 5000;
414for (my $i = 0; $i < $rows; $i++) {
415 $master_dbh->do("INSERT INTO bug_1340728.test VALUES (NULL, 'xx')");
416}
417
418
419$output = output(
420 sub { pt_online_schema_change::main(@args, "$master_dsn,D=bug_1340728,t=test",
421 '--execute',
422 '--alter', "ADD COLUMN c INT",
423 '--nocheck-plan',
424 ),
425 },
426);
427
428 like(
429 $output,
430 qr/Successfully altered/s,
431 "--nocheck-plan ignores plans without index",
432 );
433# clear databases
434$sb->load_file('master', "$sample/bug-1340728_cleanup.sql");
435
372# #############################################################################436# #############################################################################
373# Done.437# Done.
374# #############################################################################438# #############################################################################
375439
=== added file 't/pt-online-schema-change/samples/bug-1340728.sql'
--- t/pt-online-schema-change/samples/bug-1340728.sql 1970-01-01 00:00:00 +0000
+++ t/pt-online-schema-change/samples/bug-1340728.sql 2014-08-08 14:10:17 +0000
@@ -0,0 +1,10 @@
1drop database if exists bug_1340728;
2create database bug_1340728;
3use bug_1340728;
4
5CREATE TABLE `test` (
6 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
7 `name` char(2) NOT NULL,
8 PRIMARY KEY (`id`) USING HASH
9) ENGINE=MEMORY DEFAULT CHARSET=latin1;
10
011
=== added file 't/pt-online-schema-change/samples/bug-1340728_cleanup.sql'
--- t/pt-online-schema-change/samples/bug-1340728_cleanup.sql 1970-01-01 00:00:00 +0000
+++ t/pt-online-schema-change/samples/bug-1340728_cleanup.sql 2014-08-08 14:10:17 +0000
@@ -0,0 +1,2 @@
1drop database if exists bug_1340728;
2
03
=== modified file 't/pt-query-digest/since_until.t'
--- t/pt-query-digest/since_until.t 2013-03-05 16:59:33 +0000
+++ t/pt-query-digest/since_until.t 2014-08-08 14:10:17 +0000
@@ -52,16 +52,16 @@
52 '--since 090727'52 '--since 090727'
53);53);
5454
55# This test will fail come July 2014.55# This test will fail come July 2015.
56ok(56ok(
57 no_diff(57 no_diff(
58 sub { pt_query_digest::main(@args,58 sub { pt_query_digest::main(@args,
59 "$sample_in/slow033.txt", qw(--since 1825d),59 "$sample_in/slow033.txt", qw(--since 2190d),
60 )},60 )},
61 "t/pt-query-digest/samples/slow033-since-Nd.txt",61 "t/pt-query-digest/samples/slow033-since-Nd.txt",
62 stderr => 1,62 stderr => 1,
63 ),63 ),
64 '--since 1825d (5 years ago)'64 '--since 2190d (6 years ago)'
65);65);
6666
67# --until67# --until
6868
=== modified file 't/pt-table-checksum/basics.t'
--- t/pt-table-checksum/basics.t 2014-07-07 00:43:50 +0000
+++ t/pt-table-checksum/basics.t 2014-08-08 14:10:17 +0000
@@ -80,8 +80,8 @@
80# other than to ensure that there's at least one for each table.80# other than to ensure that there's at least one for each table.
81$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");81$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
82ok(82ok(
83 $row->[0] > 30 && $row->[0] < 50,83 $row->[0] > 30 && $row->[0] < 60,
84 'Between 30 and 50 chunks'84 'Between 30 and 60 chunks'
85) or diag($row->[0]);85) or diag($row->[0]);
8686
87# ############################################################################87# ############################################################################
@@ -97,6 +97,7 @@
97 "Static chunk size (--chunk-time 0)"97 "Static chunk size (--chunk-time 0)"
98);98);
9999
100
100$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");101$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
101ok(102ok(
102 $row->[0] >= 85 && $row->[0] <= 90,103 $row->[0] >= 85 && $row->[0] <= 90,
103104
=== modified file 't/pt-table-checksum/samples/default-results-5.5.txt'
--- t/pt-table-checksum/samples/default-results-5.5.txt 2013-02-19 01:51:14 +0000
+++ t/pt-table-checksum/samples/default-results-5.5.txt 2014-08-08 14:10:17 +0000
@@ -21,7 +21,7 @@
210 0 0 0 mysql.time_zone_transition210 0 0 0 mysql.time_zone_transition
220 0 0 0 mysql.time_zone_transition_type220 0 0 0 mysql.time_zone_transition_type
230 0 2 0 mysql.user230 0 2 0 mysql.user
240 0 38 0 percona_test.checksums240 0 22 0 percona_test.checksums
250 0 1 0 percona_test.load_data250 0 1 0 percona_test.load_data
260 0 1 0 percona_test.sentinel260 0 1 0 percona_test.sentinel
270 0 200 0 sakila.actor270 0 200 0 sakila.actor
2828
=== modified file 't/pt-table-checksum/samples/default-results-5.6.txt'
--- t/pt-table-checksum/samples/default-results-5.6.txt 2013-02-19 01:51:44 +0000
+++ t/pt-table-checksum/samples/default-results-5.6.txt 2014-08-08 14:10:17 +0000
@@ -20,7 +20,7 @@
200 0 0 0 mysql.time_zone_transition200 0 0 0 mysql.time_zone_transition
210 0 0 0 mysql.time_zone_transition_type210 0 0 0 mysql.time_zone_transition_type
220 0 2 0 mysql.user220 0 2 0 mysql.user
230 0 37 0 percona_test.checksums230 0 22 0 percona_test.checksums
240 0 1 0 percona_test.load_data240 0 1 0 percona_test.load_data
250 0 1 0 percona_test.sentinel250 0 1 0 percona_test.sentinel
260 0 200 0 sakila.actor260 0 200 0 sakila.actor
2727
=== modified file 't/pt-table-checksum/samples/static-chunk-size-results-5.5.txt'
--- t/pt-table-checksum/samples/static-chunk-size-results-5.5.txt 2013-02-19 01:51:14 +0000
+++ t/pt-table-checksum/samples/static-chunk-size-results-5.5.txt 2014-08-08 14:10:17 +0000
@@ -21,7 +21,7 @@
210 0 0 1 0 mysql.time_zone_transition210 0 0 1 0 mysql.time_zone_transition
220 0 0 1 0 mysql.time_zone_transition_type220 0 0 1 0 mysql.time_zone_transition_type
230 0 2 1 0 mysql.user230 0 2 1 0 mysql.user
240 0 38 1 0 percona_test.checksums240 0 22 1 0 percona_test.checksums
250 0 1 1 0 percona_test.load_data250 0 1 1 0 percona_test.load_data
260 0 1 1 0 percona_test.sentinel260 0 1 1 0 percona_test.sentinel
270 0 200 1 0 sakila.actor270 0 200 1 0 sakila.actor
2828
=== modified file 't/pt-table-checksum/samples/static-chunk-size-results-5.6.txt'
--- t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt 2013-02-19 01:51:44 +0000
+++ t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt 2014-08-08 14:10:17 +0000
@@ -20,7 +20,7 @@
200 0 0 1 0 mysql.time_zone_transition200 0 0 1 0 mysql.time_zone_transition
210 0 0 1 0 mysql.time_zone_transition_type210 0 0 1 0 mysql.time_zone_transition_type
220 0 2 1 0 mysql.user220 0 2 1 0 mysql.user
230 0 37 1 0 percona_test.checksums230 0 22 1 0 percona_test.checksums
240 0 1 1 0 percona_test.load_data240 0 1 1 0 percona_test.load_data
250 0 1 1 0 percona_test.sentinel250 0 1 1 0 percona_test.sentinel
260 0 200 1 0 sakila.actor260 0 200 1 0 sakila.actor

Subscribers

People subscribed via source and target branches