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

Proposed by Tomislav Plavcic
Status: Merged
Merged at revision: 611
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.12
Merge into: lp:percona-toolkit/2.2
Diff against target: 2086 lines (+720/-172)
50 files modified
Changelog (+12/-0)
Makefile.PL (+1/-1)
bin/pt-align (+9/-1)
bin/pt-archiver (+13/-2)
bin/pt-config-diff (+24/-5)
bin/pt-deadlock-logger (+24/-5)
bin/pt-diskstats (+2/-2)
bin/pt-duplicate-key-checker (+2/-2)
bin/pt-fifo-split (+9/-1)
bin/pt-find (+2/-2)
bin/pt-fingerprint (+9/-1)
bin/pt-fk-error-logger (+24/-5)
bin/pt-heartbeat (+28/-2)
bin/pt-index-usage (+2/-2)
bin/pt-ioprofile (+5/-2)
bin/pt-kill (+24/-5)
bin/pt-mext (+30/-24)
bin/pt-mysql-summary (+3/-1)
bin/pt-online-schema-change (+61/-8)
bin/pt-pmp (+5/-2)
bin/pt-query-digest (+26/-4)
bin/pt-show-grants (+9/-1)
bin/pt-sift (+5/-2)
bin/pt-slave-delay (+2/-2)
bin/pt-slave-find (+9/-1)
bin/pt-slave-restart (+2/-2)
bin/pt-stalk (+15/-2)
bin/pt-summary (+3/-1)
bin/pt-table-checksum (+58/-14)
bin/pt-table-sync (+2/-2)
bin/pt-table-usage (+9/-1)
bin/pt-upgrade (+24/-5)
bin/pt-variable-advisor (+2/-2)
bin/pt-visual-explain (+9/-1)
config/deb/changelog (+13/-0)
config/sphinx-build/conf.py (+1/-1)
docs/percona-toolkit.pod (+1/-1)
docs/release_notes.rst (+35/-0)
lib/Cxn.pm (+19/-2)
lib/OptionParser.pm (+10/-0)
lib/Percona/Toolkit.pm (+1/-1)
lib/Percona/XtraDB/Cluster.pm (+23/-2)
lib/bash/collect.sh (+9/-0)
lib/bash/parse_options.sh (+3/-0)
t/lib/OptionParser.t (+23/-0)
t/pt-archiver/basics.t (+1/-1)
t/pt-archiver/indexes.t (+1/-1)
t/pt-archiver/samples/issue-248.txt (+2/-2)
t/pt-query-digest/binlog_analyses.t (+21/-1)
t/pt-table-checksum/pxc.t (+93/-47)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/release-2.2.12
Reviewer Review Type Date Requested Status
Daniel Nichter Pending
Review via email: mp+241804@code.launchpad.net

Description of the change

