pt-online-schema-change not properly detecting foreign keys
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Frank Cizmich |
Bug Description
Tool version: 2.2.7
MySQL: 5.1.45
Pt-online-
In mysql:
create database db1;
use db1;
create table parent_table (a int unsigned primary key);
create table child_table_
create database db2;
use db2;
create table child_table_
create table parent_table (a int unsigned primary key);
create table db1.child_
On commandline:
$ pt-online-
Expected:
pt-online-
* db1.child_
* db2.child_
Actual:
* db1.child_
* db1.child_
* missing db2.child_
The query at fault is:
my $sql = "SELECT table_schema, table_name "
. "FROM information_
. "WHERE constraint_
. "AND referenced_
I believe "constraint_schema" above should be changed to "referenced_
Full output:
$ pt-online-
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_
Child tables:
`db1`
`db1`
Will automatically choose the method to update foreign keys.
Starting a dry run. `db1`.`
Creating new table...
Created new table db1._parent_
Altering new table...
Altered `db1`.`
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.
Not updating foreign key constraints because this is a dry run.
Not dropping old table because this is a dry run.
Not dropping triggers because this is a dry run.
2014-05-01T15:35:24 Dropping new table...
2014-05-01T15:35:24 Dropped new table OK.
Dry run complete. `db1`.`
Related branches
- Frank Cizmich: Pending requested
-
Diff: 2558 lines (+2492/-1) (has conflicts)6 files modifiedChangelog (+5/-0)
bin/pt-online-schema-change (+1/-1)
config/deb/changelog (+17/-0)
docs/percona-toolkit.pod (+4/-0)
docs/release_notes.rst (+2387/-0)
t/pt-online-schema-change/bug-1315130.t (+78/-0)
tags: | added: pt-online-schema-change |
Changed in percona-toolkit: | |
milestone: | none → 2.2.9 |
Changed in percona-toolkit: | |
status: | Confirmed → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
Confirmed.
Patch works well too.
Thank you Rick!
Will merge to trunk soon.