mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
Merge fix-938660-ptc-chunk-size-limit-0
This commit is contained in:
@@ -8892,9 +8892,12 @@ sub main {
|
|||||||
# so no checksum is written for the empty table. To fix this and
|
# so no checksum is written for the empty table. To fix this and
|
||||||
# preserve the two purposes of this option, usages of the 2nd purpose
|
# preserve the two purposes of this option, usages of the 2nd purpose
|
||||||
# do || 1 so the limit is never 0 and empty tables are single-chunked.
|
# do || 1 so the limit is never 0 and empty tables are single-chunked.
|
||||||
# See: https://bugs.launchpad.net/percona-toolkit/+bug/987393
|
# See:
|
||||||
# This is used for the 1st purpose of --chunk-size-limit:
|
# https://bugs.launchpad.net/percona-toolkit/+bug/987393
|
||||||
my $limit = $o->get('chunk-size-limit');
|
# https://bugs.launchpad.net/percona-toolkit/+bug/938660
|
||||||
|
# https://bugs.launchpad.net/percona-toolkit/+bug/987495
|
||||||
|
# This is used for the 2nd purpose:
|
||||||
|
my $chunk_size_limit = $o->get('chunk-size-limit') || 1;
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Callbacks for each table's nibble iterator. All checksum work is done
|
# Callbacks for each table's nibble iterator. All checksum work is done
|
||||||
@@ -8950,10 +8953,6 @@ sub main {
|
|||||||
if ( $nibble_iter->one_nibble() ) {
|
if ( $nibble_iter->one_nibble() ) {
|
||||||
PTDEBUG && _d('Getting table row estimate on replicas');
|
PTDEBUG && _d('Getting table row estimate on replicas');
|
||||||
|
|
||||||
# This is used for the 2nd purpose for --chunkr-size-limit;
|
|
||||||
# see the large comment block above near my $limit = $o->...
|
|
||||||
my $chunk_size_limit = $o->get('chunk-size-limit') || 1;
|
|
||||||
|
|
||||||
my @too_large;
|
my @too_large;
|
||||||
foreach my $slave ( @$slaves ) {
|
foreach my $slave ( @$slaves ) {
|
||||||
# TODO: This duplicates NibbleIterator::can_nibble();
|
# TODO: This duplicates NibbleIterator::can_nibble();
|
||||||
@@ -9505,9 +9504,7 @@ sub nibble_is_safe {
|
|||||||
# shouldn't have changed. If chunking the table with a non-unique key,
|
# shouldn't have changed. If chunking the table with a non-unique key,
|
||||||
# oversize chunks are possible.
|
# oversize chunks are possible.
|
||||||
if ( my $limit = $o->get('chunk-size-limit') ) {
|
if ( my $limit = $o->get('chunk-size-limit') ) {
|
||||||
my $oversize_chunk
|
my $oversize_chunk = ($expl->{rows} || 0) >= $tbl->{chunk_size} * $limit;
|
||||||
= $limit ? ($expl->{rows} || 0) >= $tbl->{chunk_size} * $limit
|
|
||||||
: 0;
|
|
||||||
if ( $oversize_chunk
|
if ( $oversize_chunk
|
||||||
&& $nibble_iter->identical_boundaries($boundary->{upper},
|
&& $nibble_iter->identical_boundaries($boundary->{upper},
|
||||||
$boundary->{next_lower}) ) {
|
$boundary->{next_lower}) ) {
|
||||||
|
@@ -41,9 +41,6 @@ elsif ( !$slave1_dbh ) {
|
|||||||
elsif ( !@{$master_dbh->selectall_arrayref("show databases like 'sakila'")} ) {
|
elsif ( !@{$master_dbh->selectall_arrayref("show databases like 'sakila'")} ) {
|
||||||
plan skip_all => 'sakila database is not loaded';
|
plan skip_all => 'sakila database is not loaded';
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
plan tests => 38;
|
|
||||||
}
|
|
||||||
|
|
||||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||||
# so we need to specify --lock-wait-timeout=3 else the tool will die.
|
# so we need to specify --lock-wait-timeout=3 else the tool will die.
|
||||||
@@ -334,6 +331,29 @@ is(
|
|||||||
"52 rows checksummed"
|
"52 rows checksummed"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# #############################################################################
|
||||||
|
# pt-table-checksum chunk-size-limit of 0 does not disable chunk size limit
|
||||||
|
# checking
|
||||||
|
# https://bugs.launchpad.net/percona-toolkit/+bug/938660
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
# Decided _not_ to do this; we want to always check slave table size when
|
||||||
|
# single-chunking a table on the master.
|
||||||
|
|
||||||
|
$output = output(
|
||||||
|
sub {
|
||||||
|
$exit_status = pt_table_checksum::main(@args,
|
||||||
|
qw(-d test --chunk-size 2 --chunk-size-limit 0))
|
||||||
|
},
|
||||||
|
stderr => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
like(
|
||||||
|
$output,
|
||||||
|
qr/Skipping table test.t1/,
|
||||||
|
"--chunk-size-limit=0 does not disable #-of-rows checks on slaves"
|
||||||
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Crash if no host in DSN.
|
# Crash if no host in DSN.
|
||||||
# https://bugs.launchpad.net/percona-toolkit/+bug/819450
|
# https://bugs.launchpad.net/percona-toolkit/+bug/819450
|
||||||
@@ -481,4 +501,4 @@ is(
|
|||||||
# #############################################################################
|
# #############################################################################
|
||||||
$sb->wipe_clean($master_dbh);
|
$sb->wipe_clean($master_dbh);
|
||||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
exit;
|
done_testing;
|
||||||
|
Reference in New Issue
Block a user