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