PT-1559 pt-osc --alter-foreign-keys-method=drop_swap doesn't work with MySQL 8.0+

This commit is contained in:
Carlos Salguero
2018-06-13 16:46:40 -03:00
parent f95d448e03
commit f5fd795fda
4 changed files with 46 additions and 3 deletions

View File

@@ -23,8 +23,9 @@ my $dbh = $sb->get_dbh_for('master');
if ( !$dbh ) {
plan skip_all => "Cannot connect to sandbox master";
}
else {
} elsif ($sandbox_version ge '8.0') {
plan skip_all => "There is no NO_AUTO_CREATE_USER in MySQL 8.0+";
} else {
plan tests => 4;
}

View File

@@ -312,7 +312,7 @@ sub test_alter_table {
) or $fail = 1;
# Go that extra mile and verify that the fks are actually
# still functiona: i.e. that they'll prevent us from delete
# still functioning: i.e. that they'll prevent us from delete
# a parent row that's being referenced by a child.
my $sql = "DELETE FROM $table WHERE $pk_col=1 LIMIT 1";
eval {
@@ -454,6 +454,9 @@ test_alter_table(
# Since fk checks were disabled, MySQL doesn't update the child table fk refs.
# Somewhat dangerous, but quick. Downside: table doesn't exist for a moment.
SKIP: {
skip "MySQL error https://bugs.mysql.com/bug.php?id=89441", 2 if ($sandbox_version ge '8.0');
test_alter_table(
name => "Basic FK drop_swap --dry-run",
table => "pt_osc.country",
@@ -486,6 +489,7 @@ test_alter_table(
'--alter', 'DROP COLUMN last_update',
],
);
}
# Let the tool auto-determine the fk update method. This should choose
# the rebuild_constraints method because the tables are quite small.
@@ -568,6 +572,8 @@ SKIP: {
skip 'Sandbox master does not have the sakila database', 7
unless @{$master_dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
skip "MySQL error https://bugs.mysql.com/bug.php?id=89441", 2 if ($sandbox_version ge '8.0');
# This test will use the drop_swap method because the child tables
# are large. To prove this, change check_fks to rebuild_constraints
# and the test will fail.

View File

@@ -0,0 +1,30 @@
No slaves found. See --recursion-method if host h=127.1,P=12345 has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation, tries, wait:
analyze_table, 10, 1
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
Altering `bug_1045317`.`bits`...
TS Dropping triggers...
TS Dropped triggers OK.
# Event Count
# ================== =====
# INSERT 1
# mysql_warning_1592 1
Successfully altered `bug_1045317`.`bits`.
Creating new table...
Created new table bug_1045317._bits_new OK.
Altering new table...
Altered `bug_1045317`.`_bits_new` OK.
TS Creating triggers...
TS Created triggers OK.
TS Copying approximately 3 rows...
TS Copied rows OK.
TS Analyzing new table...
TS Swapping tables...
TS Swapped original and new tables OK.
TS Dropping old table...
TS Dropped old table `bug_1045317`.`_bits_old` OK.