Remove unused $limit. Make $chunk_size_limit || 1 because it's the one used for #-of-rows check on slaves. Reverse the new test because we don't want to disable the #-of-rows check.

This commit is contained in:
Daniel Nichter
2012-10-31 12:12:51 -06:00
parent ce3c80ea45
commit b5c48f07d1
2 changed files with 16 additions and 13 deletions

View File

@@ -8876,10 +8876,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') || 1; # https://bugs.launchpad.net/percona-toolkit/+bug/938660
my $chunk_size_limit = $o->get('chunk-size-limit'); # 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
@@ -9486,9 +9488,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}) ) {

View File

@@ -332,21 +332,26 @@ is(
); );
# ############################################################################# # #############################################################################
# pt-table-checksum chunk-size-limit of 0 does not disable chunk size limit checking # pt-table-checksum chunk-size-limit of 0 does not disable chunk size limit
# checking
# https://bugs.launchpad.net/percona-toolkit/+bug/938660 # 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( $output = output(
sub { sub {
$exit_status = pt_table_checksum::main(@args, qw(-d test --chunk-size 2 --chunk-size-limit 0)) $exit_status = pt_table_checksum::main(@args,
qw(-d test --chunk-size 2 --chunk-size-limit 0))
}, },
stderr => 1, stderr => 1,
); );
unlike( like(
$output, $output,
qr/Skipping table test.t1/, qr/Skipping table test.t1/,
"Doesn't warns about skipping a large slave table if --chunk-size-limit 0" "--chunk-size-limit=0 does not disable #-of-rows checks on slaves"
); );
# ############################################################################# # #############################################################################
@@ -496,6 +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");
done_testing; done_testing;
exit;