Release branch for version 2.2.12

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-09-25 13:48:22 +0000
+++ Changelog 2014-11-14 14:12:25 +0000
@@ -1,5 +1,17 @@
1Changelog for Percona Toolkit1Changelog for Percona Toolkit
22
3v2.2.12 released 2014-11-14
4
5
6 * Fixed bug 1376561: pt-archiver is not able to archive all the rows when a table has a hash partition
7 * Fixed bug 1328686: pt-heartbeat check-read-only option does not prevent creates or inserts
8 * Fixed bug 1269695: pt-online-schema-change does not allow ALTER for a table without a non-unique, while manual does not explain this
9 * Fixed bug 1217466: pt-table-checksum refuses to run on PXC if server_id is the same on all nodes
10 * Fixed bug 1373937: pt-table-checksum requires recursion when working with and XtraDB Cluster node
11 * Fixed bug 1377888: pt-query-digest manual for --type binlog is ambiguous
12 * Fixed bug 1349086: pt-stalk should also gather dmesg output
13 * Fixed bug 1361293: Some scripts fail when no-version-check option is put in global config file
14
3v2.2.11 released 2014-09-2615v2.2.11 released 2014-09-26
416
5 * Fixed bug 1262456: pt-query-digest doesn't report host details17 * Fixed bug 1262456: pt-query-digest doesn't report host details
618
=== modified file 'Makefile.PL'
--- Makefile.PL 2014-09-25 13:48:22 +0000
+++ Makefile.PL 2014-11-14 14:12:25 +0000
@@ -2,7 +2,7 @@
22
3WriteMakefile(3WriteMakefile(
4 NAME => 'percona-toolkit',4 NAME => 'percona-toolkit',
5 VERSION => '2.2.11',5 VERSION => '2.2.12',
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-09-25 13:48:22 +0000
+++ bin/pt-align 2014-11-14 14:12:25 +0000
@@ -901,6 +901,14 @@
901 $parse = 0;901 $parse = 0;
902 next LINE;902 next LINE;
903 }903 }
904
905 if ( $parse
906 && !$self->has('version-check')
907 && $line =~ /version-check/
908 ) {
909 next LINE;
910 }
911
904 if ( $parse912 if ( $parse
905 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)913 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
906 ) {914 ) {
@@ -1323,6 +1331,6 @@
13231331
1324=head1 VERSION1332=head1 VERSION
13251333
1326pt-align 2.2.111334pt-align 2.2.12
13271335
1328=cut1336=cut
13291337
=== modified file 'bin/pt-archiver'
--- bin/pt-archiver 2014-09-25 13:48:22 +0000
+++ bin/pt-archiver 2014-11-14 14:12:25 +0000
@@ -43,7 +43,7 @@
43{43{
44package Percona::Toolkit;44package Percona::Toolkit;
4545
46our $VERSION = '2.2.11';46our $VERSION = '2.2.12';
4747
48use strict;48use strict;
49use warnings FATAL => 'all';49use warnings FATAL => 'all';
@@ -5811,7 +5811,18 @@
5811 $next_sql .= " AND $sel_stmt->{where}";5811 $next_sql .= " AND $sel_stmt->{where}";
5812 }5812 }
58135813
5814 # Obtain index cols so we can order them when ascending
5815 # this ensures returned sets are disjoint when ran on partitioned tables
5816 # issue 1376561
5817 my $index_cols;
5818 if ( $sel_stmt->{index}
5819 && $src->{info}->{keys}->{$sel_stmt->{index}}->{cols}
5820 ) {
5821 $index_cols = $src->{info}->{keys}->{$sel_stmt->{index}}->{colnames};
5822 }
5823
5814 foreach my $thing ( $first_sql, $next_sql ) {5824 foreach my $thing ( $first_sql, $next_sql ) {
5825 $thing .= " ORDER BY $index_cols" if $index_cols;
5815 $thing .= " LIMIT $limit";5826 $thing .= " LIMIT $limit";
5816 if ( $o->get('for-update') ) {5827 if ( $o->get('for-update') ) {
5817 $thing .= ' FOR UPDATE';5828 $thing .= ' FOR UPDATE';
@@ -7892,6 +7903,6 @@
78927903
7893=head1 VERSION7904=head1 VERSION
78947905
7895pt-archiver 2.2.117906pt-archiver 2.2.12
78967907
7897=cut7908=cut
78987909
=== modified file 'bin/pt-config-diff'
--- bin/pt-config-diff 2014-09-25 13:48:22 +0000
+++ bin/pt-config-diff 2014-11-14 14:12:25 +0000
@@ -43,7 +43,7 @@
43{43{
44package Percona::Toolkit;44package Percona::Toolkit;
4545
46our $VERSION = '2.2.11';46our $VERSION = '2.2.12';
4747
48use strict;48use strict;
49use warnings FATAL => 'all';49use warnings FATAL => 'all';
@@ -2295,7 +2295,7 @@
2295 set => $args{set},2295 set => $args{set},
2296 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,2296 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,
2297 dbh_set => 0,2297 dbh_set => 0,
2298 ask_pass => $o->get('ask-pass'),2298 ask_pass => $args{ask_pass},
2299 DSNParser => $dp,2299 DSNParser => $dp,
2300 is_cluster_node => undef,2300 is_cluster_node => undef,
2301 parent => $args{parent},2301 parent => $args{parent},
@@ -2306,7 +2306,7 @@
23062306
2307sub connect {2307sub connect {
2308 my ( $self, %opts ) = @_;2308 my ( $self, %opts ) = @_;
2309 my $dsn = $self->{dsn};2309 my $dsn = $opts{dsn} || $self->{dsn};
2310 my $dp = $self->{DSNParser};2310 my $dp = $self->{DSNParser};
23112311
2312 my $dbh = $self->{dbh};2312 my $dbh = $self->{dbh};
@@ -2325,6 +2325,13 @@
2325 }2325 }
23262326
2327 $dbh = $self->set_dbh($dbh);2327 $dbh = $self->set_dbh($dbh);
2328 if ( $opts{dsn} ) {
2329 $self->{dsn} = $dsn;
2330 $self->{dsn_name} = $dp->as_string($dsn, [qw(h P S)])
2331 || $dp->as_string($dsn, [qw(F)])
2332 || '';
2333
2334 }
2328 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});2335 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});
2329 return $dbh;2336 return $dbh;
2330}2337}
@@ -2386,6 +2393,17 @@
2386 return $self->{hostname} || $self->{dsn_name} || 'unknown host';2393 return $self->{hostname} || $self->{dsn_name} || 'unknown host';
2387}2394}
23882395
2396sub is_cluster_node {
2397 my ($self, $cxn) = @_;
2398
2399 my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
2400 PTDEBUG && _d($cxn->name, $sql);
2401 my $row = $cxn->dbh->selectrow_arrayref($sql);
2402 PTDEBUG && _d(Dumper($row));
2403 return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
2404
2405}
2406
2389sub remove_duplicate_cxns {2407sub remove_duplicate_cxns {
2390 my ($self, %args) = @_;2408 my ($self, %args) = @_;
2391 my @cxns = @{$args{cxns}};2409 my @cxns = @{$args{cxns}};
@@ -2395,7 +2413,8 @@
23952413
2396 for my $cxn ( @cxns ) {2414 for my $cxn ( @cxns ) {
2397 my $dbh = $cxn->dbh();2415 my $dbh = $cxn->dbh();
2398 my $sql = q{SELECT @@server_id};2416
2417 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
2399 PTDEBUG && _d($sql);2418 PTDEBUG && _d($sql);
2400 my ($id) = $dbh->selectrow_array($sql);2419 my ($id) = $dbh->selectrow_array($sql);
2401 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);2420 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
@@ -5733,6 +5752,6 @@
57335752
5734=head1 VERSION5753=head1 VERSION
57355754
5736pt-config-diff 2.2.115755pt-config-diff 2.2.12
57375756
5738=cut5757=cut
57395758
=== modified file 'bin/pt-deadlock-logger'
--- bin/pt-deadlock-logger 2014-09-25 13:48:22 +0000
+++ bin/pt-deadlock-logger 2014-11-14 14:12:25 +0000
@@ -42,7 +42,7 @@
42{42{
43package Percona::Toolkit;43package Percona::Toolkit;
4444
45our $VERSION = '2.2.11';45our $VERSION = '2.2.12';
4646
47use strict;47use strict;
48use warnings FATAL => 'all';48use warnings FATAL => 'all';
@@ -2639,7 +2639,7 @@
2639 set => $args{set},2639 set => $args{set},
2640 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,2640 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,
2641 dbh_set => 0,2641 dbh_set => 0,
2642 ask_pass => $o->get('ask-pass'),2642 ask_pass => $args{ask_pass},
2643 DSNParser => $dp,2643 DSNParser => $dp,
2644 is_cluster_node => undef,2644 is_cluster_node => undef,
2645 parent => $args{parent},2645 parent => $args{parent},
@@ -2650,7 +2650,7 @@
26502650
2651sub connect {2651sub connect {
2652 my ( $self, %opts ) = @_;2652 my ( $self, %opts ) = @_;
2653 my $dsn = $self->{dsn};2653 my $dsn = $opts{dsn} || $self->{dsn};
2654 my $dp = $self->{DSNParser};2654 my $dp = $self->{DSNParser};
26552655
2656 my $dbh = $self->{dbh};2656 my $dbh = $self->{dbh};
@@ -2669,6 +2669,13 @@
2669 }2669 }
26702670
2671 $dbh = $self->set_dbh($dbh);2671 $dbh = $self->set_dbh($dbh);
2672 if ( $opts{dsn} ) {
2673 $self->{dsn} = $dsn;
2674 $self->{dsn_name} = $dp->as_string($dsn, [qw(h P S)])
2675 || $dp->as_string($dsn, [qw(F)])
2676 || '';
2677
2678 }
2672 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});2679 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});
2673 return $dbh;2680 return $dbh;
2674}2681}
@@ -2730,6 +2737,17 @@
2730 return $self->{hostname} || $self->{dsn_name} || 'unknown host';2737 return $self->{hostname} || $self->{dsn_name} || 'unknown host';
2731}2738}
27322739
2740sub is_cluster_node {
2741 my ($self, $cxn) = @_;
2742
2743 my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
2744 PTDEBUG && _d($cxn->name, $sql);
2745 my $row = $cxn->dbh->selectrow_arrayref($sql);
2746 PTDEBUG && _d(Dumper($row));
2747 return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
2748
2749}
2750
2733sub remove_duplicate_cxns {2751sub remove_duplicate_cxns {
2734 my ($self, %args) = @_;2752 my ($self, %args) = @_;
2735 my @cxns = @{$args{cxns}};2753 my @cxns = @{$args{cxns}};
@@ -2739,7 +2757,8 @@
27392757
2740 for my $cxn ( @cxns ) {2758 for my $cxn ( @cxns ) {
2741 my $dbh = $cxn->dbh();2759 my $dbh = $cxn->dbh();
2742 my $sql = q{SELECT @@server_id};2760
2761 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
2743 PTDEBUG && _d($sql);2762 PTDEBUG && _d($sql);
2744 my ($id) = $dbh->selectrow_array($sql);2763 my ($id) = $dbh->selectrow_array($sql);
2745 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);2764 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
@@ -5523,6 +5542,6 @@
55235542
5524=head1 VERSION5543=head1 VERSION
55255544
5526pt-deadlock-logger 2.2.115545pt-deadlock-logger 2.2.12
55275546
5528=cut5547=cut
55295548
=== modified file 'bin/pt-diskstats'
--- bin/pt-diskstats 2014-09-25 13:48:22 +0000
+++ bin/pt-diskstats 2014-11-14 14:12:25 +0000
@@ -38,7 +38,7 @@
38{38{
39package Percona::Toolkit;39package Percona::Toolkit;
4040
41our $VERSION = '2.2.11';41our $VERSION = '2.2.12';
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.115582pt-diskstats 2.2.12
55835583
5584=cut5584=cut
55855585
=== modified file 'bin/pt-duplicate-key-checker'
--- bin/pt-duplicate-key-checker 2014-09-25 13:48:22 +0000
+++ bin/pt-duplicate-key-checker 2014-11-14 14:12:25 +0000
@@ -39,7 +39,7 @@
39{39{
40package Percona::Toolkit;40package Percona::Toolkit;
4141
42our $VERSION = '2.2.11';42our $VERSION = '2.2.12';
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.115603pt-duplicate-key-checker 2.2.12
56045604
5605=cut5605=cut
56065606
=== modified file 'bin/pt-fifo-split'
--- bin/pt-fifo-split 2014-09-25 13:48:22 +0000
+++ bin/pt-fifo-split 2014-11-14 14:12:25 +0000
@@ -902,6 +902,14 @@
902 $parse = 0;902 $parse = 0;
903 next LINE;903 next LINE;
904 }904 }
905
906 if ( $parse
907 && !$self->has('version-check')
908 && $line =~ /version-check/
909 ) {
910 next LINE;
911 }
912
905 if ( $parse913 if ( $parse
906 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)914 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
907 ) {915 ) {
@@ -1612,6 +1620,6 @@
16121620
1613=head1 VERSION1621=head1 VERSION
16141622
1615pt-fifo-split 2.2.111623pt-fifo-split 2.2.12
16161624
1617=cut1625=cut
16181626
=== modified file 'bin/pt-find'
--- bin/pt-find 2014-09-25 13:48:22 +0000
+++ bin/pt-find 2014-11-14 14:12:25 +0000
@@ -35,7 +35,7 @@
35{35{
36package Percona::Toolkit;36package Percona::Toolkit;
3737
38our $VERSION = '2.2.11';38our $VERSION = '2.2.12';
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.114987pt-find 2.2.12
49884988
4989=cut4989=cut
49904990
=== modified file 'bin/pt-fingerprint'
--- bin/pt-fingerprint 2014-09-25 13:48:22 +0000
+++ bin/pt-fingerprint 2014-11-14 14:12:25 +0000
@@ -903,6 +903,14 @@
903 $parse = 0;903 $parse = 0;
904 next LINE;904 next LINE;
905 }905 }
906
907 if ( $parse
908 && !$self->has('version-check')
909 && $line =~ /version-check/
910 ) {
911 next LINE;
912 }
913
906 if ( $parse914 if ( $parse
907 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)915 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
908 ) {916 ) {
@@ -2203,6 +2211,6 @@
22032211
2204=head1 VERSION2212=head1 VERSION
22052213
2206pt-fingerprint 2.2.112214pt-fingerprint 2.2.12
22072215
2208=cut2216=cut
22092217
=== modified file 'bin/pt-fk-error-logger'
--- bin/pt-fk-error-logger 2014-09-25 13:48:22 +0000
+++ bin/pt-fk-error-logger 2014-11-14 14:12:25 +0000
@@ -37,7 +37,7 @@
37{37{
38package Percona::Toolkit;38package Percona::Toolkit;
3939
40our $VERSION = '2.2.11';40our $VERSION = '2.2.12';
4141
42use strict;42use strict;
43use warnings FATAL => 'all';43use warnings FATAL => 'all';
@@ -1791,7 +1791,7 @@
1791 set => $args{set},1791 set => $args{set},
1792 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,1792 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,
1793 dbh_set => 0,1793 dbh_set => 0,
1794 ask_pass => $o->get('ask-pass'),1794 ask_pass => $args{ask_pass},
1795 DSNParser => $dp,1795 DSNParser => $dp,
1796 is_cluster_node => undef,1796 is_cluster_node => undef,
1797 parent => $args{parent},1797 parent => $args{parent},
@@ -1802,7 +1802,7 @@
18021802
1803sub connect {1803sub connect {
1804 my ( $self, %opts ) = @_;1804 my ( $self, %opts ) = @_;
1805 my $dsn = $self->{dsn};1805 my $dsn = $opts{dsn} || $self->{dsn};
1806 my $dp = $self->{DSNParser};1806 my $dp = $self->{DSNParser};
18071807
1808 my $dbh = $self->{dbh};1808 my $dbh = $self->{dbh};
@@ -1821,6 +1821,13 @@
1821 }1821 }
18221822
1823 $dbh = $self->set_dbh($dbh);1823 $dbh = $self->set_dbh($dbh);
1824 if ( $opts{dsn} ) {
1825 $self->{dsn} = $dsn;
1826 $self->{dsn_name} = $dp->as_string($dsn, [qw(h P S)])
1827 || $dp->as_string($dsn, [qw(F)])
1828 || '';
1829
1830 }
1824 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});1831 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});
1825 return $dbh;1832 return $dbh;
1826}1833}
@@ -1882,6 +1889,17 @@
1882 return $self->{hostname} || $self->{dsn_name} || 'unknown host';1889 return $self->{hostname} || $self->{dsn_name} || 'unknown host';
1883}1890}
18841891
1892sub is_cluster_node {
1893 my ($self, $cxn) = @_;
1894
1895 my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
1896 PTDEBUG && _d($cxn->name, $sql);
1897 my $row = $cxn->dbh->selectrow_arrayref($sql);
1898 PTDEBUG && _d(Dumper($row));
1899 return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
1900
1901}
1902
1885sub remove_duplicate_cxns {1903sub remove_duplicate_cxns {
1886 my ($self, %args) = @_;1904 my ($self, %args) = @_;
1887 my @cxns = @{$args{cxns}};1905 my @cxns = @{$args{cxns}};
@@ -1891,7 +1909,8 @@
18911909
1892 for my $cxn ( @cxns ) {1910 for my $cxn ( @cxns ) {
1893 my $dbh = $cxn->dbh();1911 my $dbh = $cxn->dbh();
1894 my $sql = q{SELECT @@server_id};1912
1913 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
1895 PTDEBUG && _d($sql);1914 PTDEBUG && _d($sql);
1896 my ($id) = $dbh->selectrow_array($sql);1915 my ($id) = $dbh->selectrow_array($sql);
1897 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);1916 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
@@ -4509,6 +4528,6 @@
45094528
4510=head1 VERSION4529=head1 VERSION
45114530
4512pt-fk-error-logger 2.2.114531pt-fk-error-logger 2.2.12
45134532
4514=cut4533=cut
45154534
=== modified file 'bin/pt-heartbeat'
--- bin/pt-heartbeat 2014-09-25 13:48:22 +0000
+++ bin/pt-heartbeat 2014-11-14 14:12:25 +0000
@@ -38,7 +38,7 @@
38{38{
39package Percona::Toolkit;39package Percona::Toolkit;
4040
41our $VERSION = '2.2.11';41our $VERSION = '2.2.12';
4242
43use strict;43use strict;
44use warnings FATAL => 'all';44use warnings FATAL => 'all';
@@ -4892,6 +4892,32 @@
4892 $dbh->do("USE `$db`");4892 $dbh->do("USE `$db`");
48934893
4894 # ########################################################################4894 # ########################################################################
4895 # If --check-read-only option was given and we are in --update mode
4896 # we wait until server is writable , or run-time is over, or sentinel file
4897 # We also do this check after daemon is up and running, but it is necessary
4898 # to check this before attempting to create the table and inserting rows
4899 # https://bugs.launchpad.net/percona-toolkit/+bug/1328686
4900 # #######################################################################
4901 if ( $o->get('check-read-only') && $o->get('update') ) {
4902 PTDEBUG && _d('Checking if server is read_only');
4903 if ( server_is_readonly($dbh) && PTDEBUG ) {
4904 _d('Server is read-only, waiting')
4905 }
4906 my $start_time = time;
4907 my $run_time = $o->get('run-time');
4908 my $interval = $o->get('interval') || 5;
4909 while (server_is_readonly($dbh)) {
4910 sleep($interval);
4911 if (
4912 ($run_time && $run_time < time - $start_time)
4913 || -f $sentinel
4914 ) {
4915 return 0;
4916 }
4917 }
4918 }
4919
4920 # ########################################################################
4895 # Create the heartbeat table if --create-table was given.4921 # Create the heartbeat table if --create-table was given.
4896 # ########################################################################4922 # ########################################################################
4897 my $utc = $o->get('utc');4923 my $utc = $o->get('utc');
@@ -6192,6 +6218,6 @@
61926218
6193=head1 VERSION6219=head1 VERSION
61946220
6195pt-heartbeat 2.2.116221pt-heartbeat 2.2.12
61966222
6197=cut6223=cut
61986224
=== modified file 'bin/pt-index-usage'
--- bin/pt-index-usage 2014-09-25 13:48:22 +0000
+++ bin/pt-index-usage 2014-11-14 14:12:25 +0000
@@ -45,7 +45,7 @@
45{45{
46package Percona::Toolkit;46package Percona::Toolkit;
4747
48our $VERSION = '2.2.11';48our $VERSION = '2.2.12';
4949
50use strict;50use strict;
51use warnings FATAL => 'all';51use warnings FATAL => 'all';
@@ -7548,6 +7548,6 @@
75487548
7549=head1 VERSION7549=head1 VERSION
75507550
7551pt-index-usage 2.2.117551pt-index-usage 2.2.12
75527552
7553=cut7553=cut
75547554
=== modified file 'bin/pt-ioprofile'
--- bin/pt-ioprofile 2014-09-25 13:48:22 +0000
+++ bin/pt-ioprofile 2014-11-14 14:12:25 +0000
@@ -86,9 +86,10 @@
8686
87usage_or_errors() {87usage_or_errors() {
88 local file="$1"88 local file="$1"
89 local version=""
8990
90 if [ "$OPT_VERSION" ]; then91 if [ "$OPT_VERSION" ]; then
91 local version=$(grep '^pt-[^ ]\+ [0-9]' "$file")92 version=$(grep '^pt-[^ ]\+ [0-9]' "$file")
92 echo "$version"93 echo "$version"
93 return 194 return 1
94 fi95 fi
@@ -310,6 +311,8 @@
310311
311 [ "$config_opt" = "" ] && continue312 [ "$config_opt" = "" ] && continue
312313
314 echo "$config_opt" | grep -v 'version-check' >/dev/null 2>&1 || continue
315
313 if ! [ "$HAVE_EXT_ARGV" ]; then316 if ! [ "$HAVE_EXT_ARGV" ]; then
314 config_opt="--$config_opt"317 config_opt="--$config_opt"
315 fi318 fi
@@ -1119,7 +1122,7 @@
11191122
1120=head1 VERSION1123=head1 VERSION
11211124
1122pt-ioprofile 2.2.111125pt-ioprofile 2.2.12
11231126
1124=cut1127=cut
11251128
11261129
=== modified file 'bin/pt-kill'
--- bin/pt-kill 2014-09-25 13:48:22 +0000
+++ bin/pt-kill 2014-11-14 14:12:25 +0000
@@ -47,7 +47,7 @@
47{47{
48package Percona::Toolkit;48package Percona::Toolkit;
4949
50our $VERSION = '2.2.11';50our $VERSION = '2.2.12';
5151
52use strict;52use strict;
53use warnings FATAL => 'all';53use warnings FATAL => 'all';
@@ -5158,7 +5158,7 @@
5158 set => $args{set},5158 set => $args{set},
5159 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,5159 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,
5160 dbh_set => 0,5160 dbh_set => 0,
5161 ask_pass => $o->get('ask-pass'),5161 ask_pass => $args{ask_pass},
5162 DSNParser => $dp,5162 DSNParser => $dp,
5163 is_cluster_node => undef,5163 is_cluster_node => undef,
5164 parent => $args{parent},5164 parent => $args{parent},
@@ -5169,7 +5169,7 @@
51695169
5170sub connect {5170sub connect {
5171 my ( $self, %opts ) = @_;5171 my ( $self, %opts ) = @_;
5172 my $dsn = $self->{dsn};5172 my $dsn = $opts{dsn} || $self->{dsn};
5173 my $dp = $self->{DSNParser};5173 my $dp = $self->{DSNParser};
51745174
5175 my $dbh = $self->{dbh};5175 my $dbh = $self->{dbh};
@@ -5188,6 +5188,13 @@
5188 }5188 }
51895189
5190 $dbh = $self->set_dbh($dbh);5190 $dbh = $self->set_dbh($dbh);
5191 if ( $opts{dsn} ) {
5192 $self->{dsn} = $dsn;
5193 $self->{dsn_name} = $dp->as_string($dsn, [qw(h P S)])
5194 || $dp->as_string($dsn, [qw(F)])
5195 || '';
5196
5197 }
5191 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});5198 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});
5192 return $dbh;5199 return $dbh;
5193}5200}
@@ -5249,6 +5256,17 @@
5249 return $self->{hostname} || $self->{dsn_name} || 'unknown host';5256 return $self->{hostname} || $self->{dsn_name} || 'unknown host';
5250}5257}
52515258
5259sub is_cluster_node {
5260 my ($self, $cxn) = @_;
5261
5262 my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
5263 PTDEBUG && _d($cxn->name, $sql);
5264 my $row = $cxn->dbh->selectrow_arrayref($sql);
5265 PTDEBUG && _d(Dumper($row));
5266 return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
5267
5268}
5269
5252sub remove_duplicate_cxns {5270sub remove_duplicate_cxns {
5253 my ($self, %args) = @_;5271 my ($self, %args) = @_;
5254 my @cxns = @{$args{cxns}};5272 my @cxns = @{$args{cxns}};
@@ -5258,7 +5276,8 @@
52585276
5259 for my $cxn ( @cxns ) {5277 for my $cxn ( @cxns ) {
5260 my $dbh = $cxn->dbh();5278 my $dbh = $cxn->dbh();
5261 my $sql = q{SELECT @@server_id};5279
5280 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
5262 PTDEBUG && _d($sql);5281 PTDEBUG && _d($sql);
5263 my ($id) = $dbh->selectrow_array($sql);5282 my ($id) = $dbh->selectrow_array($sql);
5264 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);5283 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
@@ -8183,6 +8202,6 @@
81838202
8184=head1 VERSION8203=head1 VERSION
81858204
8186pt-kill 2.2.118205pt-kill 2.2.12
81878206
8188=cut8207=cut
81898208
=== modified file 'bin/pt-mext'
--- bin/pt-mext 2014-09-25 13:48:22 +0000
+++ bin/pt-mext 2014-11-14 14:12:25 +0000
@@ -251,34 +251,38 @@
251_parse_pod() {251_parse_pod() {
252 local file="$1"252 local file="$1"
253253
254 cat "$file" | PO_DIR="$PO_DIR" perl -ne '254 PO_FILE="$file" PO_DIR="$PO_DIR" perl -e '
255 BEGIN { $/ = ""; }255 $/ = "";
256 next unless $_ =~ m/^=head1 OPTIONS/;256 my $file = $ENV{PO_FILE};
257 while ( defined(my $para = <>) ) {257 open my $fh, "<", $file or die "Cannot open $file: $!";
258 last if $para =~ m/^=head1/;258 while ( defined(my $para = <$fh>) ) {
259 chomp;259 next unless $para =~ m/^=head1 OPTIONS/;
260 if ( $para =~ m/^=item --(\S+)/ ) {260 while ( defined(my $para = <$fh>) ) {
261 my $opt = $1;261 last if $para =~ m/^=head1/;
262 my $file = "$ENV{PO_DIR}/$opt";
263 open my $opt_fh, ">", $file or die "Cannot open $file: $!";
264 print $opt_fh "long:$opt\n";
265 $para = <>;
266 chomp;262 chomp;
267 if ( $para =~ m/^[a-z ]+:/ ) {263 if ( $para =~ m/^=item --(\S+)/ ) {
268 map {264 my $opt = $1;
265 my $file = "$ENV{PO_DIR}/$opt";
266 open my $opt_fh, ">", $file or die "Cannot open $file: $!";
267 print $opt_fh "long:$opt\n";
268 $para = <$fh>;
269 chomp;
270 if ( $para =~ m/^[a-z ]+:/ ) {
271 map {
272 chomp;
273 my ($attrib, $val) = split(/: /, $_);
274 print $opt_fh "$attrib:$val\n";
275 } split(/; /, $para);
276 $para = <$fh>;
269 chomp;277 chomp;
270 my ($attrib, $val) = split(/: /, $_);278 }
271 print $opt_fh "$attrib:$val\n";279 my ($desc) = $para =~ m/^([^?.]+)/;
272 } split(/; /, $para);280 print $opt_fh "desc:$desc.\n";
273 $para = <>;281 close $opt_fh;
274 chomp;
275 }282 }
276 my ($desc) = $para =~ m/^([^?.]+)/;
277 print $opt_fh "desc:$desc.\n";
278 close $opt_fh;
279 }283 }
284 last;
280 }285 }
281 last;
282 '286 '
283}287}
284288
@@ -348,6 +352,8 @@
348352
349 [ "$config_opt" = "" ] && continue353 [ "$config_opt" = "" ] && continue
350354
355 echo "$config_opt" | grep -v 'version-check' >/dev/null 2>&1 || continue
356
351 if ! [ "$HAVE_EXT_ARGV" ]; then357 if ! [ "$HAVE_EXT_ARGV" ]; then
352 config_opt="--$config_opt"358 config_opt="--$config_opt"
353 fi359 fi
@@ -792,7 +798,7 @@
792798
793=head1 VERSION799=head1 VERSION
794800
795pt-mext 2.2.11801pt-mext 2.2.12
796802
797=cut803=cut
798804
799805
=== modified file 'bin/pt-mysql-summary'
--- bin/pt-mysql-summary 2014-09-25 13:48:22 +0000
+++ bin/pt-mysql-summary 2014-11-14 14:12:25 +0000
@@ -313,6 +313,8 @@
313313
314 [ "$config_opt" = "" ] && continue314 [ "$config_opt" = "" ] && continue
315315
316 echo "$config_opt" | grep -v 'version-check' >/dev/null 2>&1 || continue
317
316 if ! [ "$HAVE_EXT_ARGV" ]; then318 if ! [ "$HAVE_EXT_ARGV" ]; then
317 config_opt="--$config_opt"319 config_opt="--$config_opt"
318 fi320 fi
@@ -3083,7 +3085,7 @@
30833085
3084=head1 VERSION3086=head1 VERSION
30853087
3086pt-mysql-summary 2.2.113088pt-mysql-summary 2.2.12
30873089
3088=cut3090=cut
30893091
30903092
=== modified file 'bin/pt-online-schema-change'
--- bin/pt-online-schema-change 2014-09-25 13:48:22 +0000
+++ bin/pt-online-schema-change 2014-11-14 14:12:25 +0000
@@ -54,7 +54,7 @@
54{54{
55package Percona::Toolkit;55package Percona::Toolkit;
5656
57our $VERSION = '2.2.11';57our $VERSION = '2.2.12';
5858
59use strict;59use strict;
60use warnings FATAL => 'all';60use warnings FATAL => 'all';
@@ -3755,7 +3755,7 @@
3755 set => $args{set},3755 set => $args{set},
3756 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,3756 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,
3757 dbh_set => 0,3757 dbh_set => 0,
3758 ask_pass => $o->get('ask-pass'),3758 ask_pass => $args{ask_pass},
3759 DSNParser => $dp,3759 DSNParser => $dp,
3760 is_cluster_node => undef,3760 is_cluster_node => undef,
3761 parent => $args{parent},3761 parent => $args{parent},
@@ -3766,12 +3766,12 @@
37663766
3767sub connect {3767sub connect {
3768 my ( $self, %opts ) = @_;3768 my ( $self, %opts ) = @_;
3769 my $dsn = $self->{dsn};3769 my $dsn = $opts{dsn} || $self->{dsn};
3770 my $dp = $self->{DSNParser};3770 my $dp = $self->{DSNParser};
37713771
3772 my $dbh = $self->{dbh};3772 my $dbh = $self->{dbh};
3773 if ( !$dbh || !$dbh->ping() ) {3773 if ( !$dbh || !$dbh->ping() ) {
3774 if ( $self->{ask_pass} && !$self->{asked_for_pass} && !defined $dsn->{p}) {3774 if ( $self->{ask_pass} && !$self->{asked_for_pass} ) {
3775 $dsn->{p} = OptionParser::prompt_noecho("Enter MySQL password: ");3775 $dsn->{p} = OptionParser::prompt_noecho("Enter MySQL password: ");
3776 $self->{asked_for_pass} = 1;3776 $self->{asked_for_pass} = 1;
3777 }3777 }
@@ -3785,6 +3785,13 @@
3785 }3785 }
37863786
3787 $dbh = $self->set_dbh($dbh);3787 $dbh = $self->set_dbh($dbh);
3788 if ( $opts{dsn} ) {
3789 $self->{dsn} = $dsn;
3790 $self->{dsn_name} = $dp->as_string($dsn, [qw(h P S)])
3791 || $dp->as_string($dsn, [qw(F)])
3792 || '';
3793
3794 }
3788 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});3795 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});
3789 return $dbh;3796 return $dbh;
3790}3797}
@@ -3846,6 +3853,17 @@
3846 return $self->{hostname} || $self->{dsn_name} || 'unknown host';3853 return $self->{hostname} || $self->{dsn_name} || 'unknown host';
3847}3854}
38483855
3856sub is_cluster_node {
3857 my ($self, $cxn) = @_;
3858
3859 my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
3860 PTDEBUG && _d($cxn->name, $sql);
3861 my $row = $cxn->dbh->selectrow_arrayref($sql);
3862 PTDEBUG && _d(Dumper($row));
3863 return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
3864
3865}
3866
3849sub remove_duplicate_cxns {3867sub remove_duplicate_cxns {
3850 my ($self, %args) = @_;3868 my ($self, %args) = @_;
3851 my @cxns = @{$args{cxns}};3869 my @cxns = @{$args{cxns}};
@@ -3855,7 +3873,8 @@
38553873
3856 for my $cxn ( @cxns ) {3874 for my $cxn ( @cxns ) {
3857 my $dbh = $cxn->dbh();3875 my $dbh = $cxn->dbh();
3858 my $sql = q{SELECT @@server_id};3876
3877 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
3859 PTDEBUG && _d($sql);3878 PTDEBUG && _d($sql);
3860 my ($id) = $dbh->selectrow_array($sql);3879 my ($id) = $dbh->selectrow_array($sql);
3861 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);3880 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
@@ -7638,8 +7657,26 @@
7638sub remove_duplicate_cxns {7657sub remove_duplicate_cxns {
7639 my ($self, %args) = @_;7658 my ($self, %args) = @_;
7640 my @cxns = @{$args{cxns}};7659 my @cxns = @{$args{cxns}};
7641 my $seen_ids = $args{seen_ids};7660 my $seen_ids = $args{seen_ids} || {};
7642 return Cxn->remove_duplicate_cxns(%args);7661 PTDEBUG && _d("Removing duplicates nodes from ", join(" ", map { $_->name } @cxns));
7662 my @trimmed_cxns;
7663
7664 for my $cxn ( @cxns ) {
7665 my $dbh = $cxn->dbh();
7666 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
7667 PTDEBUG && _d($sql);
7668 my ($id) = $dbh->selectrow_array($sql);
7669 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
7670
7671 if ( ! $seen_ids->{$id}++ ) {
7672 push @trimmed_cxns, $cxn
7673 }
7674 else {
7675 PTDEBUG && _d("Removing ", $cxn->name,
7676 ", ID ", $id, ", because we've already seen it");
7677 }
7678 }
7679 return \@trimmed_cxns;
7643}7680}
76447681
7645sub same_cluster {7682sub same_cluster {
@@ -10556,6 +10593,12 @@
1055610593
10557=item *10594=item *
1055810595
10596In most cases the tool will refuse to operate unless a PRIMARY KEY or UNIQUE INDEX is
10597present in the table. See L<"--alter"> for details.
10598
10599
10600=item *
10601
10559The tool refuses to operate if it detects replication filters. See10602The tool refuses to operate if it detects replication filters. See
10560L<"--[no]check-replication-filters"> for details.10603L<"--[no]check-replication-filters"> for details.
1056110604
@@ -10634,6 +10677,16 @@
1063410677
10635=item *10678=item *
1063610679
10680In almost all cases a PRIMARY KEY or UNIQUE INDEX needs to be present in the table.
10681This is necessary because the tool creates a DELETE trigger to keep the new table
10682updated while the process is running.
10683
10684A notable exception is when a PRIMARY KEY or UNIQUE INDEX is being created from
10685B<existing columns> as part of the ALTER clause; in that case it will use these
10686column(s) for the DELETE trigger.
10687
10688=item *
10689
10637The C<RENAME> clause cannot be used to rename the table.10690The C<RENAME> clause cannot be used to rename the table.
1063810691
10639=item *10692=item *
@@ -11563,6 +11616,6 @@
1156311616
11564=head1 VERSION11617=head1 VERSION
1156511618
11566pt-online-schema-change 2.2.1111619pt-online-schema-change 2.2.12
1156711620
11568=cut11621=cut
1156911622
=== modified file 'bin/pt-pmp'
--- bin/pt-pmp 2014-09-25 13:48:22 +0000
+++ bin/pt-pmp 2014-11-14 14:12:25 +0000
@@ -129,9 +129,10 @@
129129
130usage_or_errors() {130usage_or_errors() {
131 local file="$1"131 local file="$1"
132 local version=""
132133
133 if [ "$OPT_VERSION" ]; then134 if [ "$OPT_VERSION" ]; then
134 local version=$(grep '^pt-[^ ]\+ [0-9]' "$file")135 version=$(grep '^pt-[^ ]\+ [0-9]' "$file")
135 echo "$version"136 echo "$version"
136 return 1137 return 1
137 fi138 fi
@@ -353,6 +354,8 @@
353354
354 [ "$config_opt" = "" ] && continue355 [ "$config_opt" = "" ] && continue
355356
357 echo "$config_opt" | grep -v 'version-check' >/dev/null 2>&1 || continue
358
356 if ! [ "$HAVE_EXT_ARGV" ]; then359 if ! [ "$HAVE_EXT_ARGV" ]; then
357 config_opt="--$config_opt"360 config_opt="--$config_opt"
358 fi361 fi
@@ -889,7 +892,7 @@
889892
890=head1 VERSION893=head1 VERSION
891894
892pt-pmp 2.2.11895pt-pmp 2.2.12
893896
894=cut897=cut
895898
896899
=== modified file 'bin/pt-query-digest'
--- bin/pt-query-digest 2014-09-25 13:48:22 +0000
+++ bin/pt-query-digest 2014-11-14 14:12:25 +0000
@@ -64,7 +64,7 @@
64{64{
65package Percona::Toolkit;65package Percona::Toolkit;
6666
67our $VERSION = '2.2.11';67our $VERSION = '2.2.12';
6868
69use strict;69use strict;
70use warnings FATAL => 'all';70use warnings FATAL => 'all';
@@ -13181,6 +13181,13 @@
13181 if ( $fh ) {13181 if ( $fh ) {
13182 PTDEBUG && _d('Reading', $filename);13182 PTDEBUG && _d('Reading', $filename);
13183 PTDEBUG && _d('File size:', $filesize);13183 PTDEBUG && _d('File size:', $filesize);
13184 # catch if user is trying to use an uncoverted (raw) binlog # issue 1377888
13185 if ( $filename && $o->get('type')->[0] eq 'binlog') {
13186 if (is_raw_binlog($filename)) {
13187 warn "Binlog file $filename must first be converted to text format using mysqlbinlog";
13188 return 1;
13189 }
13190 }
13184 push @read_files, { name => ($filename || "STDIN"), size => $filesize };13191 push @read_files, { name => ($filename || "STDIN"), size => $filesize };
1318513192
13186 # Read the file offset for --resume.13193 # Read the file offset for --resume.
@@ -14722,6 +14729,14 @@
14722 return;14729 return;
14723}14730}
1472414731
14732# make an effort to check if file is a raw binlog
14733# (i.e. was not converted to text using mysqlbinlog)
14734sub is_raw_binlog {
14735 my $filename = shift;
14736
14737 return -B $filename;
14738}
14739
14725sub _d {14740sub _d {
14726 my ($package, undef, $line) = caller 0;14741 my ($package, undef, $line) = caller 0;
14727 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }14742 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
@@ -14798,7 +14813,8 @@
1479814813
14799pt-query-digest is a sophisticated but easy to use tool for analyzing14814pt-query-digest is a sophisticated but easy to use tool for analyzing
14800MySQL queries. It can analyze queries from MySQL slow, general, and binary14815MySQL queries. It can analyze queries from MySQL slow, general, and binary
14801logs, as well as C<SHOW PROCESSLIST> and MySQL protocol data from tcpdump.14816logs. (Binary logs must first be converted to text, see L<"--type">).
14817It can also use C<SHOW PROCESSLIST> and MySQL protocol data from tcpdump.
14802By default, the tool reports which queries are the slowest, and therefore14818By default, the tool reports which queries are the slowest, and therefore
14803the most important to optimize. More complex and custom-tailored reports14819the most important to optimize. More complex and custom-tailored reports
14804can be created by using options like L<"--group-by">, L<"--filter">, and14820can be created by using options like L<"--group-by">, L<"--filter">, and
@@ -16134,7 +16150,13 @@
1613416150
16135=item binlog16151=item binlog
1613616152
16137Parse a binary log file.16153Parse a binary log file that has first been converted to text using mysqlbinlog.
16154
16155For example:
16156
16157 mysqlbinlog mysql-bin.000441 > mysql-bin.000441.txt
16158
16159 pt-query-digest --type binlog mysql-bin.000441.txt
1613816160
16139=item genlog16161=item genlog
1614016162
@@ -16595,6 +16617,6 @@
1659516617
16596=head1 VERSION16618=head1 VERSION
1659716619
16598pt-query-digest 2.2.1116620pt-query-digest 2.2.12
1659916621
16600=cut16622=cut
1660116623
=== modified file 'bin/pt-show-grants'
--- bin/pt-show-grants 2014-09-25 13:48:22 +0000
+++ bin/pt-show-grants 2014-11-14 14:12:25 +0000
@@ -903,6 +903,14 @@
903 $parse = 0;903 $parse = 0;
904 next LINE;904 next LINE;
905 }905 }
906
907 if ( $parse
908 && !$self->has('version-check')
909 && $line =~ /version-check/
910 ) {
911 next LINE;
912 }
913
906 if ( $parse914 if ( $parse
907 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)915 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
908 ) {916 ) {
@@ -2406,6 +2414,6 @@
24062414
2407=head1 VERSION2415=head1 VERSION
24082416
2409pt-show-grants 2.2.112417pt-show-grants 2.2.12
24102418
2411=cut2419=cut
24122420
=== modified file 'bin/pt-sift'
--- bin/pt-sift 2014-09-25 13:48:22 +0000
+++ bin/pt-sift 2014-11-14 14:12:25 +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
@@ -351,6 +352,8 @@
351352
352 [ "$config_opt" = "" ] && continue353 [ "$config_opt" = "" ] && continue
353354
355 echo "$config_opt" | grep -v 'version-check' >/dev/null 2>&1 || continue
356
354 if ! [ "$HAVE_EXT_ARGV" ]; then357 if ! [ "$HAVE_EXT_ARGV" ]; then
355 config_opt="--$config_opt"358 config_opt="--$config_opt"
356 fi359 fi
@@ -1237,7 +1240,7 @@
12371240
1238=head1 VERSION1241=head1 VERSION
12391242
1240pt-sift 2.2.111243pt-sift 2.2.12
12411244
1242=cut1245=cut
12431246
12441247
=== modified file 'bin/pt-slave-delay'
--- bin/pt-slave-delay 2014-09-25 13:48:22 +0000
+++ bin/pt-slave-delay 2014-11-14 14:12:25 +0000
@@ -40,7 +40,7 @@
40{40{
41package Percona::Toolkit;41package Percona::Toolkit;
4242
43our $VERSION = '2.2.11';43our $VERSION = '2.2.12';
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.114872pt-slave-delay 2.2.12
48734873
4874=cut4874=cut
48754875
=== modified file 'bin/pt-slave-find'
--- bin/pt-slave-find 2014-09-25 13:48:22 +0000
+++ bin/pt-slave-find 2014-11-14 14:12:25 +0000
@@ -911,6 +911,14 @@
911 $parse = 0;911 $parse = 0;
912 next LINE;912 next LINE;
913 }913 }
914
915 if ( $parse
916 && !$self->has('version-check')
917 && $line =~ /version-check/
918 ) {
919 next LINE;
920 }
921
914 if ( $parse922 if ( $parse
915 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)923 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
916 ) {924 ) {
@@ -4334,6 +4342,6 @@
43344342
4335=head1 VERSION4343=head1 VERSION
43364344
4337pt-slave-find 2.2.114345pt-slave-find 2.2.12
43384346
4339=cut4347=cut
43404348
=== modified file 'bin/pt-slave-restart'
--- bin/pt-slave-restart 2014-09-25 13:48:22 +0000
+++ bin/pt-slave-restart 2014-11-14 14:12:25 +0000
@@ -41,7 +41,7 @@
41{41{
42package Percona::Toolkit;42package Percona::Toolkit;
4343
44our $VERSION = '2.2.11';44our $VERSION = '2.2.12';
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.115940pt-slave-restart 2.2.12
59415941
5942=cut5942=cut
59435943
=== modified file 'bin/pt-stalk'
--- bin/pt-stalk 2014-09-25 13:48:22 +0000
+++ bin/pt-stalk 2014-11-14 14:12:25 +0000
@@ -140,9 +140,10 @@
140140
141usage_or_errors() {141usage_or_errors() {
142 local file="$1"142 local file="$1"
143 local version=""
143144
144 if [ "$OPT_VERSION" ]; then145 if [ "$OPT_VERSION" ]; then
145 local version=$(grep '^pt-[^ ]\+ [0-9]' "$file")146 version=$(grep '^pt-[^ ]\+ [0-9]' "$file")
146 echo "$version"147 echo "$version"
147 return 1148 return 1
148 fi149 fi
@@ -364,6 +365,8 @@
364365
365 [ "$config_opt" = "" ] && continue366 [ "$config_opt" = "" ] && continue
366367
368 echo "$config_opt" | grep -v 'version-check' >/dev/null 2>&1 || continue
369
367 if ! [ "$HAVE_EXT_ARGV" ]; then370 if ! [ "$HAVE_EXT_ARGV" ]; then
368 config_opt="--$config_opt"371 config_opt="--$config_opt"
369 fi372 fi
@@ -779,6 +782,7 @@
779CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"782CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"
780CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"783CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"
781CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"784CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"
785CMD_DMESG="${CMD_DMESG:-"$(_which dmesg)"}"
782786
783[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"787[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"
784788
@@ -862,6 +866,14 @@
862 if [ "$CMD_SYSCTL" ]; then866 if [ "$CMD_SYSCTL" ]; then
863 $CMD_SYSCTL -a >> "$d/$p-sysctl" &867 $CMD_SYSCTL -a >> "$d/$p-sysctl" &
864 fi868 fi
869
870 # collect dmesg events from 60 seconds ago until present
871 if [ "$CMD_DMESG" ]; then
872 local UPTIME=`cat /proc/uptime | awk '{ print $1 }'`
873 local START_TIME=$(echo "$UPTIME 60" | awk '{print ($1 - $2)}')
874 $CMD_DMESG | perl -ne 'm/\[\s*(\d+)\./; if ($1 > '${START_TIME}') { print }' >> "$d/$p-dmesg" &
875 fi
876
865 local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))877 local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
866 if [ "$CMD_VMSTAT" ]; then878 if [ "$CMD_VMSTAT" ]; then
867 $CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &879 $CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &
@@ -876,6 +888,7 @@
876 $CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" &888 $CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" &
877 fi889 fi
878890
891
879 $CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$cnt >>"$d/$p-mysqladmin" &892 $CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$cnt >>"$d/$p-mysqladmin" &
880 local mysqladmin_pid=$!893 local mysqladmin_pid=$!
881894
@@ -2225,7 +2238,7 @@
22252238
2226=head1 VERSION2239=head1 VERSION
22272240
2228pt-stalk 2.2.112241pt-stalk 2.2.12
22292242
2230=cut2243=cut
22312244
22322245
=== modified file 'bin/pt-summary'
--- bin/pt-summary 2014-09-25 13:48:22 +0000
+++ bin/pt-summary 2014-11-14 14:12:25 +0000
@@ -320,6 +320,8 @@
320320
321 [ "$config_opt" = "" ] && continue321 [ "$config_opt" = "" ] && continue
322322
323 echo "$config_opt" | grep -v 'version-check' >/dev/null 2>&1 || continue
324
323 if ! [ "$HAVE_EXT_ARGV" ]; then325 if ! [ "$HAVE_EXT_ARGV" ]; then
324 config_opt="--$config_opt"326 config_opt="--$config_opt"
325 fi327 fi
@@ -2691,7 +2693,7 @@
26912693
2692=head1 VERSION2694=head1 VERSION
26932695
2694pt-summary 2.2.112696pt-summary 2.2.12
26952697
2696=cut2698=cut
26972699
26982700
=== modified file 'bin/pt-table-checksum'
--- bin/pt-table-checksum 2014-09-25 13:48:22 +0000
+++ bin/pt-table-checksum 2014-11-14 14:12:25 +0000
@@ -57,7 +57,7 @@
57{57{
58package Percona::Toolkit;58package Percona::Toolkit;
5959
60our $VERSION = '2.2.11';60our $VERSION = '2.2.12';
6161
62use strict;62use strict;
63use warnings FATAL => 'all';63use warnings FATAL => 'all';
@@ -3533,7 +3533,7 @@
3533 set => $args{set},3533 set => $args{set},
3534 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,3534 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,
3535 dbh_set => 0,3535 dbh_set => 0,
3536 ask_pass => $o->get('ask-pass'),3536 ask_pass => $args{ask_pass},
3537 DSNParser => $dp,3537 DSNParser => $dp,
3538 is_cluster_node => undef,3538 is_cluster_node => undef,
3539 parent => $args{parent},3539 parent => $args{parent},
@@ -3544,7 +3544,7 @@
35443544
3545sub connect {3545sub connect {
3546 my ( $self, %opts ) = @_;3546 my ( $self, %opts ) = @_;
3547 my $dsn = $self->{dsn};3547 my $dsn = $opts{dsn} || $self->{dsn};
3548 my $dp = $self->{DSNParser};3548 my $dp = $self->{DSNParser};
35493549
3550 my $dbh = $self->{dbh};3550 my $dbh = $self->{dbh};
@@ -3563,6 +3563,13 @@
3563 }3563 }
35643564
3565 $dbh = $self->set_dbh($dbh);3565 $dbh = $self->set_dbh($dbh);
3566 if ( $opts{dsn} ) {
3567 $self->{dsn} = $dsn;
3568 $self->{dsn_name} = $dp->as_string($dsn, [qw(h P S)])
3569 || $dp->as_string($dsn, [qw(F)])
3570 || '';
3571
3572 }
3566 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});3573 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});
3567 return $dbh;3574 return $dbh;
3568}3575}
@@ -3624,6 +3631,17 @@
3624 return $self->{hostname} || $self->{dsn_name} || 'unknown host';3631 return $self->{hostname} || $self->{dsn_name} || 'unknown host';
3625}3632}
36263633
3634sub is_cluster_node {
3635 my ($self, $cxn) = @_;
3636
3637 my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
3638 PTDEBUG && _d($cxn->name, $sql);
3639 my $row = $cxn->dbh->selectrow_arrayref($sql);
3640 PTDEBUG && _d(Dumper($row));
3641 return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
3642
3643}
3644
3627sub remove_duplicate_cxns {3645sub remove_duplicate_cxns {
3628 my ($self, %args) = @_;3646 my ($self, %args) = @_;
3629 my @cxns = @{$args{cxns}};3647 my @cxns = @{$args{cxns}};
@@ -3633,7 +3651,8 @@
36333651
3634 for my $cxn ( @cxns ) {3652 for my $cxn ( @cxns ) {
3635 my $dbh = $cxn->dbh();3653 my $dbh = $cxn->dbh();
3636 my $sql = q{SELECT @@server_id};3654
3655 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
3637 PTDEBUG && _d($sql);3656 PTDEBUG && _d($sql);
3638 my ($id) = $dbh->selectrow_array($sql);3657 my ($id) = $dbh->selectrow_array($sql);
3639 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);3658 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
@@ -3788,8 +3807,26 @@
3788sub remove_duplicate_cxns {3807sub remove_duplicate_cxns {
3789 my ($self, %args) = @_;3808 my ($self, %args) = @_;
3790 my @cxns = @{$args{cxns}};3809 my @cxns = @{$args{cxns}};
3791 my $seen_ids = $args{seen_ids};3810 my $seen_ids = $args{seen_ids} || {};
3792 return Cxn->remove_duplicate_cxns(%args);3811 PTDEBUG && _d("Removing duplicates nodes from ", join(" ", map { $_->name } @cxns));
3812 my @trimmed_cxns;
3813
3814 for my $cxn ( @cxns ) {
3815 my $dbh = $cxn->dbh();
3816 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
3817 PTDEBUG && _d($sql);
3818 my ($id) = $dbh->selectrow_array($sql);
3819 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
3820
3821 if ( ! $seen_ids->{$id}++ ) {
3822 push @trimmed_cxns, $cxn
3823 }
3824 else {
3825 PTDEBUG && _d("Removing ", $cxn->name,
3826 ", ID ", $id, ", because we've already seen it");
3827 }
3828 }
3829 return \@trimmed_cxns;
3793}3830}
37943831
3795sub same_cluster {3832sub same_cluster {
@@ -9286,7 +9323,8 @@
9286 my %seen_ids;9323 my %seen_ids;
9287 for my $cxn ($master_cxn, @$slaves) {9324 for my $cxn ($master_cxn, @$slaves) {
9288 my $dbh = $cxn->dbh();9325 my $dbh = $cxn->dbh();
9289 my $sql = q{SELECT @@server_id};9326 # if it's a cluster node we use its incoming address as id ( see https://bugs.launchpad.net/percona-toolkit/+bug/1217466 )
9327 my $sql = $cluster->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
9290 PTDEBUG && _d($cxn, $dbh, $sql);9328 PTDEBUG && _d($cxn, $dbh, $sql);
9291 my ($id) = $dbh->selectrow_array($sql);9329 my ($id) = $dbh->selectrow_array($sql);
9292 $seen_ids{$id}++;9330 $seen_ids{$id}++;
@@ -9363,9 +9401,11 @@
93639401
9364 if ( $cluster_name_for{$master_cxn} ) {9402 if ( $cluster_name_for{$master_cxn} ) {
9365 if ( !@$slaves ) {9403 if ( !@$slaves ) {
9366 die $master_cxn->name() . " is a cluster node but no other nodes "9404 if ( ($o->get('recursion-method')->[0] || '') ne 'none' ) {
9367 . "or regular replicas were found. Use --recursion-method=dsn "9405 die $master_cxn->name() . " is a cluster node but no other nodes "
9368 . "to specify the other nodes in the cluster.\n";9406 . "or regular replicas were found. Use --recursion-method=dsn "
9407 . "to specify the other nodes in the cluster.\n";
9408 }
9369 }9409 }
93709410
9371 # Make sure the master and all node are in the same cluster.9411 # Make sure the master and all node are in the same cluster.
@@ -12240,9 +12280,13 @@
12240The C<dsn> column contains a replica DSN like it would be given on the command12280The C<dsn> column contains a replica DSN like it would be given on the command
12241line, for example: C<"h=replica_host,u=repl_user,p=repl_pass">.12281line, for example: C<"h=replica_host,u=repl_user,p=repl_pass">.
1224212282
12243The C<none> method prevents the tool from connecting to any replicas.12283The C<none> method makes the tool ignore all slaves and cluster nodes. This
12244This effectively disables all the L<"REPLICA CHECKS"> because there will12284method is not recommended because it effectively disables the
12245not be any replicas to check. Therefore, this method is not recommended.12285L<"REPLICA CHECKS"> and no differences can be found. It is useful, however, if
12286you only need to write checksums on the master or a single cluster node. The
12287safer alternative is C<--no-replicate-check>: the tool finds replicas and
12288cluster nodes, performs the L<"REPLICA CHECKS">, but does not check for
12289differences. See L<"--[no]replicate-check">.
1224612290
12247=item --replicate12291=item --replicate
1224812292
@@ -12698,6 +12742,6 @@
1269812742
12699=head1 VERSION12743=head1 VERSION
1270012744
12701pt-table-checksum 2.2.1112745pt-table-checksum 2.2.12
1270212746
12703=cut12747=cut
1270412748
=== modified file 'bin/pt-table-sync'
--- bin/pt-table-sync 2014-09-25 13:48:22 +0000
+++ bin/pt-table-sync 2014-11-14 14:12:25 +0000
@@ -55,7 +55,7 @@
55{55{
56package Percona::Toolkit;56package Percona::Toolkit;
5757
58our $VERSION = '2.2.11';58our $VERSION = '2.2.12';
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.1112771pt-table-sync 2.2.12
1277212772
12773=cut12773=cut
1277412774
=== modified file 'bin/pt-table-usage'
--- bin/pt-table-usage 2014-09-25 13:48:22 +0000
+++ bin/pt-table-usage 2014-11-14 14:12:25 +0000
@@ -1340,6 +1340,14 @@
1340 $parse = 0;1340 $parse = 0;
1341 next LINE;1341 next LINE;
1342 }1342 }
1343
1344 if ( $parse
1345 && !$self->has('version-check')
1346 && $line =~ /version-check/
1347 ) {
1348 next LINE;
1349 }
1350
1343 if ( $parse1351 if ( $parse
1344 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)1352 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
1345 ) {1353 ) {
@@ -7563,6 +7571,6 @@
75637571
7564=head1 VERSION7572=head1 VERSION
75657573
7566pt-table-usage 2.2.117574pt-table-usage 2.2.12
75677575
7568=cut7576=cut
75697577
=== modified file 'bin/pt-upgrade'
--- bin/pt-upgrade 2014-09-25 13:48:22 +0000
+++ bin/pt-upgrade 2014-11-14 14:12:25 +0000
@@ -61,7 +61,7 @@
61{61{
62package Percona::Toolkit;62package Percona::Toolkit;
6363
64our $VERSION = '2.2.11';64our $VERSION = '2.2.12';
6565
66use strict;66use strict;
67use warnings FATAL => 'all';67use warnings FATAL => 'all';
@@ -2464,7 +2464,7 @@
2464 set => $args{set},2464 set => $args{set},
2465 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,2465 NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,
2466 dbh_set => 0,2466 dbh_set => 0,
2467 ask_pass => $o->get('ask-pass'),2467 ask_pass => $args{ask_pass},
2468 DSNParser => $dp,2468 DSNParser => $dp,
2469 is_cluster_node => undef,2469 is_cluster_node => undef,
2470 parent => $args{parent},2470 parent => $args{parent},
@@ -2475,7 +2475,7 @@
24752475
2476sub connect {2476sub connect {
2477 my ( $self, %opts ) = @_;2477 my ( $self, %opts ) = @_;
2478 my $dsn = $self->{dsn};2478 my $dsn = $opts{dsn} || $self->{dsn};
2479 my $dp = $self->{DSNParser};2479 my $dp = $self->{DSNParser};
24802480
2481 my $dbh = $self->{dbh};2481 my $dbh = $self->{dbh};
@@ -2494,6 +2494,13 @@
2494 }2494 }
24952495
2496 $dbh = $self->set_dbh($dbh);2496 $dbh = $self->set_dbh($dbh);
2497 if ( $opts{dsn} ) {
2498 $self->{dsn} = $dsn;
2499 $self->{dsn_name} = $dp->as_string($dsn, [qw(h P S)])
2500 || $dp->as_string($dsn, [qw(F)])
2501 || '';
2502
2503 }
2497 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});2504 PTDEBUG && _d($dbh, 'Connected dbh to', $self->{hostname},$self->{dsn_name});
2498 return $dbh;2505 return $dbh;
2499}2506}
@@ -2555,6 +2562,17 @@
2555 return $self->{hostname} || $self->{dsn_name} || 'unknown host';2562 return $self->{hostname} || $self->{dsn_name} || 'unknown host';
2556}2563}
25572564
2565sub is_cluster_node {
2566 my ($self, $cxn) = @_;
2567
2568 my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
2569 PTDEBUG && _d($cxn->name, $sql);
2570 my $row = $cxn->dbh->selectrow_arrayref($sql);
2571 PTDEBUG && _d(Dumper($row));
2572 return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
2573
2574}
2575
2558sub remove_duplicate_cxns {2576sub remove_duplicate_cxns {
2559 my ($self, %args) = @_;2577 my ($self, %args) = @_;
2560 my @cxns = @{$args{cxns}};2578 my @cxns = @{$args{cxns}};
@@ -2564,7 +2582,8 @@
25642582
2565 for my $cxn ( @cxns ) {2583 for my $cxn ( @cxns ) {
2566 my $dbh = $cxn->dbh();2584 my $dbh = $cxn->dbh();
2567 my $sql = q{SELECT @@server_id};2585
2586 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
2568 PTDEBUG && _d($sql);2587 PTDEBUG && _d($sql);
2569 my ($id) = $dbh->selectrow_array($sql);2588 my ($id) = $dbh->selectrow_array($sql);
2570 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);2589 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
@@ -11240,6 +11259,6 @@
1124011259
11241=head1 VERSION11260=head1 VERSION
1124211261
11243pt-upgrade 2.2.1111262pt-upgrade 2.2.12
1124411263
11245=cut11264=cut
1124611265
=== modified file 'bin/pt-variable-advisor'
--- bin/pt-variable-advisor 2014-09-25 13:48:22 +0000
+++ bin/pt-variable-advisor 2014-11-14 14:12:25 +0000
@@ -44,7 +44,7 @@
44{44{
45package Percona::Toolkit;45package Percona::Toolkit;
4646
47our $VERSION = '2.2.11';47our $VERSION = '2.2.12';
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.116141pt-variable-advisor 2.2.12
61426142
6143=cut6143=cut
61446144
=== modified file 'bin/pt-visual-explain'
--- bin/pt-visual-explain 2014-09-25 13:48:22 +0000
+++ bin/pt-visual-explain 2014-11-14 14:12:25 +0000
@@ -1577,6 +1577,14 @@
1577 $parse = 0;1577 $parse = 0;
1578 next LINE;1578 next LINE;
1579 }1579 }
1580
1581 if ( $parse
1582 && !$self->has('version-check')
1583 && $line =~ /version-check/
1584 ) {
1585 next LINE;
1586 }
1587
1580 if ( $parse1588 if ( $parse
1581 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)1589 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
1582 ) {1590 ) {
@@ -3243,6 +3251,6 @@
32433251
3244=head1 VERSION3252=head1 VERSION
32453253
3246pt-visual-explain 2.2.113254pt-visual-explain 2.2.12
32473255
3248=cut3256=cut
32493257
=== modified file 'config/deb/changelog'
--- config/deb/changelog 2014-09-25 13:48:22 +0000
+++ config/deb/changelog 2014-11-14 14:12:25 +0000
@@ -1,3 +1,16 @@
1percona-toolkit (2.2.12) unstable; urgency=low
2
3 * Fixed bug 1376561: pt-archiver is not able to archive all the rows when a table has a hash partition
4 * Fixed bug 1328686: pt-heartbeat check-read-only option does not prevent creates or inserts
5 * Fixed bug 1269695: pt-online-schema-change does not allow ALTER for a table without a non-unique, while manual does not explain this
6 * Fixed bug 1217466: pt-table-checksum refuses to run on PXC if server_id is the same on all nodes
7 * Fixed bug 1373937: pt-table-checksum requires recursion when working with and XtraDB Cluster node
8 * Fixed bug 1377888: pt-query-digest manual for --type binlog is ambiguous
9 * Fixed bug 1349086: pt-stalk should also gather dmesg output
10 * Fixed bug 1361293: Some scripts fail when no-version-check option is put in global config file
11
12 -- Percona Toolkit Developers <toolkit-dev@percona.com> Tue, 11 Nov 2014 13:02:51 +0000
13
1percona-toolkit (2.2.11) unstable; urgency=low14percona-toolkit (2.2.11) unstable; urgency=low
215
3 * Fixed bug 1262456: pt-query-digest doesn't report host details16 * Fixed bug 1262456: pt-query-digest doesn't report host details
417
=== modified file 'config/sphinx-build/conf.py'
--- config/sphinx-build/conf.py 2014-09-25 13:48:22 +0000
+++ config/sphinx-build/conf.py 2014-11-14 14:12:25 +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.11'53release = '2.2.12'
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-09-25 13:48:22 +0000
+++ docs/percona-toolkit.pod 2014-11-14 14:12:25 +0000
@@ -557,6 +557,6 @@
557557
558=head1 VERSION558=head1 VERSION
559559
560Percona Toolkit v2.2.11 released 2014-09-25560Percona Toolkit v2.2.12 released 2014-11-11
561561
562=cut562=cut
563563
=== modified file 'docs/release_notes.rst'
--- docs/release_notes.rst 2014-09-25 13:48:22 +0000
+++ docs/release_notes.rst 2014-11-14 14:12:25 +0000
@@ -1,6 +1,41 @@
1Release Notes1Release Notes
2*************2*************
33
4v2.2.12 released 2014-11-14
5===========================
6
7Percona Toolkit 2.2.12 has been released. This release contains one new feature and seven bug fixes.
8
9New Features:
10
11* pt-stalk now gathers ``dmesg`` output from up to 60 seconds before the triggering event.
12
13Bugs Fixed:
14
15* Fixed bug 1376561: pt-archiver was not able to archive all the rows when a table had a hash partition. Fixed by implementing support for tables which have primary or unique indexes.
16
17* Fixed bug 1217466: pt-table-checksum would refuses to run on Percona XtraDB Cluster if ``server_id`` was the same on all nodes. Fixed by using the ``wsrep_node_incoming_address`` as a unique identifier for cluster nodes, instead of relying on ``server_id``.
18
19* Fixed bug 1269695: pt-online-schema-change documentation now contains more information about limitations on why it isn't running ``ALTER TABLE`` for a table which has only a non-unique index.
20
21* Fixed bug 1328686: Running pt-hearbeat with --check-read-only option would cause an error when running on server with ``read_only`` option. Tool now waits for server ``read_only`` status to be disabled before starting to run.
22
23* Fixed bug 1373937: pt-table-checksum now supports ``none`` as valid ``--recursion-method`` when using with Percona XtraDB Cluster.
24
25* Fixed bug 1377888: Documentation was stating that pt-query-digest is able to parse a raw binary log file, while it can only parse a file which was decoded with ``mysqlbinlog`` tool before. Fixed by improving the documentation and adding a check for binary file and providing a relevant error message.
26
27Changelog
28---------
29
30* Fixed bug 1376561: pt-archiver is not able to archive all the rows when a table has a hash partition
31* Fixed bug 1328686: pt-heartbeat check-read-only option does not prevent creates or inserts
32* Fixed bug 1269695: pt-online-schema-change does not allow ALTER for a table without a non-unique, while manual does not explain this
33* Fixed bug 1217466: pt-table-checksum refuses to run on PXC if server_id is the same on all nodes
34* Fixed bug 1373937: pt-table-checksum requires recursion when working with and XtraDB Cluster node
35* Fixed bug 1377888: pt-query-digest manual for --type binlog is ambiguous
36* Fixed bug 1349086: pt-stalk should also gather dmesg output
37* Fixed bug 1361293: Some scripts fail when no-version-check option is put in global config file
38
4v2.2.11 released 2014-09-2639v2.2.11 released 2014-09-26
5===========================40===========================
641
742
=== modified file 'lib/Cxn.pm'
--- lib/Cxn.pm 2013-12-05 00:14:17 +0000
+++ lib/Cxn.pm 2014-11-14 14:12:25 +0000
@@ -226,6 +226,19 @@
226 return $self->{hostname} || $self->{dsn_name} || 'unknown host';226 return $self->{hostname} || $self->{dsn_name} || 'unknown host';
227}227}
228228
229# This is used to help remove_duplicate_cxns detect cluster nodes
230# (which often have unreliable server_id's)
231sub is_cluster_node {
232 my ($self, $cxn) = @_;
233
234 my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
235 PTDEBUG && _d($cxn->name, $sql);
236 my $row = $cxn->dbh->selectrow_arrayref($sql);
237 PTDEBUG && _d(Dumper($row));
238 return $row && $row->[1] && ($row->[1] eq 'ON' || $row->[1] eq '1') ? 1 : 0;
239
240}
241
229# There's two reasons why there might be dupes:242# There's two reasons why there might be dupes:
230# If the "master" is a cluster node, then a DSN table might have been243# If the "master" is a cluster node, then a DSN table might have been
231# used, and it may have all nodes' DSNs so the user can run the tool244# used, and it may have all nodes' DSNs so the user can run the tool
@@ -233,7 +246,7 @@
233# on the command line.246# on the command line.
234# On the other hand, maybe find_cluster_nodes worked, in which case247# On the other hand, maybe find_cluster_nodes worked, in which case
235# we definitely have a dupe for the master cxn, but we may also have a248# we definitely have a dupe for the master cxn, but we may also have a
236# dupe for every other node if this was unsed in conjunction with a249# dupe for every other node if this was used in conjunction with a
237# DSN table.250# DSN table.
238# So try to detect and remove those.251# So try to detect and remove those.
239sub remove_duplicate_cxns {252sub remove_duplicate_cxns {
@@ -245,7 +258,11 @@
245258
246 for my $cxn ( @cxns ) {259 for my $cxn ( @cxns ) {
247 my $dbh = $cxn->dbh();260 my $dbh = $cxn->dbh();
248 my $sql = q{SELECT @@server_id};261
262 # Very often cluster nodes are configured with matching server_id's
263 # So in that case we'll use its incoming address as its unique identifier
264 # Note: this relies on "seen_ids" being populated using the same strategy
265 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
249 PTDEBUG && _d($sql);266 PTDEBUG && _d($sql);
250 my ($id) = $dbh->selectrow_array($sql);267 my ($id) = $dbh->selectrow_array($sql);
251 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);268 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
252269
=== modified file 'lib/OptionParser.pm'
--- lib/OptionParser.pm 2014-05-24 21:36:33 +0000
+++ lib/OptionParser.pm 2014-11-14 14:12:25 +0000
@@ -1132,6 +1132,16 @@
1132 $parse = 0;1132 $parse = 0;
1133 next LINE;1133 next LINE;
1134 }1134 }
1135
1136 # Silently ignore option [no]-version-check if it is unsupported and it comes from a config file
1137 # TODO: Ideally , this should be generalized for all unsupported options that come from global files
1138 if ( $parse
1139 && !$self->has('version-check')
1140 && $line =~ /version-check/
1141 ) {
1142 next LINE;
1143 }
1144
1135 if ( $parse1145 if ( $parse
1136 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)1146 && (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
1137 ) {1147 ) {
11381148
=== modified file 'lib/Percona/Toolkit.pm'
--- lib/Percona/Toolkit.pm 2014-09-24 15:06:32 +0000
+++ lib/Percona/Toolkit.pm 2014-11-14 14:12:25 +0000
@@ -18,7 +18,7 @@
18# ###########################################################################18# ###########################################################################
19package Percona::Toolkit;19package Percona::Toolkit;
2020
21our $VERSION = '2.2.11';21our $VERSION = '2.2.12';
2222
23use strict;23use strict;
24use warnings FATAL => 'all';24use warnings FATAL => 'all';
2525
=== modified file 'lib/Percona/XtraDB/Cluster.pm'
--- lib/Percona/XtraDB/Cluster.pm 2013-04-16 20:40:32 +0000
+++ lib/Percona/XtraDB/Cluster.pm 2014-11-14 14:12:25 +0000
@@ -132,8 +132,29 @@
132sub remove_duplicate_cxns {132sub remove_duplicate_cxns {
133 my ($self, %args) = @_;133 my ($self, %args) = @_;
134 my @cxns = @{$args{cxns}};134 my @cxns = @{$args{cxns}};
135 my $seen_ids = $args{seen_ids};135 my $seen_ids = $args{seen_ids} || {};
136 return Cxn->remove_duplicate_cxns(%args);136 PTDEBUG && _d("Removing duplicates nodes from ", join(" ", map { $_->name } @cxns));
137 my @trimmed_cxns;
138
139 for my $cxn ( @cxns ) {
140 my $dbh = $cxn->dbh();
141 # Very often cluster nodes are configured with matching server_id's
142 # So in that case we'll use its incoming address as its unique identifier
143 # Note: This relies on "seen_ids" being populated using the same strategy
144 my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
145 PTDEBUG && _d($sql);
146 my ($id) = $dbh->selectrow_array($sql);
147 PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
148
149 if ( ! $seen_ids->{$id}++ ) {
150 push @trimmed_cxns, $cxn
151 }
152 else {
153 PTDEBUG && _d("Removing ", $cxn->name,
154 ", ID ", $id, ", because we've already seen it");
155 }
156 }
157 return \@trimmed_cxns;
137}158}
138159
139sub same_cluster {160sub same_cluster {
140161
=== modified file 'lib/bash/collect.sh'
--- lib/bash/collect.sh 2013-12-14 04:19:51 +0000
+++ lib/bash/collect.sh 2014-11-14 14:12:25 +0000
@@ -40,6 +40,7 @@
40CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"40CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"
41CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"41CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"
42CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"42CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"
43CMD_DMESG="${CMD_DMESG:-"$(_which dmesg)"}"
4344
44# Try to find command manually.45# Try to find command manually.
45[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"46[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"
@@ -146,6 +147,14 @@
146 if [ "$CMD_SYSCTL" ]; then147 if [ "$CMD_SYSCTL" ]; then
147 $CMD_SYSCTL -a >> "$d/$p-sysctl" &148 $CMD_SYSCTL -a >> "$d/$p-sysctl" &
148 fi149 fi
150
151 # collect dmesg events from 60 seconds ago until present
152 if [ "$CMD_DMESG" ]; then
153 local UPTIME=`cat /proc/uptime | awk '{ print $1 }'`
154 local START_TIME=$(echo "$UPTIME 60" | awk '{print ($1 - $2)}')
155 $CMD_DMESG | perl -ne 'm/\[\s*(\d+)\./; if ($1 > '${START_TIME}') { print }' >> "$d/$p-dmesg" &
156 fi
157
149 local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))158 local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
150 if [ "$CMD_VMSTAT" ]; then159 if [ "$CMD_VMSTAT" ]; then
151 $CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &160 $CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &
152161
=== modified file 'lib/bash/parse_options.sh'
--- lib/bash/parse_options.sh 2014-07-10 20:15:13 +0000
+++ lib/bash/parse_options.sh 2014-11-14 14:12:25 +0000
@@ -347,6 +347,9 @@
347 # Skip blank lines.347 # Skip blank lines.
348 [ "$config_opt" = "" ] && continue348 [ "$config_opt" = "" ] && continue
349349
350 # Skip global option [no]version-check which don't apply
351 echo "$config_opt" | grep -v 'version-check' >/dev/null 2>&1 || continue
352
350 # Options in a config file are not prefixed with --,353 # Options in a config file are not prefixed with --,
351 # but command line options are, so one or the other has354 # but command line options are, so one or the other has
352 # to add or remove the -- prefix. We add it for config355 # to add or remove the -- prefix. We add it for config
353356
=== modified file 't/lib/OptionParser.t'
--- t/lib/OptionParser.t 2014-05-24 21:36:33 +0000
+++ t/lib/OptionParser.t 2014-11-14 14:12:25 +0000
@@ -2141,6 +2141,29 @@
2141 'prompt_no_echo outputs prompt to STDERR'2141 'prompt_no_echo outputs prompt to STDERR'
2142);2142);
21432143
2144# #############################################################################
2145# Issue 1361293: Global config file with no-version-check option makes tools
2146# that don't recognize the option fail.
2147# #############################################################################
2148diag(`echo "no-version-check" > ~/.OptionParser.t.conf`);
2149$o = new OptionParser(
2150 description => 'OptionParser.t parses command line options.',
2151 usage => "$PROGRAM_NAME <options>"
2152);
2153$o->get_specs("$trunk/bin/pt-slave-find"), # doesn't have version-check option
2154$output = output(
2155 sub {
2156 $o->get_opts();
2157 },
2158 stderr=>1
2159 );
2160unlike(
2161 $output,
2162 qr/Unknown option: no-version-check/,
2163 'no-version-check ignored if unsupported and in config file. issue 1361293'
2164);
2165diag(`rm -rf ~/.OptionParser.t.conf`);
2166
21442167
21452168
2146# #############################################################################2169# #############################################################################
21472170
=== added file 't/lib/samples/binlogs/raw_binlog.log'
2148Binary files t/lib/samples/binlogs/raw_binlog.log 1970-01-01 00:00:00 +0000 and t/lib/samples/binlogs/raw_binlog.log 2014-11-14 14:12:25 +0000 differ2171Binary files t/lib/samples/binlogs/raw_binlog.log 1970-01-01 00:00:00 +0000 and t/lib/samples/binlogs/raw_binlog.log 2014-11-14 14:12:25 +0000 differ
=== modified file 't/pt-archiver/basics.t'
--- t/pt-archiver/basics.t 2012-11-21 16:21:30 +0000
+++ t/pt-archiver/basics.t 2014-11-14 14:12:25 +0000
@@ -161,7 +161,7 @@
161my $t = time - $t0;161my $t = time - $t0;
162162
163ok(163ok(
164 $t >= 2 && $t <= 3.5,164 $t >= 2 && $t <= ($ENV{PERCONA_SLOW_BOX} ? 5 : 3),
165 "--sleep between SELECT (bug 979092)"165 "--sleep between SELECT (bug 979092)"
166) or diag($output, "t=", $t);166) or diag($output, "t=", $t);
167167
168168
=== modified file 't/pt-archiver/indexes.t'
--- t/pt-archiver/indexes.t 2012-06-03 17:54:32 +0000
+++ t/pt-archiver/indexes.t 2014-11-14 14:12:25 +0000
@@ -97,7 +97,7 @@
9797
98# Check ascending only first column98# Check ascending only first column
99$output = `$cmd --where 1=1 --dry-run --ascend-first --source D=test,t=table_5,F=$cnf --purge --limit 50 2>&1`;99$output = `$cmd --where 1=1 --dry-run --ascend-first --source D=test,t=table_5,F=$cnf --purge --limit 50 2>&1`;
100like ( $output, qr/WHERE \(1=1\) AND \(\(`a` >= \?\)\) LIMIT/, 'Can ascend just first column');100like ( $output, qr/WHERE \(1=1\) AND \(\(`a` >= \?\)\) ORDER BY `a`,`b`,`c`,`d` LIMIT/, 'Can ascend just first column');
101101
102# #############################################################################102# #############################################################################
103# Done.103# Done.
104104
=== modified file 't/pt-archiver/samples/issue-248.txt'
--- t/pt-archiver/samples/issue-248.txt 2011-06-24 22:02:05 +0000
+++ t/pt-archiver/samples/issue-248.txt 2014-11-14 14:12:25 +0000
@@ -1,3 +1,3 @@
1SELECT /*!40001 SQL_NO_CACHE */ `film_id`,`title`,`description`,`release_year`,`language_id`,`original_language_id`,`rental_duration`,`rental_rate`,`length`,`replacement_cost`,`rating`,`special_features`,`last_update` FROM `sakila`.`film` FORCE INDEX(`PRIMARY`) WHERE (film_id < 100) AND (`film_id` < '1000') LIMIT 11SELECT /*!40001 SQL_NO_CACHE */ `film_id`,`title`,`description`,`release_year`,`language_id`,`original_language_id`,`rental_duration`,`rental_rate`,`length`,`replacement_cost`,`rating`,`special_features`,`last_update` FROM `sakila`.`film` FORCE INDEX(`PRIMARY`) WHERE (film_id < 100) AND (`film_id` < '1000') ORDER BY `film_id` LIMIT 1
2SELECT /*!40001 SQL_NO_CACHE */ `film_id`,`title`,`description`,`release_year`,`language_id`,`original_language_id`,`rental_duration`,`rental_rate`,`length`,`replacement_cost`,`rating`,`special_features`,`last_update` FROM `sakila`.`film` FORCE INDEX(`PRIMARY`) WHERE (film_id < 100) AND (`film_id` < '1000') AND ((`film_id` >= ?)) LIMIT 12SELECT /*!40001 SQL_NO_CACHE */ `film_id`,`title`,`description`,`release_year`,`language_id`,`original_language_id`,`rental_duration`,`rental_rate`,`length`,`replacement_cost`,`rating`,`special_features`,`last_update` FROM `sakila`.`film` FORCE INDEX(`PRIMARY`) WHERE (film_id < 100) AND (`film_id` < '1000') AND ((`film_id` >= ?)) ORDER BY `film_id` LIMIT 1
3DELETE FROM `sakila`.`film` WHERE (`film_id` = ?)3DELETE FROM `sakila`.`film` WHERE (`film_id` = ?)
44
=== modified file 't/pt-query-digest/binlog_analyses.t'
--- t/pt-query-digest/binlog_analyses.t 2014-07-02 20:55:31 +0000
+++ t/pt-query-digest/binlog_analyses.t 2014-11-14 14:12:25 +0000
@@ -9,7 +9,7 @@
9use strict;9use strict;
10use warnings FATAL => 'all';10use warnings FATAL => 'all';
11use English qw(-no_match_vars);11use English qw(-no_match_vars);
12use Test::More tests => 3;12use Test::More tests => 4;
1313
14use PerconaTest;14use PerconaTest;
15require "$trunk/bin/pt-query-digest";15require "$trunk/bin/pt-query-digest";
@@ -46,6 +46,26 @@
46 'Analysis for binlog011 - Handles 5.6 binlog with checksum CRC32',46 'Analysis for binlog011 - Handles 5.6 binlog with checksum CRC32',
47) or diag($test_diff);47) or diag($test_diff);
4848
49
50
51# #############################################################################
52# Issue 1377888: refuse to parse raw binary log
53# #############################################################################
54
55my $output = output(
56 sub { pt_query_digest::main(@args, "$trunk/t/lib/samples/binlogs/raw_binlog.log") },
57 stderr => 1
58);
59
60like(
61 $output,
62 qr/mysqlbinlog/i,
63 'Refuses to parse raw binlog file'
64);
65
66
67
68
49# #############################################################################69# #############################################################################
50# Done.70# Done.
51# #############################################################################71# #############################################################################
5272
=== modified file 't/pt-table-checksum/pxc.t'
--- t/pt-table-checksum/pxc.t 2013-04-12 15:58:10 +0000
+++ t/pt-table-checksum/pxc.t 2014-11-14 14:12:25 +0000
@@ -81,6 +81,17 @@
81 "Dies if no other nodes are found"81 "Dies if no other nodes are found"
82);82);
8383
84
85($output, $exit_status) = full_output(
86 sub { pt_table_checksum::main(@args, '--recursion-method', 'none') },
87 stderr => 1,
88);
89
90ok (
91 $output =~ qr/WARNING/i && !$exit_status,
92 "Warns but doesn't die if --recursion-method=none - issue #1373937"
93);
94
84for my $args (95for my $args (
85 ["using recusion-method=dsn", '--recursion-method', "dsn=$node1_dsn,D=dsns,t=dsns"],96 ["using recusion-method=dsn", '--recursion-method', "dsn=$node1_dsn,D=dsns,t=dsns"],
86 ["using recursion-method=cluster", '--recursion-method', 'cluster']97 ["using recursion-method=cluster", '--recursion-method', 'cluster']
@@ -144,54 +155,89 @@
144 "Node3 not changed"155 "Node3 not changed"
145);156);
146157
147for my $args (158sub test_recursion_methods {
148 ["using recusion-method=dsn", '--recursion-method', "dsn=$node1_dsn,D=dsns,t=dsns"],159 my $same_ids = shift;
149 ["using recursion-method=cluster", '--recursion-method', 'cluster']160
150 )161 my ($orig_id_1, $orig_id_2, $orig_id_3);
151{162
152 my $test = shift @$args;163 if ($same_ids) {
153164 # save original values
154 $output = output(165 my $sql = 'SELECT @@server_id';
155 sub { pt_table_checksum::main(@args,166 ($orig_id_1) = $node1->selectrow_array($sql);
156 @$args)167 ($orig_id_2) = $node2->selectrow_array($sql);
157 },168 ($orig_id_3) = $node3->selectrow_array($sql);
158 stderr => 1,169 # set server_id value to 1 on all nodes
159 );170 $sql = 'SET GLOBAL server_id = 1';
160171 $node1->do($sql);
161 is(172 $node2->do($sql);
162 PerconaTest::count_checksum_results($output, 'errors'),173 $node3->do($sql);
163 0,174 }
164 "1 diff: no errors ($test)"175
165 );176 for my $args (
166177 ["using recusion-method=dsn", '--recursion-method', "dsn=$node1_dsn,D=dsns,t=dsns"],
167 is(178 ["using recursion-method=cluster", '--recursion-method', 'cluster']
168 PerconaTest::count_checksum_results($output, 'skipped'),179 )
169 0,180 {
170 "1 diff: no skips ($test)"181 my $test = shift @$args;
171 );182 $test = $same_ids ? $test.' - Nodes with different ids' : $test.' - Nodes with same ids';
172183
173 is(184 $output = output(
174 PerconaTest::count_checksum_results($output, 'diffs'),185 sub { pt_table_checksum::main(@args,
175 1,186 @$args)
176 "1 diff: 1 diff ($test)"187 },
177 ) or diag($output);188 stderr => 1,
178189 );
179 # 11-17T13:02:54 0 1 26 1 0 0.021 test.t190
180 like(191 is(
181 $output,192 PerconaTest::count_checksum_results($output, 'errors'),
182 qr/^\S+\s+ # ts193 0,
183 0\s+ # errors194 "1 diff: no errors ($test)"
184 1\s+ # diffs195 );
185 26\s+ # rows196
186 \d+\s+ # chunks197 is(
187 0\s+ # skipped198 PerconaTest::count_checksum_results($output, 'skipped'),
188 \S+\s+ # time199 0,
189 test.t$ # table200 "1 diff: no skips ($test)"
190 /xm,201 );
191 "1 diff: it's in test.t ($test)"202
192 );203 is(
204 PerconaTest::count_checksum_results($output, 'diffs'),
205 1,
206 "1 diff: 1 diff ($test)"
207 ) or diag($output);
208
209 # 11-17T13:02:54 0 1 26 1 0 0.021 test.t
210 like(
211 $output,
212 qr/^\S+\s+ # ts
213 0\s+ # errors
214 1\s+ # diffs
215 26\s+ # rows
216 \d+\s+ # chunks
217 0\s+ # skipped
218 \S+\s+ # time
219 test.t$ # table
220 /xm,
221 "1 diff: it's in test.t ($test)"
222 );
223 }
224
225 if ($same_ids) {
226 # reset server_id's to original values
227 $node1->do("SET GLOBAL server_id = $orig_id_1");
228 $node2->do("SET GLOBAL server_id = $orig_id_2");
229 $node3->do("SET GLOBAL server_id = $orig_id_3");
230 }
231
193}232}
194233
234# test recursion methods
235test_recursion_methods(0);
236
237# test recursion methods when all nodes have the same id
238test_recursion_methods(1);
239
240
195# #############################################################################241# #############################################################################
196# cluster, node1 -> slave, run on node1242# cluster, node1 -> slave, run on node1
197# #############################################################################243# #############################################################################
@@ -232,7 +278,7 @@
232 # Wait for the slave to apply the binlogs from node1 (its master).278 # Wait for the slave to apply the binlogs from node1 (its master).
233 # Then change it so it's not consistent.279 # Then change it so it's not consistent.
234 PerconaTest::wait_for_table($slave_dbh, 'test.t');280 PerconaTest::wait_for_table($slave_dbh, 'test.t');
235 $sb->wait_for_slaves('cslave1');281 $sb->wait_for_slaves(master => 'node1', slave => 'cslave1');
236 $slave_dbh->do("update test.t set c='zebra' where c='z'");282 $slave_dbh->do("update test.t set c='zebra' where c='z'");
237283
238 $output = output(284 $output = output(

Subscribers

People subscribed via source and target branches