Bug #34089 Maria crash on LOAD INDEX after FLUSH TABLES
Submitted: 27 Jan 2008 13:34 Modified: 4 Mar 2008 17:08
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S1 (Critical)
Version:5.1.23-maria OS:Any
Assigned to: Guilhem Bichot CPU Architecture:Any

[27 Jan 2008 13:34] Philip Stoev
Description:
Executing LOAD INDEX after FLUSH TABLES on a Maria table that contains thousands of rows causes a crash.

Backtrace is:

#0  0x00dff402 in __kernel_vsyscall ()
#1  0x009dcf57 in pthread_kill () from /lib/libpthread.so.0
#2  0x083db2fc in write_core (sig=11) at stacktrace.c:240
#3  0x0824a7e8 in handle_segfault (sig=11) at mysqld.cc:2298
#4  <signal handler called>
#5  0x008b95c3 in strlen () from /lib/libc.so.6
#6  0x0088a899 in vfprintf () from /lib/libc.so.6
#7  0x0088b052 in buffered_vfprintf () from /lib/libc.so.6
#8  0x00886fbf in vfprintf () from /lib/libc.so.6
#9  0x00890002 in fprintf () from /lib/libc.so.6
#10 0x08610ab3 in _checkchunk (irem=0x8ef29f0, filename=0x87c82ee "ma_preload.c", lineno=99) at safemalloc.c:471
#11 0x08610c87 in _sanity (filename=0x87c82ee "ma_preload.c", lineno=99) at safemalloc.c:516
#12 0x08610391 in _myfree (ptr=0x8ef6520, filename=0x87c82ee "ma_preload.c", lineno=99, myflags=0) at safemalloc.c:264
#13 0x085dc67c in maria_preload (info=0x8ec6160, key_map=3, ignore_leaves=0 '\0') at ma_preload.c:99
#14 0x08553814 in ha_maria::preload_keys (this=0x8eb09f8, thd=0x8e91198, check_opt=0x0) at ha_maria.cc:1494
#15 0x0838cc67 in mysql_admin_table (thd=0x8e91198, tables=0x8ee3568, check_opt=0x0, operator_name=0x877252f "preload_keys", lock_type=TL_READ_NO_INSERT,
    open_for_modify=false, no_warnings_for_error=false, extra_open_options=0, prepare_func=0, operator_func=<error reading variable>, view_operator_func=0)
    at sql_table.cc:4266
#16 0x0838dadd in mysql_preload_keys (thd=0x8e91198, tables=0x8ee3568) at sql_table.cc:4625
#17 0x0825b754 in mysql_execute_command (thd=0x8e91198) at sql_parse.cc:2231
#18 0x08263ab6 in mysql_parse (thd=0x8e91198, inBuf=0x8ee34b0 "load index into cache t1", length=24, found_semicolon=0xb69d426c) at sql_parse.cc:5631
#19 0x08264693 in dispatch_command (command=COM_QUERY, thd=0x8e91198, packet=0x8ed45f1 "", packet_length=24) at sql_parse.cc:1129
#20 0x0826582e in do_command (thd=0x8e91198) at sql_parse.cc:789
#21 0x0825322c in handle_one_connection (arg=0x8e91198) at sql_connect.cc:1120
#22 0x009d82fb in start_thread () from /lib/libpthread.so.0
#23 0x0091b93e in clone () from /lib/libc.so.6

How to repeat:
create table t1 (
  a int not null auto_increment,
  b char(16) not null,
  primary key (a),
  key (b)
) engine=Maria;

create table t2(
  a int not null auto_increment,
  b char(16) not null,
  primary key (a),
  key (b)
) engine=Maria;

insert into t1(b) values ('test0'), ('test1'), ('test2'), ('test3'), ('test4'), ('test5'), ('test6'), ('test7');

insert into t2(b) select b from t1;
insert into t1(b) select b from t2;
insert into t2(b) select b from t1;
insert into t1(b) select b from t2;
insert into t2(b) select b from t1;
insert into t1(b) select b from t2;
insert into t2(b) select b from t1;
insert into t1(b) select b from t2;
insert into t2(b) select b from t1;
insert into t1(b) select b from t2;
insert into t2(b) select b from t1;
insert into t1(b) select b from t2;

flush tables;
load index into cache t1;
[27 Jan 2008 13:50] Guilhem Bichot
Soon Monty will disable LOAD INDEX for Maria (it was planned already)
[4 Feb 2008 9:25] Guilhem Bichot
Monty disabled LOAD INDEX in Maria and is now working on making it work (and then re-enabling it).
[8 Feb 2008 16:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41951

ChangeSet@1.2578, 2008-02-08 17:51:41+01:00, guilhem@gbichot4.local +2 -0
  BUG#34089 "Maria crash on LOAD INDEX after FLUSH TABLES"
  a typo had not disable LOAD INDEX for Maria.
  BUG#34161 "freeing maria tmp table after fetching rows using prepared statements - crashes"
  running the testcase I was not able to repeat the same crash but
  found a misplaced assertion giving false positive, fixed here.
[27 Feb 2008 17:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43087

ChangeSet@1.2617, 2008-02-27 18:19:20+01:00, guilhem@gbichot4.local +5 -0
  Fix for BUG#34089 "Maria crash on LOAD INDEX after FLUSH TABLES".
[4 Mar 2008 11:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43364

ChangeSet@1.2617, 2008-03-04 12:47:02+01:00, guilhem@gbichot4.local +5 -0
  Fix for BUG#34089 "Maria crash on LOAD INDEX after FLUSH TABLES".
[4 Mar 2008 17:08] Guilhem Bichot
LOAD INDEX is now functional in Maria, not disabled anymore.