Fixes as per Daniel's review; Removed the --quiet usage inpt-osc's nibble_is_safe, as it was ptc cruft

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-07-31 13:33:30 -03:00
parent 62c74e1e76
commit b5191a310a
2 changed files with 27 additions and 33 deletions

View File

@@ -6987,14 +6987,12 @@ sub nibble_is_safe {
# Ensure that MySQL is using the chunk index if the table is being chunked. # Ensure that MySQL is using the chunk index if the table is being chunked.
if ( !$nibble_iter->one_nibble() if ( !$nibble_iter->one_nibble()
&& lc($expl->{key} || '') ne lc($nibble_iter->nibble_index() || '') ) { && lc($expl->{key} || '') ne lc($nibble_iter->nibble_index() || '') )
if ( !$tbl->{warned}->{not_using_chunk_index}++ {
&& !$o->get('quiet') ) { die "Error copying rows at chunk " . $nibble_iter->nibble_number()
die "Error copying rows at chunk " . $nibble_iter->nibble_number() . " of $tbl->{db}.$tbl->{tbl} because MySQL chose "
. " of $tbl->{db}.$tbl->{tbl} because MySQL chose " . ($expl->{key} ? "the $expl->{key}" : "no") . " index "
. ($expl->{key} ? "the $expl->{key}" : "no") . " index " . " instead of the " . $nibble_iter->nibble_index() . "index.\n";
. " instead of the " . $nibble_iter->nibble_index() . "index.\n";
}
} }
# Ensure that the chunk isn't too large if there's a --chunk-size-limit. # Ensure that the chunk isn't too large if there's a --chunk-size-limit.
@@ -7007,18 +7005,16 @@ sub nibble_is_safe {
: 0; : 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}) )
if ( !$tbl->{warned}->{oversize_chunk}++ {
&& !$o->get('quiet') ) { die "Error copying rows at chunk " . $nibble_iter->nibble_number()
die "Error copying rows at chunk " . $nibble_iter->nibble_number() . " of $tbl->{db}.$tbl->{tbl} because it is oversized. "
. " of $tbl->{db}.$tbl->{tbl} because it is oversized. " . "The current chunk size limit is "
. "The current chunk size limit is " . ($tbl->{chunk_size} * $limit)
. ($tbl->{chunk_size} * $limit) . " rows (chunk size=$tbl->{chunk_size}"
. " rows (chunk size=$tbl->{chunk_size}" . " * chunk size limit=$limit), but MySQL estimates "
. " * chunk size limit=$limit), but MySQL estimates " . "that there are " . ($expl->{rows} || 0)
. "that there are " . ($expl->{rows} || 0) . " rows in the chunk.\n";
. " rows in the chunk.\n";
}
} }
} }
@@ -7026,16 +7022,14 @@ sub nibble_is_safe {
# https://bugs.launchpad.net/percona-toolkit/+bug/1010232 # https://bugs.launchpad.net/percona-toolkit/+bug/1010232
if ( !$nibble_iter->one_nibble() if ( !$nibble_iter->one_nibble()
&& $tbl->{key_len} && $tbl->{key_len}
&& ($expl->{key_len} || 0) < $tbl->{key_len} ) { && ($expl->{key_len} || 0) < $tbl->{key_len} )
if ( !$tbl->{warned}->{key_len}++ {
&& !$o->get('quiet') ) { die "Error copying rows at chunk " . $nibble_iter->nibble_number()
die "Error copying rows at chunk " . $nibble_iter->nibble_number() . " of $tbl->{db}.$tbl->{tbl} because MySQL used "
. " of $tbl->{db}.$tbl->{tbl} because MySQL used " . "only " . ($expl->{key_len} || 0) . " bytes "
. "only " . ($expl->{key_len} || 0) . " bytes " . "of the " . ($expl->{key} || '?') . " index instead of "
. "of the " . ($expl->{key} || '?') . " index instead of " . $tbl->{key_len} . ". See the --[no]check-plan documentation "
. $tbl->{key_len} . ". See the --[no]check-plan documentation " . "for more information.\n";
. "for more information.\n";
}
} }
return 1; # safe return 1; # safe

View File

@@ -152,10 +152,10 @@ like $output,
); );
}; };
is( like(
$EVAL_ERROR, $EVAL_ERROR,
'', qr/Error copying rows at chunk.*because MySQL chose/,
"..unless --quiet was specified", "...even if --quiet was specified",
); );
} }