Bug #40425 Maria: ha_maria::enable_indexes(uint): Assertion `0' failed.
Submitted: 30 Oct 2008 11:50 Modified: 17 Dec 2008 10:30
Reporter: Philip Stoev Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S1 (Critical)
Version:6.0 OS:Any
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[30 Oct 2008 11:50] Philip Stoev
Description:
When executing a concurrent workload containing INSERT ... SELECT and TRUNCATE, maria asserts as follows:

081030 14:45:00 [Warning] Warning: Enabling keys got errno 0 on test.CCC, retrying
mysqld: ha_maria.cc:1609: virtual int ha_maria::enable_indexes(uint): Assertion `0' failed.

#8  0x003df57e in __assert_fail () from /lib/libc.so.6
#9  0x0872a424 in ha_maria::enable_indexes (this=0xb751a270, mode=2) at ha_maria.cc:1609
#10 0x08726774 in ha_maria::end_bulk_insert (this=0xb751a270, table_will_be_deleted=false) at ha_maria.cc:1771
#11 0x0835f2c1 in handler::ha_end_bulk_insert (this=0xb751a270, abort=false) at handler.h:1558
#12 0x083579e3 in select_insert::send_eof (this=0xae8f7a0) at sql_insert.cc:3230
#13 0x08340f5c in do_select (join=0xb7508cb8, fields=0xb750a200, table=0x0, procedure=0x0) at sql_select.cc:13497
#14 0x08354000 in JOIN::exec (this=0xb7508cb8) at sql_select.cc:2829
#15 0x0834ee0c in mysql_select (thd=0xae34910, rref_pointer_array=0xae35e6c, tables=0xae8f098, wild_num=0, fields=@0xae35dfc, conds=0xae8f648, og_num=0,
    order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489942016, result=0xae8f7a0, unit=0xae35ad0, select_lex=0xae35d68)
    at sql_select.cc:3019
#16 0x08354310 in handle_select (thd=0xae34910, lex=0xae35a74, result=0xae8f7a0, setup_tables_done_option=1073741824) at sql_select.cc:301
#17 0x082c9c55 in mysql_execute_command (thd=0xae34910) at sql_parse.cc:3063
#18 0x082cf281 in mysql_parse (thd=0xae34910,
    inBuf=0xae8e7e0 "INSERT INTO `CCC` ( `time_nokey` ) SELECT COUNT( `datetime_nokey` ) FROM `E` WHERE `varchar_nokey` < '12:05:11'  LIMIT 1", length=120,
    found_semicolon=0xb20c7e70) at sql_parse.cc:5634
#19 0x082cfcce in dispatch_command (command=COM_QUERY, thd=0xae34910,
    packet=0xae86781 "INSERT INTO `CCC` ( `time_nokey` ) SELECT COUNT( `datetime_nokey` ) FROM `E` WHERE `varchar_nokey` < '12:05:11'  LIMIT 1",
    packet_length=120) at sql_parse.cc:1009
---Type <return> to continue, or q <return> to quit---
#20 0x082d0feb in do_command (thd=0xae34910) at sql_parse.cc:689
#21 0x082bf70b in handle_one_connection (arg=0xae34910) at sql_connect.cc:1156
#22 0x0057d32f in start_thread () from /lib/libpthread.so.0
#23 0x0049a27e in clone () from /lib/libc.so.6

How to repeat:
Grammar for the random query generator:

query:
        truncate | insert_select ;

select:
        SELECT select_item FROM _table where order_by limit;

select_item:
        _field | COUNT( _field ) | COUNT( * ) | MIN( _field ) ;

where:
        |
        WHERE _field < value |
        WHERE _field > value |
        WHERE _field = value ;

order_by:
        | ORDER BY X . _field ;

limit:
        LIMIT digit ;

insert_select:
        INSERT INTO _table ( _field ) select ;

value:
        _english | _digit | _date | _datetime | _time ;

truncate:
        TRUNCATE TABLE _table ;

To run:

$ perl runall.pl \
  --basedir=/build/bzr/mysql-6.0 \
  --engine=Maria \
  --grammar=maria_bug.yy \
  --mysqld=--log-output=file \
  --mysqld=--skip-safemalloc \
  --threads=10 --mysqld=--skip-falcon
[17 Dec 2008 10:30] Oleksandr Byelkin
I tried to repeat it many hours but failed on the modern tree.

If you find it happening again feel free to reopen this bug.