Bug #76542 Assertion `!auto_increment_lock && !auto_increment_safe_stmt_log_lock' failed
Submitted: 31 Mar 2015 8:53 Modified: 31 Mar 2015 12:12
Reporter: Ramesh Sivaraman Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:5.1, 5.5, 5.6, OS:Any (CentOS 7)
Assigned to: CPU Architecture:Any
Tags: auto_increment, debug

[31 Mar 2015 8:53] Ramesh Sivaraman
Description:
#0  0x00007f22ee28d771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000a965ee in my_write_core (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/mysys/stacktrace.c:422
#2  0x0000000000726728 in handle_fatal_signal (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007f22ed0995c9 in raise () from /lib64/libc.so.6
#5  0x00007f22ed09acd8 in abort () from /lib64/libc.so.6
#6  0x00007f22ed092536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f22ed0925e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000e126c7 in ha_partition::external_lock (this=0x7f22ec418b10, thd=0x7f22ddbf0000, lock_type=2) at /ssd/ramesh/mysql-server/mysql-5.6/sql/ha_partition.cc:3602
#9  0x00000000006447ba in handler::ha_external_lock (this=0x7f22ec418b10, thd=0x7f22ddbf0000, lock_type=2) at /ssd/ramesh/mysql-server/mysql-5.6/sql/handler.cc:7190
#10 0x0000000000847962 in copy_data_between_tables (from=0x7f22cec53400, to=0x7f22ced5fe00, create=..., ignore=false, order_num=0, order=0x0, copied=0x7f22ee842330, deleted=0x7f22ee842328, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f22ee841850) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_table.cc:9088
#11 0x0000000000846005 in mysql_alter_table (thd=0x7f22ddbf0000, new_db=0x7f22cec1f680 "test", new_name=0x0, create_info=0x7f22ee8426e0, table_list=0x7f22cec1f120, alter_info=0x7f22ee842650, order_num=0, order=0x0, ignore=false) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_table.cc:8540
#12 0x00000000009851c3 in Sql_cmd_alter_table::execute (this=0x7f22cec1f750, thd=0x7f22ddbf0000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_alter.cc:313
#13 0x00000000007d8f7c in mysql_execute_command (thd=0x7f22ddbf0000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:4945
#14 0x00000000007dc4be in mysql_parse (thd=0x7f22ddbf0000, rawbuf=0x7f22cec1f010 "alter TABLE t1 change b b int auto_increment", length=44, parser_state=0x7f22ee843e70) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:6357
#15 0x00000000007cf630 in dispatch_command (command=COM_QUERY, thd=0x7f22ddbf0000, packet=0x7f22d6ff0001 "alter TABLE t1 change b b int auto_increment", packet_length=44) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1332
#16 0x00000000007ce71f in do_command (thd=0x7f22ddbf0000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1034
#17 0x0000000000796b09 in do_handle_one_connection (thd_arg=0x7f22ddbf0000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:982
#18 0x00000000007965f2 in handle_one_connection (arg=0x7f22ddbf0000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:898
#19 0x0000000000adae74 in pfs_spawn_thread (arg=0x7f22e8bfdde0) at /ssd/ramesh/mysql-server/mysql-5.6/storage/perfschema/pfs.cc:1860
#20 0x00007f22ee288df3 in start_thread () from /lib64/libpthread.so.0
#21 0x00007f22ed15a1ad in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
create TABLE t1(a int,b int,c int,primary key (a,b)) ENGINE=INNODB partition by list (a) (partition part0 values in (0,1,2),partition part1 values in (3,4,5));
alter TABLE t1 engine=heap remove partitioning;
insert into t1 values(1,2,3);
ALTER TABLE t1 CHANGE COLUMN a a CHAR(100);
INSERT INTO t1(a)VALUES ('aaa_'),('ccc_'),('cch_');
insert INTO t1(a)values ('�'),('oc'),('�a'),('oe'),('od'),('�c'),('oeb');
DELETE FROM t1 LIMIT 10;
alter table t1 add key b(b);
insert into t1 set c=concat(repeat(0,24),0);
alter TABLE t1 engine=heap partition by key(a)(partition p0,partition p1);
UPDATE t1 SET a=20000101112233,b=20000101112233;
SET SQL_MODE="TRADITIONAL,ANSI";
alter TABLE t1 change b b int auto_increment;

The attached tarball gives the testcase as an exact match of our system,
including some handy utilities

$ vi {epoch}_mybase # Update base path in this file (the only change
required!). For non-binary distribution please update SOURCE_DIR
location also.
$ ./{epoch}_init # Initializes the data dir
$ ./{epoch}_start # Starts mysqld
$ ./{epoch}_cl # To check mysqld is up
$ ./{epoch}_run # Run the testcase with pquery binary(produces
output)
$ vi /dev/shm/{epoch}/error.log.out # Verify the error log
$ ./{epoch}_gdb # Brings you to a gdb prompt attached to correct
mysqld
& generated core
$ ./{epoch}_parse_core # Create {epoch}_STD.gdb and {epoch}_FULL.gdb;
standard and full var gdb stack traces
etc.
[31 Mar 2015 8:55] Ramesh Sivaraman
Testcase bundle

Attachment: 1427790803_bug_bundle.tar.gz (application/gzip, text), 1014.12 KiB.

[31 Mar 2015 12:12] MySQL Verification Team
Thanks for the report.
Affects debug builds of 5.1, 5.5, 5.6,
Does not affect 5.7, 5.8.

Version: '5.6.25-debug-log'  MySQL Community Server (GPL)
Assertion failed: !auto_increment_lock && !auto_increment_safe_stmt_log_lock, file ..\..\sql\ha_partition.cc, line 3602

mysqld-debug.exe!my_sigabrt_handler()[my_thr_init.c:458]
mysqld-debug.exe!raise()[winsig.c:594]
mysqld-debug.exe!abort()[abort.c:82]
mysqld-debug.exe!_wassert()[assert.c:156]
mysqld-debug.exe!ha_partition::external_lock()[ha_partition.cc:3602]
mysqld-debug.exe!handler::ha_external_lock()[handler.cc:7191]
mysqld-debug.exe!copy_data_between_tables()[sql_table.cc:9116]
mysqld-debug.exe!mysql_alter_table()[sql_table.cc:8568]
mysqld-debug.exe!Sql_cmd_alter_table::execute()[sql_alter.cc:313]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:4981]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:6391]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1343]
mysqld-debug.exe!do_command()[sql_parse.cc:1037]
mysqld-debug.exe!do_handle_one_connection()[sql_connect.cc:982]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:899]
mysqld-debug.exe!pfs_spawn_thread()[pfs.cc:1862]
mysqld-debug.exe!pthread_start()[my_winthread.c:62]
mysqld-debug.exe!_callthreadstartex()[threadex.c:376]
mysqld-debug.exe!_threadstartex()[threadex.c:359]

------------
Testcase
------------
Start debug build with --log-bin --server-id=1 then run this:

------
set sql_mode="";
drop table if exists t1;
create table t1(a int,b int,c int,unique(a,b),key(b)) engine=innodb;
alter table t1 change column a a char(100);
insert into t1(a,b,c) values (0x3230303030313031313132323333,2147483647,null);
insert into t1(a,b,c) values ('',null,null);
alter table t1 engine=heap partition by key(a)(partition z);
select hex(a),b,c from t1;
set sql_mode="strict_all_tables";
alter table t1 modify b int auto_increment;
-----
[25 Jul 2017 12:32] Martha Simons
some

Attachment: scam2.pdf (application/pdf, text), 35.68 KiB.