mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
Merge fix-pt-osc-empty-table-bug-1020997
This commit is contained in:
@@ -4755,6 +4755,11 @@ sub next {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( !$self->{one_nibble} && !$self->{first_lower} ) {
|
||||
PTDEBUG && _d('No first lower boundary, table must be empty');
|
||||
$self->{no_more_boundaries} = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NIBBLE:
|
||||
@@ -6502,13 +6507,21 @@ sub main {
|
||||
my $tbl = $args{tbl};
|
||||
my $nibble_iter = $args{NibbleIterator};
|
||||
my $statements = $nibble_iter->statements();
|
||||
my $boundary = $nibble_iter->boundaries();
|
||||
|
||||
if ( $o->get('dry-run') ) {
|
||||
print "Not copying rows because this is a dry run.\n";
|
||||
}
|
||||
else {
|
||||
print "Copying approximately ", $nibble_iter->row_estimate(),
|
||||
" rows...\n";
|
||||
if ( !$nibble_iter->one_nibble() && !$boundary->{first_lower} ) {
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1020997
|
||||
print "$tbl->{name} is empty, no rows to copy.\n";
|
||||
return;
|
||||
}
|
||||
else {
|
||||
print "Copying approximately ", $nibble_iter->row_estimate(),
|
||||
" rows...\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( $o->get('print') ) {
|
||||
|
@@ -286,6 +286,11 @@ sub next {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( !$self->{one_nibble} && !$self->{first_lower} ) {
|
||||
PTDEBUG && _d('No first lower boundary, table must be empty');
|
||||
$self->{no_more_boundaries} = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# If there's another nibble, fetch the rows within it.
|
||||
|
@@ -249,7 +249,7 @@ is_deeply(
|
||||
\@rows,
|
||||
$all_rows,
|
||||
'1 nibble'
|
||||
) or print Dumper(\@rows);
|
||||
) or diag(Dumper(\@rows));
|
||||
|
||||
# ############################################################################
|
||||
# single row table
|
||||
@@ -274,7 +274,7 @@ is_deeply(
|
||||
\@rows,
|
||||
[['d']],
|
||||
'single row table'
|
||||
) or print Dumper(\@rows);
|
||||
) or diag(Dumper(\@rows));
|
||||
|
||||
# ############################################################################
|
||||
# empty table
|
||||
@@ -294,7 +294,7 @@ is_deeply(
|
||||
\@rows,
|
||||
[],
|
||||
'empty table'
|
||||
) or print Dumper(\@rows);
|
||||
) or diag(Dumper(\@rows));
|
||||
|
||||
# ############################################################################
|
||||
# Callbacks
|
||||
@@ -397,35 +397,35 @@ is_deeply(
|
||||
$row,
|
||||
[25, 'da79784d'],
|
||||
"SELECT chunk checksum 1 FROM sakila.country"
|
||||
) or print STDERR Dumper($row);
|
||||
) or diag(Dumper($row));
|
||||
|
||||
$row = $ni->next();
|
||||
is_deeply(
|
||||
$row,
|
||||
[25, 'e860c4f9'],
|
||||
"SELECT chunk checksum 2 FROM sakila.country"
|
||||
) or print STDERR Dumper($row);
|
||||
) or diag(Dumper($row));
|
||||
|
||||
$row = $ni->next();
|
||||
is_deeply(
|
||||
$row,
|
||||
[25, 'eb651f58'],
|
||||
"SELECT chunk checksum 3 FROM sakila.country"
|
||||
) or print STDERR Dumper($row);
|
||||
) or diag(Dumper($row));
|
||||
|
||||
$row = $ni->next();
|
||||
is_deeply(
|
||||
$row,
|
||||
[25, '2d87d588'],
|
||||
"SELECT chunk checksum 4 FROM sakila.country"
|
||||
) or print STDERR Dumper($row);
|
||||
) or diag(Dumper($row));
|
||||
|
||||
$row = $ni->next();
|
||||
is_deeply(
|
||||
$row,
|
||||
[9, 'beb4a180'],
|
||||
"SELECT chunk checksum 5 FROM sakila.country"
|
||||
) or print STDERR Dumper($row);
|
||||
) or diag(Dumper($row));
|
||||
|
||||
|
||||
# #########################################################################
|
||||
@@ -552,7 +552,7 @@ is_deeply(
|
||||
[ 'z' ], # last nibble
|
||||
],
|
||||
"Change chunk size while nibbling"
|
||||
) or print STDERR Dumper(\@rows);
|
||||
) or diag(Dumper(\@rows));
|
||||
|
||||
# ############################################################################
|
||||
# Nibble one row at a time.
|
||||
|
Reference in New Issue
Block a user