pt-osc segfaults on mysql alter errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
High
|
Frank Cizmich |
Bug Description
It would be useful to have the tool report more meaningful errors, like mysql does. Take the following two examples:
mysql> ALTER TABLE t2 ADD COLUMN created_at DATETIME DEFAULT now();
ERROR 1067 (42000): Invalid default value for 'created_at'
mysql> ALTER TABLE t2 ADD COLUMN created_at non_existent_
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'non_existent_
pt-osc, instead, silently fails with a strange "Bus error" line at the end:
shell> pt-online-
No slaves found. See --recursion-method if host bm-support01 has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_
Altering `test`.`t2`...
Creating new table...
Created new table test._t2_new OK.
Altering new table...
2015-04-21T21:08:38 Dropping new table...
2015-04-21T21:08:38 Dropped new table OK.
`test`.`t2` was not altered.
Bus error
shell> pt-online-
No slaves found. See --recursion-method if host bm-support01 has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_
Altering `test`.`t2`...
Creating new table...
Created new table test._t2_new OK.
Altering new table...
2015-04-21T21:10:00 Dropping new table...
2015-04-21T21:10:00 Dropped new table OK.
`test`.`t2` was not altered.
Bus error
Snippet from using PTDEBUG=1:
shell> PTDEBUG=1 pt-online-
[...]
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_
# pt_online_
# pt_online_
# pt_online_
Altering `test`.`t2`...
# CleanupTask:6170 6242 Created cleanup task CODE(0x1aca270)
# pt_online_
#
# Percona:
# Percona:
#
# TableParser:3119 6242 /*!40101 SET @OLD_SQL_MODE := @@SQL_MODE, @@SQL_MODE := '', @OLD_QUOTE := @@SQL_QUOTE_
# TableParser:3124 6242 DBI::db=
# TableParser:3128 6242 SHOW CREATE TABLE `test`.`t2`
# TableParser:3138 6242 /*!40101 SET @@SQL_MODE := @OLD_SQL_MODE, @@SQL_QUOTE_
Creating new table...
# pt_online_
# `id` int(11) NOT NULL AUTO_INCREMENT,
# PRIMARY KEY (`id`)
# ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
Created new table test._t2_new OK.
Altering new table...
# pt_online_
# CleanupTask:6178 6242 Calling cleanup task CODE(0x1aca270)
# pt_online_
# TableParser:3290 6242 Checking `test`.`_t2_new`
# TableParser:3294 6242 SHOW TABLES FROM `test` LIKE '\_t2\_new'
# TableParser:3308 6242 Table test _t2_new exists
# pt_online_
2015-04-21T21:14:21 Dropping new table...
# pt_online_
2015-04-21T21:14:21 Dropped new table OK.
# pt_online_
`test`.`t2` was not altered.
Bus error
More information on versions used, etc:
shell> pt-online-
pt-online-
mysql> SHOW VARIABLES LIKE '%version%';
+------
| Variable_name | Value |
+------
| innodb_version | 5.5.42-37.1 |
| protocol_version | 10 |
| slave_type_
| version | 5.5.42-37.1 |
| version_comment | Percona Server (GPL), Release 37.1, Revision 39acee0 |
| version_
| version_compile_os | Linux |
+------
7 rows in set (0.00 sec)
mysql> SHOW CREATE TABLE test.t2\G
*******
Table: t2
Create Table: CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
Changed in percona-toolkit: | |
status: | New → In Progress |
importance: | Undecided → High |
assignee: | nobody → Frank Cizmich (frank-cizmich) |
tags: | added: pt-online-schema-change |
Changed in percona-toolkit: | |
milestone: | none → 2.3.1 |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
milestone: | 2.3.1 → none |
Changed in percona-toolkit: | |
milestone: | none → 2.2.15 |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
summary: |
- pt-online-schema-change not reporting meaningful errors. + pt-online-schema-change not reporting meaningful errors due to + segfaulting on alter errors |
Attached a patch for this. The problem was a loop in the error handling routines.