PT-1802 WIP

This commit is contained in:
Carlos Salguero
2020-04-02 09:57:45 -03:00
parent f80c098614
commit 54f90e4bdf
4 changed files with 176 additions and 6 deletions

View File

@@ -32,7 +32,6 @@ my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
my @args = (qw(--set-vars innodb_lock_wait_timeout=3 --alter-foreign-keys-method rebuild_constraints));
my $output;
my $exit_status;
my $sample = "t/pt-online-schema-change/samples/";
# ############################################################################
# https://bugs.launchpad.net/percona-toolkit/+bug/1632522
@@ -40,7 +39,7 @@ my $sample = "t/pt-online-schema-change/samples/";
# ############################################################################
diag("Before loading sql");
$sb->load_file('master', "$sample/bug-1632522.sql");
$sb->load_file('master', "t/pt-online-schema-change/samples/bug-1632522.sql");
diag("after loading sql");
# run once: we expect the constraint name to be appended with one underscore
@@ -52,7 +51,15 @@ diag("after loading sql");
qw(--execute)) },
);
my $constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema='bug1632522' and (TABLE_NAME='test_table' OR TABLE_NAME='person') and CONSTRAINT_NAME LIKE '%fk_%' ORDER BY TABLE_NAME, CONSTRAINT_NAME");
my $query = <<"END";
SELECT TABLE_NAME, CONSTRAINT_NAME
FROM information_schema.KEY_COLUMN_USAGE
WHERE table_schema='bug1632522'
AND (TABLE_NAME='test_table' OR TABLE_NAME='person')
AND CONSTRAINT_NAME LIKE '%fk_%'
ORDER BY TABLE_NAME, CONSTRAINT_NAME
END
my $constraints = $master_dbh->selectall_arrayref($query);
is_deeply(
$constraints,
@@ -73,7 +80,15 @@ is_deeply(
qw(--execute)) },
);
$constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema='bug1632522' and (TABLE_NAME='test_table' OR TABLE_NAME='person') and CONSTRAINT_NAME LIKE '%fk_%' ORDER BY TABLE_NAME, CONSTRAINT_NAME");
$query = <<"END";
SELECT TABLE_NAME, CONSTRAINT_NAME
FROM information_schema.KEY_COLUMN_USAGE
WHERE table_schema='bug1632522'
AND (TABLE_NAME='test_table' OR TABLE_NAME='person')
AND CONSTRAINT_NAME LIKE '%fk_%'
ORDER BY TABLE_NAME, CONSTRAINT_NAME
END
$constraints = $master_dbh->selectall_arrayref($query);
is_deeply(
@@ -94,7 +109,15 @@ is_deeply(
qw(--execute)) },
);
$constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema='bug1632522' and (TABLE_NAME='test_table' OR TABLE_NAME='person') and CONSTRAINT_NAME LIKE '%fk_%' ORDER BY TABLE_NAME, CONSTRAINT_NAME");
$query = <<"END";
SELECT TABLE_NAME, CONSTRAINT_NAME
FROM information_schema.KEY_COLUMN_USAGE
WHERE table_schema='bug1632522'
and (TABLE_NAME='test_table' OR TABLE_NAME='person')
and CONSTRAINT_NAME LIKE '%fk_%'
ORDER BY TABLE_NAME, CONSTRAINT_NAME
END
$constraints = $master_dbh->selectall_arrayref($query);
is_deeply(