Bug #74022 PARTITION BY with COMMENT leads to mysql server reboot in MySQL Cluster

Submitted: 22 Sep 2014 21:16 Modified: 27 Jan 2015 10:35
Reporter: Odis Yuck Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:5.6.19-ndb-7.3.6-cluster-gpl, 7.3.5 , 7.4.1 OS:Linux (didn't check other systems)
Assigned to: Lakshmi Narayanan Sreethar CPU Architecture:Any
Tags: MySQL Cluster, MYSQL SERVER

[22 Sep 2014 21:16] Odis Yuck
Description:
Queries containing COMMENT and PARTITION BY lead to reboot of server. 
Here are some examples:

mysql> create table test_bug(id int, PRIMARY KEY(id));
Query OK, 0 rows affected (0,24 sec)

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL PARTITION BY KEY(id);
Query OK, 0 rows affected (0,50 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test' PARTITION BY KEY(id);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    29
Current database: my_test

ERROR 1060 (42S21): Duplicate column name 'test1'
mysql> ALTER TABLE `test_bug` ADD `test2` int NULL,  COMMENT='test';
Query OK, 0 rows affected (0,65 sec)
Records: 0  Duplicates: 0  Warnings: 0

As you can see it works even when there is such column. 

How to repeat:
Just execute queries from description:

create table test_bug(id int, PRIMARY KEY(id));

ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test' PARTITION BY KEY(id);
[23 Sep 2014 8:48] MySQL Verification Team
Hello Odis Yuck,

Thank you for the bug report and test case.
Verified as described.

Thanks,
Umesh
[23 Sep 2014 8:49] MySQL Verification Team
// release build

mysql> show variables like '%version%';
+-------------------------+------------------------------------------------------+
| Variable_name           | Value                                                |
+-------------------------+------------------------------------------------------+
| innodb_version          | 5.6.19                                               |
| ndb_version             | 459526                                               |
| ndb_version_string      | ndb-7.3.6                                            |
| ndbinfo_version         | 459526                                               |
| protocol_version        | 10                                                   |
| slave_type_conversions  |                                                      |
| version                 | 5.6.19-ndb-7.3.6-cluster-commercial-advanced-log     |
| version_comment         | MySQL Cluster Server - Advanced Edition (Commercial) |
| version_compile_machine | x86_64                                               |
| version_compile_os      | linux-glibc2.5                                       |
+-------------------------+------------------------------------------------------+
10 rows in set (0.00 sec)

mysql> create table test_bug(id int, PRIMARY KEY(id))engine=ndb;
Query OK, 0 rows affected (0.92 sec)

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL PARTITION BY KEY(id);
Query OK, 0 rows affected (2.38 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test' PARTITION BY KEY(id);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> bin/mysqld_safe: line 166: 11851 Segmentation fault      (core dumped) nohup /data/ushastry/cluster/mysql-cluster-7.3.6/bin/mysqld --defaults-file=./my.cnf --basedir=/data/ushastry/cluster/mysql-cluster-7.3.6 --datadir=/tmp/mycluster --plugin-dir=/data/ushastry/cluster/mysql-cluster-7.3.6/lib/plugin --user=root --log-error=/tmp/mycluster/hostname.err --pid-file=/tmp/mycluster/hostname.pid --socket=/tmp/mysql.sock --port=3306 < /dev/null >> /tmp/mycluster/hostname.err 2>&1
140925 05:03:14 mysqld_safe Number of processes running now: 0
140925 05:03:14 mysqld_safe mysqld restarted

//
(gdb) bt
#0  0x0000003b3ba0c8ac in pthread_kill () from /lib64/libpthread.so.0
#1  0x000000000071646a in handle_fatal_signal (sig=11) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/signal_handler.cc:248
#2  <signal handler called>
#3  0x0000000000b955f0 in ha_ndbcluster::can_switch_engines (this=0x7f80a802fdf0) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/ha_ndb_ddl_fk.cc:1592
#4  0x00000000007e7339 in mysql_alter_table (thd=0x3965e60, new_db=0x7f80a80065d8 "test", new_name=0x0, create_info=0x7f80d5429430, table_list=0x7f80a8006078, alter_info=0x7f80d5429510,
    order_num=0, order=0x0, ignore=false) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/sql_table.cc:7963
#5  0x00000000008e82c9 in Sql_cmd_alter_table::execute (this=<value optimized out>, thd=0x3965e60)
    at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/sql_alter.cc:313
#6  0x0000000000798665 in mysql_execute_command (thd=0x3965e60) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/sql_parse.cc:4954
#7  0x000000000079c0c8 in mysql_parse (thd=0x3965e60, rawbuf=0x7f80a8005f10 "ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test' PARTITION BY KEY(id)", length=<value optimized out>,
    parser_state=<value optimized out>) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/sql_parse.cc:6254
#8  0x000000000079d4ab in dispatch_command (command=COM_QUERY, thd=0x3965e60, packet=<value optimized out>, packet_length=81)
    at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/sql_parse.cc:1334
#9  0x000000000079f2a7 in do_command (thd=0x3965e60) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/sql_parse.cc:1036
#10 0x00000000007670f6 in do_handle_one_connection (thd_arg=0x3965e60) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/sql_connect.cc:982
#11 0x00000000007671d5 in handle_one_connection (arg=0x3965e60) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/sql/sql_connect.cc:898
#12 0x0000000000cffc76 in pfs_spawn_thread (arg=<value optimized out>) at /export/home/pb2/build/sb_0-12598553-1404293478.57/mysql-cluster-com-7.3.6/storage/perfschema/pfs.cc:1860
#13 0x0000003b3ba079d1 in start_thread () from /lib64/libpthread.so.0
#14 0x0000003b3b6e8b5d in clone () from /lib64/libc.so.6
[23 Sep 2014 8:50] MySQL Verification Team
// Innodb table - Duplicate column name 'test1' instead of crash

mysql> create table test_bug(id int, PRIMARY KEY(id))engine=innodb;
Query OK, 0 rows affected (0.03 sec)

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL PARTITION BY KEY(id);
Query OK, 0 rows affected (0.06 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>  ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test' PARTITION BY KEY(id);
ERROR 1060 (42S21): Duplicate column name 'test1'
mysql>
mysql> show create table test_bug\G
*************************** 1. row ***************************
       Table: test_bug
Create Table: CREATE TABLE `test_bug` (
  `id` int(11) NOT NULL DEFAULT '0',
  `test1` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (id) */
1 row in set (0.00 sec)
[23 Sep 2014 10:14] MySQL Verification Team
// Thought to confirm if it is regression but seems 7.3.5 also affected

mysql> show variables like '%version%';
+-------------------------+------------------------------------------------------+
| Variable_name           | Value                                                |
+-------------------------+------------------------------------------------------+
| innodb_version          | 5.6.17                                               |
| ndb_version             | 459525                                               |
| ndb_version_string      | ndb-7.3.5                                            |
| ndbinfo_version         | 459525                                               |
| protocol_version        | 10                                                   |
| slave_type_conversions  |                                                      |
| version                 | 5.6.17-ndb-7.3.5-cluster-commercial-advanced-log     |
| version_comment         | MySQL Cluster Server - Advanced Edition (Commercial) |
| version_compile_machine | x86_64                                               |
| version_compile_os      | linux-glibc2.5                                       |
+-------------------------+------------------------------------------------------+
10 rows in set (0.00 sec)

mysql> create table test_bug(id int, PRIMARY KEY(id))engine=ndb;
ERROR 1046 (3D000): No database selected
mysql> use test
Database changed
mysql> create table test_bug(id int, PRIMARY KEY(id))engine=ndb;
Query OK, 0 rows affected (0.72 sec)

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL PARTITION BY KEY(id);
Query OK, 0 rows affected (1.45 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test' PARTITION BY KEY(id);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 140925 06:42:06 mysqld_safe Number of processes running now: 0
140925 06:42:06 mysqld_safe mysqld restarted
[23 Sep 2014 13:33] MySQL Verification Team
// 7.4.1

mysql> show variables like '%version%';
+-------------------------+--------------------------------------+
| Variable_name           | Value                                |
+-------------------------+--------------------------------------+
| innodb_version          | 5.6.20                               |
| ndb_version             | 459777                               |
| ndb_version_string      | ndb-7.4.1                            |
| ndbinfo_version         | 459777                               |
| protocol_version        | 10                                   |
| slave_type_conversions  |                                      |
| version                 | 5.6.20-ndb-7.4.1-cluster-gpl-log     |
| version_comment         | MySQL Cluster Community Server (GPL) |
| version_compile_machine | x86_64                               |
| version_compile_os      | linux-glibc2.5                       |
+-------------------------+--------------------------------------+
10 rows in set (0.00 sec)

mysql> create table test_bug(id int, PRIMARY KEY(id))engine=ndb;
ERROR 1046 (3D000): No database selected
mysql> use test
Database changed
mysql> create table test_bug(id int, PRIMARY KEY(id))engine=ndb;
Query OK, 0 rows affected (0.76 sec)

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL PARTITION BY KEY(id);
Query OK, 0 rows affected (1.57 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test' PARTITION BY KEY(id);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> bin/mysqld_safe: line 166: 14225 Segmentation fault      (core dumped) nohup /data/ushastry/cluster/mysql-cluster-gpl-7.4.1/bin/mysqld --defaults-file=./my.cnf --basedir=/data/ushastry/cluster/mysql-cluster-gpl-7.4.1 --datadir=/tmp/mycluster --plugin-dir=/data/ushastry/cluster/mysql-cluster-gpl-7.4.1/lib/plugin --user=root --log-error=/tmp/mycluster/hostname.err --pid-file=/tmp/mycluster/hostname.pid --socket=/tmp/mysql.sock --port=3306 < /dev/null >> /tmp/mycluster/hostname.err 2>&1
140925 10:01:04 mysqld_safe Number of processes running now: 0
140925 10:01:04 mysqld_safe mysqld restarted

//

(gdb) bt
#0  0x0000003b3ba0c8ac in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000006e7aca in handle_fatal_signal (sig=11) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/signal_handler.cc:230
#2  <signal handler called>
#3  0x0000000000bda1d0 in ha_ndbcluster::can_switch_engines (this=0x7f3e8802ccf0) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/ha_ndb_ddl_fk.cc:1592
#4  0x00000000007b6ff8 in mysql_alter_table (thd=0x258d0b0, new_db=0x7f3e88006608 "test", new_name=0x0, create_info=0x7f3e93ffd430, table_list=0x7f3e880060a8, alter_info=0x7f3e93ffd510,
    order_num=0, order=0x0, ignore=false) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/sql_table.cc:8039
#5  0x00000000008b9f89 in Sql_cmd_alter_table::execute (this=<value optimized out>, thd=0x258d0b0)
    at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/sql_alter.cc:313
#6  0x0000000000769b85 in mysql_execute_command (thd=0x258d0b0) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/sql_parse.cc:4954
#7  0x000000000076d5e8 in mysql_parse (thd=0x258d0b0, rawbuf=0x7f3e88005f40 "ALTER TABLE `test_bug` ADD `test1` int NULL,  COMMENT='test' PARTITION BY KEY(id)", length=<value optimized out>,
    parser_state=<value optimized out>) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/sql_parse.cc:6254
#8  0x000000000076e9cb in dispatch_command (command=COM_QUERY, thd=0x258d0b0, packet=<value optimized out>, packet_length=81)
    at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/sql_parse.cc:1334
#9  0x00000000007707c7 in do_command (thd=0x258d0b0) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/sql_parse.cc:1036
#10 0x0000000000738566 in do_handle_one_connection (thd_arg=0x258d0b0) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/sql_connect.cc:982
#11 0x0000000000738645 in handle_one_connection (arg=0x258d0b0) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/sql/sql_connect.cc:898
#12 0x00000000009f64e6 in pfs_spawn_thread (arg=<value optimized out>) at /export/home/pb2/build/sb_0-13239046-1410989929.25/mysql-cluster-gpl-7.4.1/storage/perfschema/pfs.cc:1860
#13 0x0000003b3ba079d1 in start_thread () from /lib64/libpthread.so.0
#14 0x0000003b3b6e8b5d in clone () from /lib64/libc.so.6
[27 Jan 2015 10:35] Jon Stephens
Documented fix in the NDB 7.3.9 and 7.4.4 changelogs, as follows:

    An ALTER TABLE statement containing comments and a partitioning
    option against an NDB table caused the SQL node on which it was
    executed to fail.

Closed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.061 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.