pt-online-schema-change fails when using --no-drop-old-table after 10 times
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Frank Cizmich |
Bug Description
This is somewhat related to https:/
If you run `pt-osc [OPTIONS] --no-drop-
The problem here is that this is done after the new table has been created and the ALTER/copy from the to-be old table has happened already (see attached file pt-osc_t1.out), making the tool fail after it has done everything else.
If this can't be solved, we should at least check this before starting with the ALTER/copy phase.
Steps to reproduce:
1- Create a table
mysql test -e "CREATE TABLE t1 (id int primary key)"
2- Run pt-osc enough times, or use the following to simulate this
for i in $(seq 58); do UNDERSCORE="_"; UNDERSCOREITER="";
for j in $(seq $i); do UNDERSCOREITER=
done;
mysql test -e "CREATE TABLE ${UNDERSCOREITE
done;
3- Run pt-osc after there are enough _.*t1_old tables so that creating one with one more '_' will fail
PTDEBUG=1 pt-online-
4- Check /tmp/pt-osc_t1.out to see how the tool run everything, but errored out after not being able to rename the table. Example:
[...]
Altering `test`.`t1`...
Creating new table...
Created new table test._t1_new OK.
Altering new table...
Altered `test`.`_t1_new` OK.
2015-12-14T23:40:20 Creating triggers...
2015-12-14T23:40:20 Created triggers OK.
2015-12-14T23:40:20 Copying approximately 1 rows...
2015-12-14T23:40:20 Copied rows OK.
2015-12-14T23:40:20 Analyzing new table...
2015-12-14T23:40:20 Swapping tables...
2015-12-14T23:40:20 Dropping triggers...
2015-12-14T23:40:20 Dropped triggers OK.
Not dropping the new table `test`.`_t1_new` because --swap-tables failed. To drop the new table, execute:
DROP TABLE IF EXISTS `test`.`_t1_new`;
`test`.`t1` was not altered.
Changed in percona-toolkit: | |
status: | Confirmed → In Progress |
milestone: | none → 2.2.17 |
tags: | added: pt-online-schema-change |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
importance: | Undecided → Medium |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
Confirmed exactly as described:
...
Altering `test`.`t1`...
Creating new table...
Created new table test._t1_new OK.
Altering new table...
Altered `test`.`_t1_new` OK.
2015-12-15T10:20:03 Creating triggers...
2015-12-15T10:20:03 Created triggers OK.
2015-12-15T10:20:03 Copying approximately 1 rows...
2015-12-15T10:20:03 Copied rows OK.
2015-12-15T10:20:03 Analyzing new table...
2015-12-15T10:20:03 Swapping tables...
2015-12-15T10:20:03 Dropping triggers...
2015-12-15T10:20:03 Dropped triggers OK.
Not dropping the new table `test`.`_t1_new` because --swap-tables failed. To drop the new table, execute:
DROP TABLE IF EXISTS `test`.`_t1_new`;
`test`.`t1` was not altered.