CREATE TABLE x LIKE some_federated_table crashes the server
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Server |
Unknown
|
Unknown
|
|||
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
High
|
Unassigned | ||
5.5 |
Fix Released
|
High
|
Unassigned | ||
5.6 |
Fix Released
|
High
|
Unassigned |
Bug Description
The docs state that FEDERATED tables "does not support ALTER TABLE, or any Data Definition Language statements that directly affect the structure of the table, other than DROP TABLE. "... seems this includes CREATE TABLE...LIKE, which results in this stack trace:
Thread pointer: 0x1fd22b950
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7eb37c967c88 thread_stack 0x40000
/usr/sbin/
/usr/sbin/
/lib64/
/usr/sbin/
/usr/sbin/
/usr/sbin/
/usr/sbin/
/usr/sbin/
/usr/sbin/
/usr/sbin/
/usr/sbin/
/lib64/
/lib64/
To reproduce:
On "server1" I created a real table and added few records:
mysql> use test;
Database changed
mysql> CREATE TABLE `paypal_ipns` (
-> `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
-> `account_id` varchar(25) NOT NULL,
-> `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
-> `ipn` text,
-> PRIMARY KEY (`id`),
-> KEY `account_id` (`account_id`),
-> KEY `date` (`date`),
-> KEY `account_by_date` (`account_
-> ) ENGINE=myisam;
Query OK, 0 rows affected (0.05 sec)
mysql> insert into paypal_ipns values ();
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> insert into paypal_ipns values ();
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> insert into paypal_ipns values ();
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> insert into paypal_ipns values ();
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> select @@port, @@version;
+------
| @@port | @@version |
+------
| 5621 | 5.6.21-70.1 |
+------
1 row in set (0.00 sec)
Then on Server2 I run these:
)
mysql [localhost] {msandbox} (test) > DROP TABLE if exists paypal_ipns;
Query OK, 0 rows affected (0.00 sec)
mysql [localhost] {msandbox} (test) > CREATE TABLE `paypal_ipns` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `account_id` varchar(25) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `ipn` text, PRIMARY KEY (`id`), KEY `account_id` (`account_id`), KEY `date` (`date`), KEY `account_by_date` (`account_
Query OK, 0 rows affected (0.03 sec)
mysql [localhost] {msandbox} (test) > create table paypal_ooops like paypal_ipns;
ERROR 2013 (HY000): Lost connection to MySQL server during query
Funny enough, if we issue a SELECT on the FEDERATED table before we attempt the CREATE TABLE...LIKE, then it will throw an error instead of crashing (which is the expected behavior):
mysql [localhost] {msandbox} (test) > DROP TABLE if exists paypal_ipns;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE TABLE `paypal_ipns` (
-> `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
-> `account_id` varchar(25) NOT NULL,
-> `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
-> `ipn` text,
-> PRIMARY KEY (`id`),
-> KEY `account_id` (`account_id`),
-> KEY `date` (`date`),
-> KEY `account_by_date` (`account_
-> ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION=
Query OK, 0 rows affected (0.00 sec)
mysql> select * from paypal_ipns;
+----+-
| id | account_id | date | ipn |
+----+-
| 1 | | 2015-03-24 19:56:03 | NULL |
| 2 | | 2015-03-24 19:56:03 | NULL |
| 3 | | 2015-03-24 19:56:04 | NULL |
| 4 | | 2015-03-24 19:56:05 | NULL |
+----+-
4 rows in set (0.02 sec)
But here you can see it fails with different error, and I don't see any crash on the server:
mysql> create table paypal_ipns_oops like paypal_ipns;
ERROR 1432 (HY000): server name: '' doesn't exist!
Changed in percona-server: | |
assignee: | nobody → Muhammad Irfan (muhammad-irfan) |
tags: | added: upstream |
affects 5.5 and 5.6