Bug #74869 handle_fatal_signal (sig=11) in ha_partition::handle_opt_partitions
Submitted: 14 Nov 2014 16:23 Modified: 10 Mar 2015 17:45
Reporter: Ramesh Sivaraman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.6.20 OS:Linux (CentOS 7)
Assigned to: CPU Architecture:Any
Tags: debug

[14 Nov 2014 16:23] Ramesh Sivaraman
Description:
#0  0x00007fdd3b877771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000a9035e in my_write_core (sig=11) at /ssd/ramesh/mysql-server/mysql-5.6/mysys/stacktrace.c:422
#2  0x0000000000723688 in handle_fatal_signal (sig=11) at /ssd/ramesh/mysql-server/mysql-5.6/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x0000000000e03b9d in ha_partition::handle_opt_partitions (this=0x7fdc9e4a7010, thd=0x7fdca8324000, check_opt=0x0, flag=6) at /ssd/ramesh/mysql-server/mysql-5.6/sql/ha_partition.cc:1391
#5  0x0000000000e031c7 in ha_partition::preload_keys (this=0x7fdc9e4a7010, thd=0x7fdca8324000, check_opt=0x0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/ha_partition.cc:1167
#6  0x000000000097e965 in mysql_admin_table(THD *, TABLE_LIST *, HA_CHECK_OPT *, const char *, thr_lock_type, bool, bool, uint, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *), struct {...}, int (*)(THD *, TABLE_LIST *)) (thd=0x7fdca8324000, tables=0x7fdc9e41f1a0, check_opt=0x0, operator_name=0xf901fb "preload_keys", lock_type=TL_READ_NO_INSERT, open_for_modify=false, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=&virtual table offset 520, view_operator_func=0x0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_admin.cc:654
#7  0x000000000097ff9f in mysql_preload_keys (thd=0x7fdca8324000, tables=0x7fdc9e41f1a0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_admin.cc:1057
#8  0x00000000007cfb1b in mysql_execute_command (thd=0x7fdca8324000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:2788
#9  0x00000000007d8fa4 in mysql_parse (thd=0x7fdca8324000, rawbuf=0x7fdc9e41f010 "LOAD INDEX INTO CACHE t1 INDEX(PRIMARY,b)IGNORE LEAVES", length=54, parser_state=0x7fdd3be6ee70) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:6245
#10 0x00000000007cc557 in dispatch_command (command=COM_QUERY, thd=0x7fdca8324000, packet=0x7fdca8362001 "", packet_length=54) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1332
#11 0x00000000007cb646 in do_command (thd=0x7fdca8324000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1034
#12 0x0000000000793a61 in do_handle_one_connection (thd_arg=0x7fdca8324000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:982
#13 0x000000000079354a in handle_one_connection (arg=0x7fdca8324000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:898
#14 0x0000000000ad4b5c in pfs_spawn_thread (arg=0x7fdd37bfeb00) at /ssd/ramesh/mysql-server/mysql-5.6/storage/perfschema/pfs.cc:1860
#15 0x00007fdd3b872df3 in start_thread () from /lib64/libpthread.so.0
#16 0x00007fdd3a74401d in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
create TABLE t1(a INT unsigned)partition by range (a) (partition p0 values less than (1),partition p1 values less than MAXVALUE);
lock TABLE t1 write;
ALTER TABLE t1 REORGANIZE PARTITION p0 INTO(PARTITION s0 VALUES LESS THAN (1),PARTITION s1 VALUES LESS THAN (1));
LOAD INDEX INTO CACHE t1 INDEX(PRIMARY,b)IGNORE LEAVES;
[14 Nov 2014 16:41] MySQL Verification Team
C:\dbs>net start mysqld57
The MySQLD57 service is starting...
The MySQLD57 service was started successfully.

C:\dbs>57

C:\dbs>c:\dbs\5.7\bin\mysql -uroot --port=3570 --prompt="mysql 5.7 > "
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.6-m16-debug Source distribution

Copyright (c) 2000, 2014, 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.

mysql 5.7 > DROP DATABASE test;CREATE DATABASE test;USE test;
Query OK, 2 rows affected (0.72 sec)

Query OK, 1 row affected (0.02 sec)

Database changed
mysql 5.7 > create TABLE t1(a INT unsigned)partition by range (a) (partition p0 values less than (1),partition p1 values less than MAXVALUE)
;
Query OK, 0 rows affected (0.59 sec)

mysql 5.7 > lock TABLE t1 write;
Query OK, 0 rows affected (0.00 sec)

mysql 5.7 > ALTER TABLE t1 REORGANIZE PARTITION p0 INTO(PARTITION s0 VALUES LESS THAN (1),PARTITION s1 VALUES LESS THAN (1));
ERROR 1493 (HY000): VALUES LESS THAN value must be strictly increasing for each partition
mysql 5.7 > LOAD INDEX INTO CACHE t1 INDEX(PRIMARY,b)IGNORE LEAVES;
ERROR 2013 (HY000): Lost connection to MySQL server during query
[14 Nov 2014 16:52] MySQL Verification Team
Thank you for the bug report.

14038c748    mysqld.exe!ha_partition::handle_opt_partitions()[ha_partition.cc:1446]
14038db02    mysqld.exe!ha_partition::preload_keys()[ha_partition.cc:1199]
13fb9be5d    mysqld.exe!mysql_admin_table()[sql_admin.cc:663]
13fb99556    mysqld.exe!mysql_preload_keys()[sql_admin.cc:1084]
13f746101    mysqld.exe!mysql_execute_command()[sql_parse.cc:2633]
13f74450a    mysqld.exe!mysql_parse()[sql_parse.cc:5397]
13f74def8    mysqld.exe!dispatch_command()[sql_parse.cc:1252]
13f74d09c    mysqld.exe!do_command()[sql_parse.cc:833]
13f5c0c3c    mysqld.exe!handle_connection()[connection_handler_per_thread.cc:298]
1403127b8    mysqld.exe!pfs_spawn_thread()[pfs.cc:2139]
13fd7eca6    mysqld.exe!pthread_start()[my_winthread.c:73]
1404803a5    mysqld.exe!_callthreadstartex()[threadex.c:376]
1404805f7    mysqld.exe!_threadstartex()[threadex.c:359]
773659ed    kernel32.dll!BaseThreadInitThunk()
7749c541    ntdll.dll!RtlUserThreadStart()
[23 Feb 2015 9:11] Mattias Jonsson
Posted by developer:
 
Base bug fixed and pushed which also fixes this bug and included the test case from here.
[10 Mar 2015 17:45] Jon Stephens
Documented fix in the 5.6.24 and 5.7.7 changelog as follows:

        A number of ALTER TABLE statements that attempted to add a
        partition, column, or index to a partitioned table while a write
        lock was in effect for this table were not handled correctly.

This also fixes BUG#74451, BUG#74478, BUG#74491, BUG#74560, BUG#74746, BUG#74841, and BUG#74860.

Closed.
[16 Mar 2015 12:37] Daniel Price
Posted by developer:
 
The base bug under which this bug is fixed (Bug #19856162 / MySQL Bug #74451) is also fixed in trunk (5.8.0). The changelog entry has been updated to include the 5.8.0 version number.