Merge branch '3.0' into PT-209

This commit is contained in:
Carlos Salguero
2017-11-27 13:39:23 -03:00
51 changed files with 670 additions and 168 deletions

View File

@@ -1,7 +1,28 @@
Changelog for Percona Toolkit
v3.0.6
* Fixed bug PT-186: pt-online-schema-change --alter fails if fields are using mixed case
* Fixed bug PT-225: pt-table-checksum ignores generated cols
v3.0.5 released 2017-11-20
* Improvement PMM-1590: Improve MongoDB Profiler for PMM and PT
* Improvement PT-216: mongodb-query digest improved support for v<3.2 fixed incorrect output (Thanks MATSUU Takuto)
* Fixed bug PT-211: pt-mext fails on Rsa_public_key line
* Fixed bug PT-212: pt-mongodb-query-digest shows NaNs
* Fixed bug PT-202: pt-online-schema-change fails with virtual columns
* Fixed bug PT-200: Index with keyword 'unique' as prefix/suffix considered as unique
* Fixed bug PT-199: pt-table-checksum does not make the session statement based when using row based replication
* Fixed bug PT-196: pt-onine-schema-change is pausing because {some_status_variable}=0
* Fixed bug PT-193: pt-table-checksum reports misleading error if comment has apostroph
* Fixed bug PT-187: pt-table-checksum not able to get differences for columns
* Fixed bug PT-186: pt-online-schema-change --alter fails if fields are using mixed case
* Fixed bug PT-183: pt-mongodb-query-digest cannot connect to a db using authentication
* Feature PT-182: Provide JSON output format for pt-summary, pt-mysql-summary, pt-mongodb-summary
* Fixed bug PT-167: pt-kill kills prepared statements without checking busy-time
* Fixed bug PT-161: Safely check for undefined values in --skip-check-slave-lag
* Feature PT-152: Add Show Slave Hosts to pt-mysql-summary
* Feature PT-139: Add support for replication channels (MySQL 5.7+) to pt-table-sync
v3.0.4 released 2017-08-02

View File

@@ -2,12 +2,13 @@ Changelog
CONTRIBUTE.md
CONTRIBUTING.md
COPYING
docker-compose.yml
glide.lock
glide.yaml
INSTALL
Makefile.PL
MANIFEST
README
README.md
bin/pt-align
bin/pt-archiver
bin/pt-config-diff

View File

