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