Details
-
Bug
-
Status: Done
-
High
-
Resolution: Fixed
-
3.2.1
-
None
-
Yes
-
Yes
-
3
Description
Launchpad: https://bugs.launchpad.net/percona-toolkit/+bug/1697915
Hello.
Today I altered one of my tables (users) with pt-online-schema-change
One table(user_comments) of my database had a foreign key (refer) to users table.
I changed id column from int to bigint
But at the end when it wanted to rename new table to original table, this message was displayed:
Error updating foreign key constraints: 2017-06-14T10:17:41 DBD::mysql::db do failed: Error on rename of './myblog/_users_new' to './myblog/users' (errno: 150 "Foreign key constraint is incorrectly formed") [for Statement "RENAME TABLE `myblog`.`_users_new` TO `myblog`.`users`"] at /usr/bin/pt-online-schema-change line 10700.
I know what is this, and I know firstly I must alter user_comments table or remove Foreign key before alter users table, but I think pt-online-schema-change has bug because it should be kept up new table.
It was full command:
pt-online-schema-change -uxxxx -pxxxx --max-load "Threads_running=400" --set-vars=foreign_key_checks=0 --alter-foreign-keys-method=auto --no-check-alter --critical-load="Threads_running=200" --alter="CHANGE COLUMN id id BIGINT UNSIGNED NOT NULL FIRST" D=myblog,t=users --execute
Before running osc:
mysql> show tables in test; +----------------+ | Tables_in_test | +----------------+ | user_comments | | users | +----------------+ 2 rows in set (0.00 sec)
After getting the error:
mysql> show tables in test; +----------------+ | Tables_in_test | +----------------+ | user_comments | +----------------+ 1 row in set (0.00 sec)
MariaDB Version: mariadb-galera-10.0.30
pt-online-schema-change Version: 3.0.3
See attached program to load sample data
Attachments
Issue Links
- is duplicated by
-
PT-735 LP #1697915: pt-online-schema-change remove the old and new table
-
- Done
-