@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'percona-toolkit',
VERSION => '3.0.4',
VERSION => '3.0.5',
EXE_FILES => [ <bin/*> ],
MAN1PODS => {
'docs/percona-toolkit.pod' => 'blib/man1/percona-toolkit.1p',

View File

@@ -1359,6 +1359,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-align 3.0.4
pt-align 3.0.5
=cut

View File

@@ -45,7 +45,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -3613,8 +3613,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -3876,6 +3875,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -3887,8 +3887,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -3898,7 +3897,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -3949,6 +3952,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -4017,6 +4031,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -8509,6 +8526,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-archiver 3.0.4
pt-archiver 3.0.5
=cut

View File

@@ -43,7 +43,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -5843,6 +5843,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-config-diff 3.0.4
pt-config-diff 3.0.5
=cut

View File

@@ -42,7 +42,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -5633,6 +5633,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-deadlock-logger 3.0.4
pt-deadlock-logger 3.0.5
=cut

View File

@@ -38,7 +38,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -5627,6 +5627,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-diskstats 3.0.4
pt-diskstats 3.0.5
=cut

View File

@@ -39,7 +39,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -5696,6 +5696,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-duplicate-key-checker 3.0.4
pt-duplicate-key-checker 3.0.5
=cut

View File

@@ -1648,6 +1648,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-fifo-split 3.0.4
pt-fifo-split 3.0.5
=cut

View File

@@ -35,7 +35,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -5055,6 +5055,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-find 3.0.4
pt-find 3.0.5
=cut

View File

@@ -2239,6 +2239,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-fingerprint 3.0.4
pt-fingerprint 3.0.5
=cut

View File

@@ -37,7 +37,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -4619,6 +4619,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-fk-error-logger 3.0.4
pt-fk-error-logger 3.0.5
=cut

View File

@@ -44,7 +44,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -188,8 +188,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -451,6 +450,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -462,8 +462,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -473,7 +472,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -524,6 +527,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -592,6 +606,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -7243,6 +7260,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-heartbeat 3.0.4
pt-heartbeat 3.0.5
=cut

View File

@@ -45,7 +45,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -7626,6 +7626,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-index-usage 3.0.4
pt-index-usage 3.0.5
=cut

View File

@@ -1127,7 +1127,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-ioprofile 3.0.4
pt-ioprofile 3.0.5
=cut

View File

@@ -3894,8 +3894,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -4157,6 +4156,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -4168,8 +4168,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -4179,7 +4178,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -4230,6 +4233,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -4298,6 +4312,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -8437,6 +8454,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-kill 3.0.4
pt-kill 3.0.5
=cut

View File

@@ -3159,7 +3159,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-mysql-summary 3.0.4
pt-mysql-summary 3.0.5
=cut

View File

@@ -4216,8 +4216,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -4479,6 +4478,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -4490,8 +4490,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -4501,7 +4500,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -4552,6 +4555,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -4620,6 +4634,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -12955,6 +12972,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-online-schema-change 3.0.4
pt-online-schema-change 3.0.5
=cut

View File

@@ -897,7 +897,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-pmp 3.0.4
pt-pmp 3.0.5
=cut

View File

@@ -64,7 +64,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -10512,8 +10512,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -10775,6 +10774,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -10786,8 +10786,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -10797,7 +10796,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -10848,6 +10851,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -10916,6 +10930,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -16802,6 +16819,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-query-digest 3.0.4
pt-query-digest 3.0.5
=cut

View File

@@ -2524,6 +2524,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-show-grants 3.0.4
pt-show-grants 3.0.5
=cut

View File

@@ -1245,7 +1245,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-sift 3.0.4
pt-sift 3.0.5
=cut

View File

@@ -40,7 +40,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -4919,6 +4919,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-slave-delay 3.0.4
pt-slave-delay 3.0.5
=cut

View File

@@ -2302,8 +2302,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -2565,6 +2564,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -2576,8 +2576,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -2587,7 +2586,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -2638,6 +2641,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -2706,6 +2720,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -4465,6 +4482,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-slave-find 3.0.4
pt-slave-find 3.0.5
=cut

View File

@@ -41,7 +41,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -2713,8 +2713,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -2976,6 +2975,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -2987,8 +2987,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -2998,7 +2997,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -3049,6 +3052,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -3117,6 +3131,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -6054,6 +6071,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-slave-restart 3.0.4
pt-slave-restart 3.0.5
=cut

View File

@@ -2346,7 +2346,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-stalk 3.0.4
pt-stalk 3.0.5
=cut

View File

@@ -2723,7 +2723,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-summary 3.0.4
pt-summary 3.0.5
=cut

View File

@@ -57,7 +57,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -5124,8 +5124,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -5387,6 +5386,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -5398,8 +5398,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -5409,7 +5408,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -5460,6 +5463,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -5528,6 +5542,9 @@ sub catchup_to_master {
timeout => $timeout,
master_status => $master_status
);
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -8533,7 +8550,6 @@ sub wait {
PTDEBUG && _d('Checking slave lag');
for my $i ( 0..$#lagged_slaves ) {
my $lag = $get_lag->($lagged_slaves[$i]->{cxn});
die "Please restart the program using --channel=<channel name>" if !defined($lag);
PTDEBUG && _d($lagged_slaves[$i]->{cxn}->name(),
'slave lag:', $lag);
if ( !defined $lag || $lag > $max_lag ) {
@@ -10689,7 +10705,7 @@ sub main {
# TODO: this now happens in 3 places, search for 'columns'.
my $tbl_struct = $tbl->{tbl_struct};
my $ignore_col = $o->get('ignore-columns') || {};
my $all_cols = $o->get('columns') || $tbl_struct->{cols};
my $all_cols = $o->get('columns') || $tbl_struct->{non_generated_cols};
my @cols = map { lc $_ }
grep { !$ignore_col->{$_} }
@$all_cols;
@@ -13226,6 +13242,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-table-checksum 3.0.4
pt-table-checksum 3.0.5
=cut

View File

@@ -55,7 +55,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -6696,8 +6696,7 @@ sub get_slaves {
},
}
);
}
elsif ( $methods->[0] =~ m/^dsn=/i ) {
} elsif ( $methods->[0] =~ m/^dsn=/i ) {
(my $dsn_table_dsn = join ",", @$methods) =~ s/^dsn=//i;
$slaves = $self->get_cxn_from_dsn_table(
%args,
@@ -6959,6 +6958,7 @@ sub get_master_dsn {
sub get_slave_status {
my ( $self, $dbh ) = @_;
if ( !$self->{not_a_slave}->{$dbh} ) {
my $sth = $self->{sths}->{$dbh}->{SLAVE_STATUS}
||= $dbh->prepare('SHOW SLAVE STATUS');
@@ -6970,8 +6970,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -6981,7 +6980,11 @@ sub get_slave_status {
}
}
} else {
$ss = $sss_rows->[0];
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
}
if ( $ss && %$ss ) {
@@ -7032,15 +7035,17 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,
error =>'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line',
error =>'Wait for master: this is a multi-master slave but "channel" was not specified on the command line',
};
}
my $server_version = VersionParser->new($slave_dbh);
my $channel_sql = $server_version > '5.6' && $self->{channel} ? ", '$self->{channel}'" : '';
my $sql = "SELECT MASTER_POS_WAIT('$master_status->{file}', $master_status->{position}, $timeout $channel_sql)";
@@ -7060,7 +7065,6 @@ sub wait_for_master {
return {
result => $result,
waited => $waited,
error => undef,
};
}
@@ -7113,7 +7117,6 @@ sub catchup_to_master {
if ($result->{error}) {
die $result->{error};
}
if ( !defined $result->{result} ) {
$slave_status = $self->get_slave_status($slave);
if ( !$self->slave_is_running($slave_status) ) {
@@ -12966,6 +12969,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-table-sync 3.0.4
pt-table-sync 3.0.5
=cut

View File

@@ -8487,6 +8487,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-table-usage 3.0.4
pt-table-usage 3.0.5
=cut

View File

@@ -61,7 +61,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -11368,6 +11368,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-upgrade 3.0.4
pt-upgrade 3.0.5
=cut

View File

@@ -44,7 +44,7 @@ BEGIN {
{
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';
@@ -6188,6 +6188,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-variable-advisor 3.0.4
pt-variable-advisor 3.0.5
=cut

View File

@@ -3281,6 +3281,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
pt-visual-explain 3.0.4
pt-visual-explain 3.0.5
=cut

View File

@@ -1,3 +1,8 @@
percona-toolkit (3.0.5-1) unstable; urgency=low
-- Percona Toolkit Developers <toolkit-dev@percona.com> Fri, 17 Nov 2017 08:02:47 +0000
percona-toolkit (3.0.4-1) unstable; urgency=low
* Fixed bug PT-181 : pt-online-schema-change not in sync with modules (Thanks Daniël van Eeden)

View File

@@ -50,7 +50,7 @@ copyright = u'2017, Percona LLC and/or its affiliates'
# The short X.Y version.
version = '3.0'
# The full version, including alpha/beta/rc tags.
release = '3.0.4'
release = '3.0.5'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@@ -560,6 +560,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
=head1 VERSION
Percona Toolkit v3.0.4 released 2017-08-02
Percona Toolkit v3.0.5 released 2017-11-17
=cut

View File

@@ -1,6 +1,34 @@
Release Notes
*************
v3.0.5 released 2017-11-20
==========================
Percona Toolkit 3.0.5 includes the following changes:
New Features
* :jirabug:`PMM-1590`: Improve MongoDB Profiler for ``PMM`` and ``PT``
* :jirabug:`PT-216`: The ``mongodb-query-digest`` supports ``MongoDB` versions lower than 3.2; incorrect output was fixed.
* :jirabug:`PT-182`: The ``pt-summary``, ``pt-mysql-summary``, ``pt-mongodb-summary`` commands provide output in the the JSON format.
* :jirabug:`PT-152`: ``pt-mysql-summary`` shows the output of the *Show Slave Hosts* command.
* :jirabug:`PT-139`: ``pt-table-sync`` supports replication channels (requires MySQL version 5.7.6 or higher)
Bug fixes
* :jirabug:`PT-211`: ``pt-mext`` fails if the ``Rsa_public_key`` variable is empty.
* :jirabug:`PT-212`: ``pt-mongodb-query-digest --version`` produced incorrect values.
* :jirabug:`PT-202`: ``pt-online-schema-change`` incorrectly processed virtual columns.
* :jirabug:`PT-200`: ``pt-online-schema-change`` command reported an error when the name of an index contained 'unique' as as the prefix or suffix.
* :jirabug:`PT-199`: ``pt-table-checksum`` did not detect differences on a system with the ROW based replication active.
* :jirabug:`PT-196`: ``pt-onine-schema-change --max-load`` paused if a status variable was passed **0** as the value.
* :jirabug:`PT-193`: ``pt-table-checksum`` reported a misleading error if a column comment contained an apostrophe. For more information, see :lpbug:`1708749`.
* :jirabug:`PT-187`: In some cases, ``pt-table-checksum`` did not report that the same table contained different values on the master and slave.
* :jirabug:`PT-186`: ``pt-online-schema-change --alter`` could fail if field names contained upper case characters. For more information, see :lpbug:`1705998`.
* :jirabug:`PT-183`: In some cases ``pt-mongodb-query-digest`` could not connect to a db using authentication.
* :jirabug:`PT-167`: In some cases, ``pt-kill`` could ignore the value of the ``--busy-time`` parameter. For more information, see :lpbug:`1016272`.
* :jirabug:`PT-161`: When run with the ``--skip-check-slave-lag``, the ``pt-table-checksum`` could could fail in some cases.
v3.0.4 released 2017-08-02
==========================

View File

@@ -446,8 +446,7 @@ sub get_slave_status {
if ( $sss_rows && @$sss_rows ) {
if (scalar @$sss_rows > 1) {
if (!$self->{channel}) {
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
return undef;
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
}
for my $row (@$sss_rows) {
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
@@ -458,8 +457,7 @@ sub get_slave_status {
}
} else {
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
warn 'This server is using replication channels but "channel" was not specified on the command line';
return undef;
die 'This server is using replication channels but "channel" was not specified on the command line';
} else {
$ss = $sss_rows->[0];
}
@@ -535,8 +533,11 @@ sub wait_for_master {
my $result;
my $waited;
if ( $master_status ) {
my $slave_status = $self->get_slave_status($slave_dbh);
if (!$slave_status) {
my $slave_status;
eval {
$slave_status = $self->get_slave_status($slave_dbh);
};
if ($EVAL_ERROR) {
return {
result => undef,
waited => 0,

View File

@@ -18,7 +18,7 @@
# ###########################################################################
package Percona::Toolkit;
our $VERSION = '3.0.4';
our $VERSION = '3.0.5';
use strict;
use warnings FATAL => 'all';

View File

@@ -1,6 +1,6 @@
GO := go
pkgs = $(shell find . -type d -name "pt-mongodb*" -exec basename {} \;)
VERSION="3.0.4"
VERSION="3.0.5"
BUILD=$(shell date +%FT%T%z)
GOVERSION=$(shell go version | cut --delimiter=" " -f3)

View File

@@ -214,7 +214,7 @@ func TestStatsSingle(t *testing.T) {
t.Fatalf("cannot load expected data %s: %s", dirExpect+f, err)
}
if !reflect.DeepEqual(got, expect) {
t.Errorf("s.Queries() = %s, want %s", got, expect)
t.Errorf("s.Queries() = %#v, want %#v", got, expect)
}
})
}
@@ -261,7 +261,7 @@ func TestStatsAll(t *testing.T) {
t.Fatalf("cannot load expected data %s: %s", f, err)
}
if !reflect.DeepEqual(got, expect) {
t.Errorf("s.Queries() = %s, want %s", got, expect)
t.Errorf("s.Queries() = %#v, want %#v", got, expect)
}
}
@@ -343,7 +343,7 @@ func TestAvailableMetrics(t *testing.T) {
}
if !reflect.DeepEqual(got, expect) {
t.Errorf("s.Queries() = %s, want %s", got, expect)
t.Errorf("s.Queries() = %#v, want %#v", got, expect)
}
})

View File

@@ -255,6 +255,7 @@ func getOptions() (*options, error) {
OrderBy: strings.Split(DEFAULT_ORDERBY, ","),
SkipCollections: strings.Split(DEFAULT_SKIPCOLLECTIONS, ","),
AuthDB: DEFAULT_AUTHDB,
OutputFormat: "text",
}
gop := getopt.New()
@@ -308,8 +309,8 @@ func getOptions() (*options, error) {
}
if opts.OutputFormat != "json" && opts.OutputFormat != "text" {
opts.OutputFormat = "text"
log.Infof("Invalid output format '%s'. Using text format", opts.OutputFormat)
opts.OutputFormat = "text"
}
if gop.IsSet("password") && opts.Password == "" {

View File

@@ -235,24 +235,10 @@ func testEmptySystemProfile(t *testing.T, data Data) {
t.Error(err)
}
expected := `pt-mongodb-query-digest .+
Host: ` + data.url + `
Skipping profiled queries on these collections: \[system\.profile\]
# Totals
# Ratio 0.00 \(docs scanned/returned\)
# Attribute pct total min max avg 95% stddev median
# ================== === ======== ======== ======== ======== ======== ======= ========
# Count \(docs\) 0\s
# Exec Time ms 0 NaN NaN NaN NaN NaN NaN NaN\s
# Docs Scanned 0 NaN NaN NaN NaN NaN NaN NaN\s
# Docs Returned 0 NaN NaN NaN NaN NaN NaN NaN\s
# Bytes sent 0 NaN NaN NaN NaN NaN NaN NaN\s
#\s
`
assertRegexpLines(t, expected, string(output))
expected := "No queries found in profiler information for database \\\"test\\\""
if !strings.Contains(string(output), expected) {
t.Errorf("Empty system.profile.\nGot:\n%s\nWant:\n%s\n", string(output), expected)
}
}
func testAllOperationsTemplate(t *testing.T, data Data) {
@@ -417,10 +403,6 @@ func testAllOperationsTemplate(t *testing.T, data Data) {
expected := `Profiler is disabled for the "test" database but there are \s*[0-9]+ documents in the system.profile collection.
Using those documents for the stats
pt-mongodb-query-digest .+
Host: ` + data.url + `
Skipping profiled queries on these collections: \[system\.profile\]
# Totals
# Ratio [0-9\.]+ \(docs scanned/returned\)
@@ -463,6 +445,7 @@ Skipping profiled queries on these collections: \[system\.profile\]
expected += buf.String()
}
expected += "\n" // Looks like we expect additional line
assertRegexpLines(t, expected, string(output))
}

View File

@@ -752,7 +752,7 @@ like(
SKIP: {
skip "Only test on mysql 5.7" if ( $sandbox_version lt '5.7' );
skip "Only test on mysql 5.7",6 if ( $sandbox_version lt '5.7' );
my ($master1_dbh, $master1_dsn) = $sb->start_sandbox(
server => 'chan_master1',
@@ -772,42 +772,53 @@ SKIP: {
$sb->load_file('chan_master2', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_slave1', "sandbox/slave_channels.sql", undef, no_wait => 1);
my $chan_slaves = $ms->get_slaves(
dbh => $master1_dbh,
dsn => $master1_dsn,
make_cxn => sub {
my $cxn = new Cxn(
@_,
DSNParser => $dp,
OptionParser => $o,
);
$cxn->connect();
return $cxn;
},
);
our $message;
local $SIG{__WARN__} = sub {
$message = shift;
my $chan_slaves;
eval {
$chan_slaves = $ms->get_slaves(
dbh => $master1_dbh,
dsn => $master1_dsn,
make_cxn => sub {
my $cxn = new Cxn(
@_,
DSNParser => $dp,
OptionParser => $o,
);
$cxn->connect();
return $cxn;
},
);
};
my $css = $ms->get_slave_status($slave1_dbh);
local $SIG{__WARN__} = undef;
#local $SIG{__WARN__} = sub {
# $message = shift;
#};
my $css;
eval {
$css = $ms->get_slave_status($slave1_dbh);
};
#local $SIG{__WARN__} = undef;
is (
$css,
undef,
'Cannot determine slave in a multi source config without --channel param'
);
like (
$message,
$EVAL_ERROR,
qr/This server returned more than one row for SHOW SLAVE STATUS/,
'Got warning message if we cannot determine slave in a multi source config without --channel param',
);
my $wfm = $ms->wait_for_master(
master_status => $ms->get_master_status($dbh),
slave_dbh => $slave1_dbh,
timeout => 1,
);
my $wfm;
eval {
$wfm = $ms->wait_for_master(
master_status => $ms->get_master_status($dbh),
slave_dbh => $slave1_dbh,
timeout => 1,
);
};
warn ">>>>>> @_" if @_;
like(
$wfm->{error},
qr/"channel" was not specified on the command line/,
@@ -819,7 +830,9 @@ SKIP: {
# It should return undef
$slave1_dbh->do("STOP SLAVE for channel 'masterchan2'");
$css = $ms->get_slave_status($slave1_dbh);
eval {
$css = $ms->get_slave_status($slave1_dbh);
};
is (
$css,
undef,

View File

@@ -42,7 +42,7 @@ ok(
my @files = glob("$dir/*");
my $n_files = scalar @files;
ok(
$n_files == 15 || $n_files == 14,
$n_files >= 15 && $n_files <= 16,
"And leaves all files in there"
) or diag($n_files, `ls -l $dir`);

View File

@@ -0,0 +1,75 @@
#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use PerconaTest;
use Sandbox;
use SqlModes;
require "$trunk/bin/pt-table-checksum";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
}
else {
plan tests => 3;
}
diag("loading samples");
$sb->load_file('master', 't/pt-table-checksum/samples/pt-225.sql');
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the tool will die.
# And --max-load "" prevents waiting for status variables.
my $master_dsn = $sb->dsn_for('master');
diag("setting up the slaves");
my $slave_dbh = $sb->get_dbh_for('slave1');
# Create differences
$slave_dbh->do('DELETE FROM `test`.`sbtest1` WHERE id > 15');
$slave_dbh->do('FLUSH TABLES');
my @args = ($master_dsn, "--set-vars", "innodb_lock_wait_timeout=50",
"--ignore-databases", "mysql,sys,sakila,percona_test",
"--nocheck-replication-filters");
my $output;
my $exit_status;
# Test #1
$output = output(
sub { $exit_status = pt_table_checksum::main(@args) },
stderr => 1,
);
isnt(
$exit_status,
0,
"PT-225 virtual/generated columns are ignored - exit status",
);
like(
$output,
qr/1\s+\d+\s+\d+\s+\d+\s+.*test.sbtest1/,
"PT-225 virtual/generated columns were ignored",
);
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use PerconaTest;
use Sandbox;
use SqlModes;
require "$trunk/bin/pt-table-checksum";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
}
else {
plan tests => 3;
}
diag("loading samples");
#$sb->load_file('master', 't/pt-table-checksum/samples/pt-226.sql');
$sb->load_file('master', 't/pt-table-checksum/samples/pt-226.sql');
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the tool will die.
# And --max-load "" prevents waiting for status variables.
my $master_dsn = $sb->dsn_for('master');
diag("setting up the slaves");
my $slave_dbh = $sb->get_dbh_for('slave1');
# Create differences
$slave_dbh->do('DELETE FROM `test`.`joinit` WHERE i > 90');
$slave_dbh->do('FLUSH TABLES');
$dbh->do('SET GLOBAL binlog_format="ROW"');
my @args = ($master_dsn, "--set-vars", "innodb_lock_wait_timeout=50",
"--ignore-databases", "mysql",
"--nocheck-replication-filters");
my $output;
my $exit_status;
# Test #1
$output = output(
sub { $exit_status = pt_table_checksum::main(@args) },
stderr => 1,
);
isnt(
$exit_status,
0,
"PT-226 SET binlog_format='STATEMENT' exit status",
);
like(
$output,
qr/1\s+100\s+1\s+0\s+.*test.joinit/,
"PT-226 table joinit has differences",
);
$dbh->do('SET GLOBAL binlog_format="STATEMENT"');
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;

View File

@@ -0,0 +1,42 @@
DROP DATABASE IF EXISTS test;
CREATE DATABASE test;
USE test;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`k` int(11) NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '',
`pad` char(60) NOT NULL DEFAULT '',
`json_test_v` json GENERATED ALWAYS AS (json_array(`k`,`c`,`pad`)) VIRTUAL,
`json_test_s` json GENERATED ALWAYS AS (json_array(`k`,`c`,`pad`)) STORED,
`json_test_index` varchar(255) GENERATED ALWAYS AS (json_array(`k`,`c`,`pad`)) STORED,
PRIMARY KEY (`id`),
KEY `k_1` (`k`),
KEY `json_test_index` (`json_test_index`)
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 COMPRESSION='lz4';
/*!40000 ALTER TABLE `sbtest1` DISABLE KEYS */;
INSERT INTO `sbtest1` (`id`, `k`, `c`, `pad`) VALUES
(01,583532949,'at non eaque sint velit enim facilis quisquam nam quaerat.','impedit quae hic possimus ullam est eos totam qui.'),
(02,583532949,'eos exercitationem quisquam saepe totam dolore consequatur.','sit commodi consequatur neque qui.'),
(03,1342458479,'et quia sunt eum eveniet non eum nobis quia est mollitia.','corrupti minima et quibusdam.'),
(04,280366509,'ab minima laudantium!','est sed autem quia nobis suscipit pariatur modi!'),
(05,1801160058,'perspiciatis tenetur minima accusantium consequatur in et.','rerum quo molestiae voluptates harum aspernatur sunt.'),
(06,914091476,'quas aut nostrum a.','harum tempora adipisci et et.'),
(07,1022430181,'qui voluptates inventore voluptatem voluptas numquam blanditiis corporis illum doloremque aut!','dicta neque laboriosam voluptatibus.'),
(08,165910161,'voluptas molestiae harum quis quod.','voluptatem deleniti dolor blanditiis est earum.'),
(09,1255569388,'consequuntur nihil non veniam et possimus sunt.','est est possimus recusandae ab.'),
(10,1375471152,'doloribus quasi quasi eum hic et laborum autem laudantium saepe veritatis.','enim earum et placeat animi ut.'),
(11,1705409249,'eveniet recusandae expedita est consectetur ut laudantium temporibus.','et asperiores porro id sunt totam maiores eum quidem.'),
(12,2003588754,'debitis molestias voluptatibus quia.','sint est voluptatem nihil et.'),
(13,1714682759,'voluptas officiis culpa quaerat sit quis.','vitae omnis repellat rerum consectetur ex.'),
(14,1898674299,'et est quibusdam!','aut est labore.'),
(15,1698116023,'similique nisi quisquam pariatur minus repudiandae ducimus.','eveniet rem nihil voluptatibus voluptatem non.'),
(16,1310715836,'expedita ipsum aut veniam!','incidunt at officia nisi.'),
(17,472875023,'numquam et quaerat voluptatibus.','commodi natus consequatur reiciendis adipisci ut.'),
(18,1153628287,'aut quam quia vel molestiae qui.','eos voluptas quod doloremque!'),
(19,525456967,'dignissimos quibusdam aut et.','laborum reprehenderit eius consequatur qui.'),
(20,1396416465,'aperiam sint et.','fugiat neque impedit cumque soluta.'),
(21,1640670520,'nisi repellendus et velit ab.','incidunt quo eligendi.');

View File

@@ -0,0 +1,115 @@
DROP DATABASE IF EXISTS test;
CREATE DATABASE test;
USE test;
CREATE TABLE `joinit` (
`i` int(11) NOT NULL AUTO_INCREMENT,
`s` varchar(64) DEFAULT NULL,
`t` time NOT NULL,
`g` int(11) NOT NULL,
PRIMARY KEY (`i`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `joinit` VALUES (1,'dicta ipsa molestiae sit aut sunt nesciunt.','07:21:11',914091476),
(2,'id quia ut reprehenderit rerum.','06:08:56',1705409249),
(3,'voluptates dolore repudiandae voluptas.','15:34:36',1310715836),
(4,'aliquam error qui et rerum.','08:31:50',1640670520),
(5,'accusamus sequi eos porro pariatur possimus.','20:51:37',2011751560),
(6,NULL,'00:10:28',1657080267),
(7,'culpa porro necessitatibus recusandae recusandae.','11:03:59',1406095383),
(8,'beatae voluptatum odio.','19:47:12',1134860842),
(9,'ea soluta et occaecati facilis.','04:00:31',1777484703),
(10,NULL,'15:22:10',1933032615),
(11,NULL,'09:37:52',950391508),
(12,'ad est optio esse.','05:25:06',1947188364),
(13,'accusamus necessitatibus qui corrupti quae soluta adipisci.','21:04:30',341275526),
(14,'rem doloremque et nobis.','13:59:09',1897356779),
(15,'ab consequatur vel porro ut.','19:12:02',2131804237),
(16,'quas molestiae saepe voluptatem rerum quis.','03:41:59',1480121891),
(17,'assumenda ipsa facere et porro voluptas.','17:08:41',663551763),
(18,'est reprehenderit expedita magnam suscipit sunt et.','07:15:01',363238924),
(19,'rerum qui laudantium.','09:51:18',419864978),
(20,'ut qui temporibus vel.','08:40:00',284706965),
(21,'laboriosam ratione aliquid consectetur quidem ab assumenda qui.','15:21:45',1408072633),
(22,'at qui delectus quos sit.','12:43:10',1124985924),
(23,'doloremque odio eos accusantium praesentium officia molestiae ad','01:31:02',1874543227),
(24,'eaque suscipit ullam.','04:07:37',1442092269),
(25,'ut consectetur sit incidunt nostrum occaecati in similique.','20:12:29',1138469771),
(26,'maiores in ipsum.','12:34:46',156229088),
(27,'corporis et reiciendis velit veritatis eaque.','15:51:48',271447457),
(28,NULL,'14:48:19',1508837206),
(29,'rerum quod incidunt ut.','22:59:07',915259646),
(30,'nulla recusandae qui quisquam ut animi culpa rem dolor.','16:58:10',1648444437),
(31,'ipsa qui porro aliquam ab quisquam odio.','01:31:24',1928855257),
(32,'occaecati et officia quod unde.','23:40:12',2094599137),
(33,'molestiae ipsum animi illo incidunt sit fugiat.','20:27:01',682166125),
(34,'sed rerum tenetur ut maxime cumque et.','07:59:16',402527489),
(35,'quasi qui deleniti et quia aspernatur eum harum.','09:44:45',1875752492),
(36,'molestias deserunt sit.','04:47:40',1621124315),
(37,'ut sit dolorem praesentium voluptatem numquam vel est repellendu','04:27:29',1929299726),
(38,'nesciunt officia qui expedita officia!','14:12:17',1871749515),
(39,'molestias fugit qui quas aut quis quis.','02:20:50',133250776),
(40,'nemo voluptas nostrum quae at nesciunt aut.','05:30:16',1977544176),
(41,'neque at nemo laudantium.','18:49:09',1160495982),
(42,NULL,'01:53:15',238269571),
(43,'placeat sit magnam quasi officiis rem.','01:32:17',2050374349),
(44,'harum magnam repellendus natus molestias.','02:31:36',266881561),
(45,'corrupti optio aliquid et eum.','11:27:58',1057706898),
(46,'et aut a at alias quod.','20:27:16',1803439254),
(47,'eum enim voluptatem fugit ipsam iure.','10:00:56',465971914),
(48,'sapiente quis nemo est aperiam corporis exercitationem velit.','03:55:59',1754471891),
(49,'consequuntur aspernatur fugiat est sit autem est.','22:25:20',454377625),
(50,'aut sed consequatur amet.','21:59:00',1580210933),
(51,'autem eius delectus autem ut.','05:42:06',694812007),
(52,'magnam nisi ipsum sit quae reprehenderit eius.','10:57:48',1705595462),
(53,'qui sit ut est voluptatibus earum.','08:43:27',1756643709),
(54,'dolore enim at eum deserunt excepturi omnis!','15:32:25',1793291857),
(55,'nesciunt perferendis omnis quia perspiciatis.','00:53:16',439848412),
(56,'voluptas laboriosam commodi inventore.','12:17:27',502769231),
(57,'non nihil inventore qui.','12:23:29',2010474512),
(58,NULL,'07:59:58',195539887),
(59,NULL,'01:03:13',185293657),
(60,'sunt et perferendis.','01:41:52',593397986),
(61,'qui nemo magni explicabo iure corrupti exercitationem quas!','13:12:36',158590428),
(62,'fugiat optio omnis quisquam.','15:34:07',249619147),
(63,'suscipit dicta incidunt eaque vel officia.','00:12:54',884057050),
(64,'at qui reprehenderit quod est optio.','11:44:52',1888470232),
(65,NULL,'17:28:01',1631026724),
(66,'eius sunt omnis quibusdam autem ut.','08:24:17',91435374),
(67,'doloremque cum cupiditate dolorem omnis.','06:29:20',1151045825),
(68,'iure facilis qui illum aliquam sed asperiores sed!','11:18:27',86548934),
(69,'eos nisi ipsam molestiae ut.','03:13:29',1033200673),
(70,'ex sint aut et cumque et facilis et amet!','01:45:19',1258514903),
(71,'nihil sit assumenda voluptatibus explicabo!','21:36:39',185971679),
(72,'amet vero perferendis atque.','12:01:35',2040594002),
(73,'earum molestiae asperiores ut.','19:18:16',1165023000),
(74,'consequatur rerum similique quasi.','14:44:12',713361001),
(75,'pariatur voluptatibus omnis ipsum iure sint veritatis at cupidit','18:06:16',1550033064),
(76,'exercitationem maxime dolor totam velit sit provident.','15:33:33',979765860),
(77,'sed reiciendis aut id adipisci error!','05:17:42',542662142),
(78,'eaque quod distinctio nihil iste qui aspernatur et accusantium.','10:35:44',1134356103),
(79,'molestias deleniti deleniti perspiciatis.','19:16:57',1360205808),
(80,'architecto enim nulla.','09:28:24',531569080),
(81,'porro aut at quisquam commodi vel molestias.','22:49:27',1154086856),
(82,'libero in et in mollitia.','08:35:21',1945863708),
(83,'voluptates sequi ut enim in fuga debitis.','09:11:07',1987718992),
(84,'voluptatum neque voluptates minus.','21:44:27',1928647112),
(85,'maxime similique consectetur.','14:01:49',1808357109),
(86,'nesciunt aspernatur et mollitia aut labore.','00:48:27',1645832522),
(87,'alias quasi ut eveniet vero necessitatibus velit nesciunt nam!','18:22:59',740680075),
(88,'et totam est voluptas odit rem illum saepe.','02:35:28',980905093),
(89,'porro cupiditate assumenda et non magni deserunt qui repellendus','04:18:30',1965305195),
(90,'vitae quis ullam eos in debitis laudantium!','22:39:14',535565611),
(91,'quo consequatur expedita.','12:33:03',1037848256),
(92,'ipsum at ea consequatur tempore natus!','12:40:38',1216234763),
(93,'numquam repellendus modi culpa corporis aut.','07:46:22',984113837),
(94,'minima in sed modi maxime est iusto.','20:48:55',1026183968),
(95,NULL,'10:48:23',1418133890),
(96,'nesciunt similique fugiat quae repudiandae et eveniet.','17:44:07',583744287),
(97,'libero voluptatibus quibusdam.','09:09:23',1292950444),
(98,'id quasi distinctio molestiae eaque exercitationem id.','18:17:07',625537546),
(99,'veritatis ab quibusdam omnis eum dolor quasi doloremque quia.','02:10:52',1042143012),
(100,'vel accusamus nisi praesentium et.','04:15:54',661815870);

View File

@@ -66,7 +66,9 @@ my $modes_host2 = new SqlModes($dbh2, global=>1);
$modes_host1->del('STRICT_TRANS_TABLES');
$modes_host2->del('STRICT_TRANS_TABLES');
while ( my $sampleno = readdir $dh ) {
my @dirs = sort readdir($dh);
foreach my $sampleno (@dirs) {
next unless $sampleno =~ m/^\d+$/;
my $conf = "$samples_dir/$sampleno/conf";