pt-online-schema-change doesn't retry RENAME TABLE
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
*******
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=
1 row in set (0.00 sec)
And this invocation of pt-osc:
bash-3.2$ ./pt-online-
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
- Daniel Nichter: Approve
-
Diff: 7587 lines (+3695/-1178) (has conflicts)85 files modifiedbin/pt-archiver (+111/-15)
bin/pt-config-diff (+110/-13)
bin/pt-deadlock-logger (+110/-13)
bin/pt-duplicate-key-checker (+110/-13)
bin/pt-find (+110/-13)
bin/pt-fk-error-logger (+110/-13)
bin/pt-heartbeat (+110/-13)
bin/pt-index-usage (+110/-13)
bin/pt-kill (+110/-13)
bin/pt-online-schema-change (+593/-634)
bin/pt-query-advisor (+110/-13)
bin/pt-query-digest (+110/-13)
bin/pt-show-grants (+110/-13)
bin/pt-slave-delay (+110/-13)
bin/pt-slave-find (+110/-13)
bin/pt-slave-restart (+110/-13)
bin/pt-table-checksum (+115/-65)
bin/pt-table-sync (+110/-13)
bin/pt-table-usage (+116/-22)
bin/pt-upgrade (+110/-13)
bin/pt-variable-advisor (+110/-13)
bin/pt-visual-explain (+116/-22)
lib/DSNParser.pm (+54/-8)
lib/NibbleIterator.pm (+2/-2)
lib/OptionParser.pm (+40/-39)
sandbox/set-mysql (+23/-0)
t/lib/Cxn.t (+14/-2)
t/lib/DSNParser.t (+11/-5)
t/lib/KeySize.t (+4/-4)
t/lib/NibbleIterator.t (+3/-3)
t/lib/Percona/XtraDB/Cluster-no-PXC.t (+14/-2)
t/lib/Percona/XtraDB/Cluster.t (+14/-2)
t/lib/ReplicaLagWaiter.t (+14/-2)
t/pt-archiver/check_slave_lag.t (+10/-18)
t/pt-fifo-split/pt-fifo-split.t (+85/-12)
t/pt-online-schema-change/alter_active_table.t (+2/-2)
t/pt-online-schema-change/ansi_quotes.t (+3/-2)
t/pt-online-schema-change/basics.t (+1/-1)
t/pt-online-schema-change/bugs.t (+3/-2)
t/pt-online-schema-change/check_alter.t (+3/-2)
t/pt-online-schema-change/metadata_locks.t (+102/-0)
t/pt-online-schema-change/plugin.t (+83/-0)
t/pt-online-schema-change/privs.t (+3/-2)
t/pt-online-schema-change/pxc.t (+3/-5)
t/pt-online-schema-change/rename_columns.t (+3/-2)
t/pt-online-schema-change/samples/plugins/all_hooks.pm (+99/-0)
t/pt-online-schema-change/samples/plugins/block_create_triggers.pm (+46/-0)
t/pt-online-schema-change/samples/plugins/block_swap_tables.pm (+46/-0)
t/pt-online-schema-change/samples/stats-dry-run.txt (+3/-3)
t/pt-online-schema-change/samples/stats-execute-5.5.txt (+4/-4)
t/pt-online-schema-change/samples/stats-execute.txt (+3/-3)
t/pt-online-schema-change/sanity_checks.t (+1/-1)
t/pt-online-schema-change/skip_innodb.t (+1/-1)
t/pt-table-checksum/basics.t (+3/-3)
t/pt-table-checksum/bugs.t (+2/-2)
t/pt-table-checksum/char_chunking.t (+2/-2)
t/pt-table-checksum/chunk_index.t (+7/-7)
t/pt-table-checksum/chunk_size.t (+2/-2)
t/pt-table-checksum/create_replicate_table.t (+2/-2)
t/pt-table-checksum/error_handling.t (+3/-3)
t/pt-table-checksum/filters.t (+2/-2)
t/pt-table-checksum/float_precision.t (+2/-2)
t/pt-table-checksum/fnv_64.t (+2/-2)
t/pt-table-checksum/ignore_columns.t (+2/-2)
t/pt-table-checksum/issue_388.t (+2/-2)
t/pt-table-checksum/issue_47.t (+2/-2)
t/pt-table-checksum/issue_602.t (+2/-2)
t/pt-table-checksum/option_sanity.t (+5/-5)
t/pt-table-checksum/privs.t (+2/-2)
t/pt-table-checksum/progress.t (+2/-2)
t/pt-table-checksum/pxc.t (+2/-2)
t/pt-table-checksum/replication_filters.t (+6/-2)
t/pt-table-checksum/resume.t (+2/-2)
t/pt-table-checksum/run_time.t (+2/-2)
t/pt-table-checksum/skip_innodb.t (+2/-2)
t/pt-table-checksum/standard_options.t (+2/-2)
t/pt-table-checksum/throttle.t (+2/-2)
t/pt-table-sync/basics.t (+3/-3)
t/pt-table-sync/bugs.t (+2/-2)
t/pt-table-sync/filters.t (+2/-2)
t/pt-table-sync/issue_560.t (+1/-1)
t/pt-table-sync/issue_627.t (+1/-1)
t/pt-table-sync/issue_996.t (+1/-1)
t/pt-table-sync/triggers.t (+2/-2)
util/aspell.en.pws (+3/-0)
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 |
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.