pt-online-schema-change --dry-run always fails on table with foreign keys
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Brian Fraser |
Bug Description
pt-online-
Same command with --execute works.
steps to reproduce
===============
1. Create the following tables
use harm_test;
DROP TABLE IF EXISTS `B`;
DROP TABLE IF EXISTS `A`;
CREATE TABLE `A` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`foo` varchar(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
DROP TABLE IF EXISTS `B`;
CREATE TABLE `B` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`a` int(11) NOT NULL,
KEY `9dde1f34` (`a`),
PRIMARY KEY (`id`),
CONSTRAINT `6970ddb42bec57fc` FOREIGN KEY (`a`) REFERENCES `A` (`id`)
) ENGINE=InnoDB;
INSERT INTO `A` VALUES (1,'bar'), (2,'bar2'), (3,'bar3');
INSERT INTO `B` VALUES (1, 1), (2, 2), (3, 1);
2. then run pt-online-
pt-online-
expected result
============
1. No errors are shown
2. executable exits with a OK return value (0)
actual result
==========
1. you get this error message "Error updating foreign key constraints: Invalid --alter-
2. executable exits with an ERROR value ( || echo failed -> fires ) making it hard to use it in scripts
{{{
harm@dev3:$ pt-online-
Child tables:
`harm_test`.`B` (approx. 3 rows)
Will automatically choose the method to update foreign keys.
Starting a dry run. `harm_test`.`A` will not be altered. Specify --execute instead of --dry-run to alter the table.
Creating new table...
Created new table harm_test._A_new OK.
Altering new table...
Altered `harm_test`
Not creating triggers because this is a dry run.
Not copying rows because this is a dry run.
Not determining the method to update foreign keys because this is a dry run.
Not swapping tables because this is a dry run.
Error updating foreign key constraints: Invalid --alter-
Not dropping triggers because this is a dry run.
Dropping new table...
Dropped new table OK.
Dry run complete. `harm_test`.`A` was not altered.
failed
}}}
version info
============
mysql 5.1.62-
percona-
Related branches
- Brian Fraser (community): Approve
- Daniel Nichter: Approve
-
Diff: 195 lines (+123/-2)5 files modifiedbin/pt-online-schema-change (+8/-1)
lib/PerconaTest.pm (+32/-0)
t/pt-online-schema-change/bugs.t (+46/-1)
t/pt-online-schema-change/samples/bug-1002448.sql (+14/-0)
t/pt-online-schema-change/samples/bug-1003315.sql (+23/-0)
tags: | added: crash pt-online-schema-change |
summary: |
- online-schema-change dry-run always fails on table with foreignkeys + pt-online-schema-change --dry-run always fails on table with foreign + keys |
Changed in percona-toolkit: | |
status: | New → Triaged |
milestone: | none → 2.1.2 |
importance: | Undecided → Medium |
assignee: | nobody → Brian Fraser (fraserbn) |
Changed in percona-toolkit: | |
status: | Triaged → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
perconatools -> percona-toolkit