pt-online-schema-change doesn't retry RENAME TABLE

Bug #1093016 reported by Fernando Ipar
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Fix Released
High
Daniel Nichter

Bug Description

Not sure if this is a bug or a feature request, but with this table:

mysql [localhost] {msandbox} (test) > show create table test2\G
*************************** 1. row ***************************
       Table: test2
Create Table: CREATE TABLE `test2` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `c` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5102195 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

And this invocation of pt-osc:

bash-3.2$ ./pt-online-schema-change --alter "add index idx_c (c)" --execute h=127.0.0.1,P=5527,u=msandbox,p=msandbox,D=test,t=test2 2>&1 | tee pt-osc.log

if rows from test.test2 are locked before the RENAME TABLE operation, then the tool will wait for lock_wait_timeout time (makes sense) and then fail, dropping the new table. This is not good if the table is very large. I think a good alternative would be to have an option to make the tool fail as it does, but not removing the new table or the triggers, so that the rename can be retried, at least manually.

To lock the table for this specific test case, I just ran:

begin; select * from test2 limit 1 for update;

before the rename table operation (I populated the table with enough rows that the copy process takes a few seconds).

I am attaching pt-osc.log, which is the output of the full run when using PTDEBUG enabled.

Related branches

Revision history for this message
Fernando Ipar (fipar) wrote :
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

It's a bug: the tool doesn't retry the RENAME or the DROP TRIGGER statements like to does SQL statements to copy rows. The same retry and error handling for those SQL statements should be applied to the RENAME and DROP TRIGGER statements.

tags: added: pt-online-schema-change
Changed in percona-toolkit:
status: New → Triaged
summary: - If pt-osc fails due to a lock wait timeout at the rename table phase,
- the new table is dropped.
+ pt-online-schema-change doesn't retry RENAME TABLE
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Fixed in 2.2.1. See bug 1113301.

Changed in percona-toolkit:
status: Triaged → In Progress
assignee: nobody → Daniel Nichter (daniel-nichter)
importance: Undecided → High
Changed in percona-toolkit:
milestone: none → 2.2.1
Changed in percona-toolkit:
status: In Progress → Fix Committed
Changed in percona-toolkit:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-342

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.