mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-18 16:40:23 +00:00
PT-1757 Fixed NibbleIterator undef
This commit is contained in:
@@ -6202,7 +6202,7 @@ sub identical_boundaries {
|
||||
if scalar @$b1 != scalar @$b2; # shouldn't happen
|
||||
my $n_vals = scalar @$b1;
|
||||
for my $i ( 0..($n_vals-1) ) {
|
||||
return 0 if $b1->[$i] ne $b2->[$i]; # diff
|
||||
return 0 if ($b1->[$i] || '') ne ($b2->[$i] || ''); # diff
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -9103,7 +9103,7 @@ sub main {
|
||||
# (*) Frank: commented them out because it caused infinite loop
|
||||
# and the mentioned test error doesn't arise
|
||||
|
||||
#my $original_error = $EVAL_ERROR;
|
||||
my $original_error = $EVAL_ERROR;
|
||||
|
||||
foreach my $task ( reverse @cleanup_tasks ) {
|
||||
eval {
|
||||
@@ -9113,7 +9113,7 @@ sub main {
|
||||
warn "Error cleaning up: $EVAL_ERROR\n";
|
||||
}
|
||||
}
|
||||
#die $original_error if $original_error; # rethrow original error
|
||||
die $original_error if $original_error; # rethrow original error
|
||||
return;
|
||||
}
|
||||
);
|
||||
@@ -9638,7 +9638,7 @@ sub main {
|
||||
$nibble_iter->switch_to_nibble();
|
||||
# die ts($msg);
|
||||
} else {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (!$nibble_iter->one_nibble()) { # chunking the table
|
||||
|
@@ -7048,7 +7048,7 @@ sub identical_boundaries {
|
||||
if scalar @$b1 != scalar @$b2; # shouldn't happen
|
||||
my $n_vals = scalar @$b1;
|
||||
for my $i ( 0..($n_vals-1) ) {
|
||||
return 0 if $b1->[$i] ne $b2->[$i]; # diff
|
||||
return 0 if ($b1->[$i] || '') ne ($b2->[$i] || ''); # diff
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@@ -939,7 +939,7 @@ sub identical_boundaries {
|
||||
if scalar @$b1 != scalar @$b2; # shouldn't happen
|
||||
my $n_vals = scalar @$b1;
|
||||
for my $i ( 0..($n_vals-1) ) {
|
||||
return 0 if $b1->[$i] ne $b2->[$i]; # diff
|
||||
return 0 if ($b1->[$i] || '') ne ($b2->[$i] || ''); # diff
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@@ -177,12 +177,14 @@ sub test_alter_table {
|
||||
) or $fail = 1;
|
||||
|
||||
# Rows in the original and new table should be identical.
|
||||
my $query = "SELECT $cols FROM $table ORDER BY `$pk_col`";
|
||||
my $new_rows = $master_dbh->selectall_arrayref("SELECT $cols FROM $table ORDER BY `$pk_col`");
|
||||
my $should_diag;
|
||||
is_deeply(
|
||||
$new_rows,
|
||||
$orig_rows,
|
||||
"$name rows"
|
||||
) or $fail = 1;
|
||||
) or $fail=1;
|
||||
|
||||
if ( grep { $_ eq '--preserve-triggers' } @$cmds ) {
|
||||
my $new_triggers = $master_dbh->selectall_arrayref($triggers_sql);
|
||||
@@ -341,6 +343,8 @@ sub test_alter_table {
|
||||
|
||||
my $db_flavor = VersionParser->new($master_dbh)->flavor();
|
||||
if ( $db_flavor =~ m/XtraDB Cluster/ ) {
|
||||
diag('====================================================================================================');
|
||||
diag($db_flavor);
|
||||
test_alter_table(
|
||||
name => "Basic no fks --dry-run",
|
||||
table => "pt_osc.t",
|
||||
|
@@ -50,8 +50,6 @@ $sb->load_file('master', "$sample/long_fk_constraints.sql");
|
||||
qw(--execute)) },
|
||||
);
|
||||
|
||||
warn $output;
|
||||
|
||||
my $query = <<_SQL;
|
||||
SELECT TABLE_NAME, CONSTRAINT_NAME
|
||||
FROM information_schema.KEY_COLUMN_USAGE
|
||||
@@ -62,8 +60,11 @@ ORDER BY TABLE_NAME, CONSTRAINT_NAME
|
||||
_SQL
|
||||
my $constraints = $master_dbh->selectall_arrayref($query);
|
||||
|
||||
# why we need to sort? Depending on the MySQL version and the characters set, the ORDER BY clause
|
||||
# in the query will return different values so, it is better to rely on our own sorted results.
|
||||
my @sorted_constraints = sort { @$a[0].@$a[1] cmp @$b[0].@$b[1] } @$constraints;
|
||||
is_deeply(
|
||||
$constraints,
|
||||
\@sorted_constraints,
|
||||
[
|
||||
[ 'Table1', '__fkey1a' ],
|
||||
[ 'Table1', '__fkey_SALES_RECURRING_PROFILE_CUSTOMER_CUSTOMER_ENTITY_ENTITY_I' ],
|
||||
|
@@ -22,7 +22,6 @@ my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
|
||||
my $vp = VersionParser->new($master_dbh);
|
||||
warn Data::Dumper::Dumper($vp);
|
||||
|
||||
if ($vp->cmp('8.0.14') > -1 && $vp->flavor() !~ m/maria/i) {
|
||||
plan skip_all => 'Cannot run this test under the current MySQL version';
|
||||
@@ -65,11 +64,14 @@ my $query = <<__SQL;
|
||||
and CONSTRAINT_NAME LIKE '%fkey%'
|
||||
ORDER BY TABLE_NAME, CONSTRAINT_NAME
|
||||
__SQL
|
||||
my $constraints = $master_dbh->selectall_arrayref($query);
|
||||
|
||||
my $constraints = $master_dbh->selectall_arrayref($query);
|
||||
# why we need to sort? Depending on the MySQL version and the characters set, the ORDER BY clause
|
||||
# in the query will return different values so, it is better to rely on our own sorted results.
|
||||
my @sorted_constraints = sort { @$a[0].@$a[1] cmp @$b[0].@$b[1] } @$constraints;
|
||||
|
||||
is_deeply(
|
||||
$constraints,
|
||||
\@sorted_constraints,
|
||||
[
|
||||
['Table1', '__fkey1a'],
|
||||
['Table1', '_fkey1b'],
|
||||
@@ -79,8 +81,6 @@ is_deeply(
|
||||
"First run adds or removes underscore from constraint names, accordingly"
|
||||
);
|
||||
|
||||
|
||||
|
||||
# run second time: we expect constraint names to be prefixed with one underscore
|
||||
# if they havre't one, and to remove 2 if they have 2
|
||||
($output, $exit_status) = full_output(
|
||||
@@ -91,10 +91,10 @@ is_deeply(
|
||||
);
|
||||
|
||||
$constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema='bug1215587' and (TABLE_NAME='Table1' OR TABLE_NAME='Table2') and CONSTRAINT_NAME LIKE '%fkey%' ORDER BY TABLE_NAME, CONSTRAINT_NAME");
|
||||
|
||||
@sorted_constraints = sort { @$a[0].@$a[1] cmp @$b[0].@$b[1] } @$constraints; # read above why we need to sort
|
||||
|
||||
is_deeply(
|
||||
$constraints,
|
||||
\@sorted_constraints,
|
||||
[
|
||||
['Table1', '__fkey1b'],
|
||||
['Table1', 'fkey1a'],
|
||||
@@ -113,10 +113,10 @@ is_deeply(
|
||||
);
|
||||
|
||||
$constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema='bug1215587' and (TABLE_NAME='Table1' OR TABLE_NAME='Table2') and CONSTRAINT_NAME LIKE '%fkey%' ORDER BY TABLE_NAME, CONSTRAINT_NAME");
|
||||
|
||||
@sorted_constraints = sort { @$a[0].@$a[1] cmp @$b[0].@$b[1] } @$constraints; # read above why we need to sort
|
||||
|
||||
is_deeply(
|
||||
$constraints,
|
||||
\@sorted_constraints,
|
||||
[
|
||||
['Table1', '_fkey1a'],
|
||||
['Table1', 'fkey1b'],
|
||||
|
@@ -116,7 +116,7 @@ like(
|
||||
$output,
|
||||
qr/Failed to find a unique new table name/,
|
||||
"Doesn't try forever to find a new table name"
|
||||
);
|
||||
) or diag($output);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
|
Reference in New Issue
Block a user