From b5c48f07d13d507339127b5b2d48bebeb210e807 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Wed, 31 Oct 2012 12:12:51 -0600 Subject: [PATCH] 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. --- bin/pt-table-checksum | 14 +++++++------- t/pt-table-checksum/basics.t | 15 +++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 9876f9fc..b22d51b1 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -8876,10 +8876,12 @@ sub main { # 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 # do || 1 so the limit is never 0 and empty tables are single-chunked. - # See: https://bugs.launchpad.net/percona-toolkit/+bug/987393 - # This is used for the 1st purpose of --chunk-size-limit: - my $limit = $o->get('chunk-size-limit') || 1; - my $chunk_size_limit = $o->get('chunk-size-limit'); + # See: + # https://bugs.launchpad.net/percona-toolkit/+bug/987393 + # 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 @@ -9486,9 +9488,7 @@ sub nibble_is_safe { # shouldn't have changed. If chunking the table with a non-unique key, # oversize chunks are possible. if ( my $limit = $o->get('chunk-size-limit') ) { - my $oversize_chunk - = $limit ? ($expl->{rows} || 0) >= $tbl->{chunk_size} * $limit - : 0; + my $oversize_chunk = ($expl->{rows} || 0) >= $tbl->{chunk_size} * $limit; if ( $oversize_chunk && $nibble_iter->identical_boundaries($boundary->{upper}, $boundary->{next_lower}) ) { diff --git a/t/pt-table-checksum/basics.t b/t/pt-table-checksum/basics.t index 1894a79f..88af4f9b 100644 --- a/t/pt-table-checksum/basics.t +++ b/t/pt-table-checksum/basics.t @@ -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 # ############################################################################# +# 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)) + $exit_status = pt_table_checksum::main(@args, + qw(-d test --chunk-size 2 --chunk-size-limit 0)) }, stderr => 1, ); -unlike( +like( $output, 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); ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); - done_testing; -exit;