pt-online-schema-change loses data when renaming columns
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
High
|
Brian Fraser |
Bug Description
root@server [db]> show create table simon\G
*******
Table: simon
Create Table: CREATE TABLE `simon` (
`id` int(11) NOT NULL,
`old_column_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
root@server [db]> select * from simon;
+----+-
| id | old_column_name |
+----+-
| 1 | old data |
| 2 | old data |
| 3 | old data |
+----+-
3 rows in set (0.00 sec)
root@server [db]> exit
Bye
[root@server ~]# pt-online-
Altering `db`.`simon`...
Creating new table...
Created new table db._simon_new OK.
Altering new table...
Altered `db`.`_simon_new` OK.
Creating triggers...
Created triggers OK.
Copying approximately 3 rows...
Copied rows OK.
Swapping tables...
Swapped original and new tables OK.
Dropping old table...
Dropped old table `db`.`_simon_old` OK.
Dropping triggers...
Dropped triggers OK.
Successfully altered `db`.`simon`.
[root@server ~]# mysql db
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16106
Server version: 5.5.16-log MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
root@server [db]> select * from simon;
+----+-
| id | new_column_name |
+----+-
| 1 | NULL |
| 2 | NULL |
| 3 | NULL |
+----+-
3 rows in set (0.01 sec)
root@server [db]>
Expected behaviour: new_column_name should contain "old data".
This behaviour IS dangerous and at least in the rpm: percona-
Related branches
- Brian Fraser (community): Approve
- Daniel Nichter: Approve
-
Diff: 730 lines (+589/-18) (has conflicts)5 files modifiedbin/pt-online-schema-change (+142/-17)
lib/Quoter.pm (+7/-1)
t/pt-online-schema-change/find_renamed_cols.t (+225/-0)
t/pt-online-schema-change/rename_columns.t (+204/-0)
t/pt-online-schema-change/samples/data-loss-bug-1068562.sql (+11/-0)
Changed in percona-toolkit: | |
assignee: | nobody → Brian Fraser (fraserbn) |
Changed in percona-toolkit: | |
status: | Triaged → In Progress |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Naturally, "it's not supposed to do that." Have you tried with 2.1.5? I'll look at this in any case...