Bug #59845 Abort in lock_rec_insert_check_and_lock for CREATE TABLE ... SELECT
Submitted: 31 Jan 2011 14:03 Modified: 17 Jul 2014 8:25
Reporter: Jørgen Løland Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.5+ OS:Any
Assigned to: Jimmy Yang CPU Architecture:Any

[31 Jan 2011 14:03] Jørgen Løland
Description:
The following abort was encountered when running RQG with the WL5004 grammar.

#7  0xb74b2932 in *__GI_abort () at abort.c:92
#8  0x085c0e82 in lock_rec_insert_check_and_lock (flags=0, rec=0xaed48063 "infimum", block=0xae83fd14, 
    index=0xaeab858, thr=0xaf2dbe0, mtr=0xa6d8f310, inherit=0xa6d8f218)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/lock/lock0lock.c:5027
#9  0x0854db32 in btr_cur_ins_lock_and_undo (flags=0, cursor=0xa6d8f29c, entry=0xabba9d0, thr=0xaf2dbe0, 
    mtr=0xa6d8f310, inherit=0xa6d8f218)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/btr/btr0cur.c:1092
#10 0x0854e0ac in btr_cur_optimistic_insert (flags=0, cursor=0xa6d8f29c, entry=0xabba9d0, rec=0xa6d8f304, 
    big_rec=0xa6d8f2f4, n_ext=0, thr=0xaf2dbe0, mtr=0xa6d8f310)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/btr/btr0cur.c:1298
#11 0x085f9474 in row_ins_index_entry_low (mode=2, index=0xaeab858, entry=0xabba9d0, n_ext=0, thr=0xaf2dbe0)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/row/row0ins.c:2091
#12 0x085f9759 in row_ins_index_entry (index=0xaeab858, entry=0xabba9d0, n_ext=0, foreign=1, thr=0xaf2dbe0)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/row/row0ins.c:2171
#13 0x085f9a97 in row_ins_index_entry_step (node=0xaf2d628, thr=0xaf2dbe0)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/row/row0ins.c:2256
#14 0x085f9d23 in row_ins (node=0xaf2d628, thr=0xaf2dbe0)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/row/row0ins.c:2388
#15 0x085f9fae in row_ins_step (thr=0xaf2dbe0)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/row/row0ins.c:2498
#16 0x08508a0f in row_insert_for_mysql (mysql_rec=0xab1b040 "\375\006", prebuilt=0xaf15b20)
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/row/row0mysql.c:1206
#17 0x084eb2d2 in ha_innobase::write_row (this=0xab1aee8, record=0xab1b040 "\375\006")
    at /mysql/mysql-5.5-runtime-rev3178/storage/innobase/handler/ha_innodb.cc:4964
#18 0x08379584 in handler::ha_write_row (this=0xab1aee8, buf=0xab1b040 "\375\006")
    at /mysql/mysql-5.5-runtime-rev3178/sql/handler.cc:4733
#19 0x081fa28e in write_record (thd=0xac495a8, table=0xad66a38, info=0xb07e018)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_insert.cc:1741
#20 0x081fe887 in select_insert::send_data (this=0xb07dff8, values=...)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_insert.cc:3439
#21 0x08258d91 in end_send (join=0xb07e088, join_tab=0x0, end_of_records=false)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_select.cc:12556
#22 0x082566be in do_select (join=0xb07e088, fields=0xac4ad48, table=0x0, procedure=0x0)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_select.cc:11385
#23 0x08241115 in JOIN::exec (this=0xb07e088)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_select.cc:2358
#24 0x08241802 in mysql_select (thd=0xac495a8, rref_pointer_array=0xac4adac, tables=0xac5a6a0, wild_num=0, 
    fields=..., conds=0xac5b948, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, 
    select_options=2416184064, result=0xb07dff8, unit=0xac4a87c, select_lex=0xac4acb4)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_select.cc:2560
#25 0x0823a7c8 in handle_select (thd=0xac495a8, lex=0xac4a818, result=0xb07dff8, setup_tables_done_option=0)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_select.cc:297
#26 0x082100da in mysql_execute_command (thd=0xac495a8)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_parse.cc:2474
#27 0x08218fb4 in mysql_parse (thd=0xac495a8, 
    rawbuf=0xac59eb0 "CREATE TABLE  testdb_N . t1_base2_N   AS SELECT   `col_int_key` , `col_int` , `pk`  FROM testdb_S . t1_base2_N  AS A WHERE testdb_S . f1_2_N  () = 1 AND `pk` = 3", length=161, parser_state=0xa6d90b90)
    at /mysql/mysql-5.5-runtime-rev3178/sql/sql_parse.cc:5528

------
(gdb) f 8
(gdb) l
5022		lock_mutex_enter_kernel();
5023	
5024		/* When inserting a record into an index, the table must be at
5025		least IX-locked or we must be building an index, in which case
5026		the table must be at least S-locked. */
5027		ut_ad(lock_table_has(trx, index->table, LOCK_IX)
5028		      || (*index->name == TEMP_INDEX_PREFIX
5029			  && lock_table_has(trx, index->table, LOCK_S)));
5030	
5031		lock = lock_rec_get_first(block, next_rec_heap_no);
(gdb) p index->name
$3 = 0xaeab8f0 "GEN_CLUST_INDEX"
(gdb) p index->table
$4 = (dict_table_t *) 0xadad160

How to repeat:
./runall.pl 
--mem 
--grammar=conf/runtime/WL5004_sql.yy 
--redefine=conf/runtime/WL5004_sql_redefine.yy 
--gendata=conf/runtime/WL5004_data.zz 
--basedir=<path_to_executable>
--queries=10M 
--duration=36000 
--threads=30 
--reporter=Deadlock,Backtrace,Shutdown 
--mysqld=--lock-wait-timeout=1
[31 Jan 2011 14:03] Jørgen Løland
Redefine file used when bug was encountered.

Attachment: WL5004_sql_redefine.yy (application/octet-stream, text), 3.34 KiB.