Bug #12395 Crash in close_scan
Submitted: 5 Aug 2005 9:58 Modified: 11 Aug 2005 13:35
Reporter: Martin Skold Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:5.0 OS:Linux (Linux RH9)
Assigned to: CPU Architecture:Any

[5 Aug 2005 9:58] Martin Skold
Description:
Get crash in close_scan in query
select t1.pk from t1 use index (I1), t2 use index (I2) where t1.A = t2.B;
(gdb) where
#0  0x4012b671 in kill () from /lib/i686/libc.so.6
#1  0x40056afd in pthread_kill () from /lib/i686/libpthread.so.0
#2  0x0832bc0e in write_core (sig=11) at stacktrace.c:220
#3  0x081d28d8 in handle_segfault (sig=11) at mysqld.cc:2035
#4  0x4005967e in __pthread_sighandler () from /lib/i686/libpthread.so.0
#5  <signal handler called>
#6  0x084bbbb5 in NdbScanOperation::close(bool, bool) (this=0x8f1e660, forceSend=8, releaseOp=90)
    at NdbScanOperation.cpp:679
#7  0x082cd5be in ha_ndbcluster::close_scan() (this=0x8f1e660) at ha_ndbcluster.cc:2719
#8  0x082cc9cc in ha_ndbcluster::index_end() (this=0x8f1e660) at ha_ndbcluster.cc:2455
#9  0x081425ce in handler::ha_index_end() (this=0x8f1e660) at handler.h:555
#10 0x0814241d in handler::ha_index_or_rnd_end() (this=0x8f1e660) at handler.h:574
#11 0x082337bd in st_join_table::cleanup() (this=0x8eee3d8) at sql_select.cc:5957
#12 0x08233ac2 in JOIN::cleanup(bool) (this=0x8eecf90, full=true) at sql_select.cc:6043
#13 0x0823386f in JOIN::join_free(bool) (this=0x8eecf90, full=true) at sql_select.cc:5980
#14 0x0823a7a4 in do_select (join=0x8eecf90, fields=0x8ecf2b8, table=0x0, procedure=0x0)
    at sql_select.cc:9158
#15 0x082287a8 in JOIN::exec() (this=0x8eecf90) at sql_select.cc:1665
#16 0x08229892 in mysql_select(THD*, Item***, st_table_list*, unsigned, List<Item>&, Item*, unsigned, st_o
rder*, st_order*, Item*, st_order*, unsigned long, select_result*, st_select_lex_unit*, st_select_lex*) (
    thd=0x8ecf008, rref_pointer_array=0x8ecf350, tables=0x8eec9f8, wild_num=0, fields=@0x8ecf2b8, 
    conds=0x8eece48, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, 
    select_options=2156153344, result=0x8eecf80, unit=0x8ecf058, select_lex=0x8ecf234)
---Type <return> to continue, or q <return> to quit---
    at sql_select.cc:2084
#17 0x08223c7b in handle_select(THD*, st_lex*, select_result*, unsigned long) (thd=0x8ecf008, 
    lex=0x8ecf048, result=0x8eecf80, setup_tables_done_option=0) at sql_select.cc:238
#18 0x081ebd4b in mysql_execute_command(THD*) (thd=0x8ecf008) at sql_parse.cc:2421
#19 0x081f462d in mysql_parse(THD*, char*, unsigned) (thd=0x8ecf008, 
    inBuf=0x8eec860 "select t1.pk from t1 use index (I1), t2 use index (I2) where t1.A = t2.B", 
    length=72) at sql_parse.cc:5392
#20 0x081e9e03 in dispatch_command(enum_server_command, THD*, char*, unsigned) (command=COM_QUERY, 
    thd=0x8ecf008, packet=0x8ee4801 "", packet_length=73) at sql_parse.cc:1664
#21 0x081e960a in do_command(THD*) (thd=0x8ecf008) at sql_parse.cc:1467
#22 0x081e8710 in handle_one_connection (arg=0x8ecf008) at sql_parse.cc:1116
#23 0x40054a21 in pthread_start_thread () from /lib/i686/libpthread.so.0

How to repeat:
CREATE TABLE t1 (
	PK int NOT NULL PRIMARY KEY,
	A int,
	INDEX I1(A)
) engine=ndbcluster;

CREATE TABLE t2 (
	PK int NOT NULL PRIMARY KEY,
	B int,
	INDEX I2(B)
) engine=ndbcluster;

delimiter |;

create procedure populate_t1(x int)
begin
  while x > 0 do
    set x = x-1;
    insert into test.t1 values (x, x);
  end while;
end; |

create procedure populate_t2(x int)
begin
  while x > 0 do
    set x = x-1;
    insert into test.t2 values (x, x);
  end while;
end; |

delimiter ;|

call populate_t1(10);
call populate_t2(5);

select t1.pk from t1 use index (I1), t2 use index (I2) where t1.A = t2.B;

delete from t1;
-- Bug #12394
--error 1296
delete from t2;
delete from t2;

call populate_t1(10);
call populate_t2(5);

select t1.pk from t1 use index (I1), t2 use index (I2) where t1.A = t2.B;
select t1.pk from t1 use index (I1), t2 use index (I2) where t1.A = t2.B;
[5 Aug 2005 10:00] Martin Skold
ndb_sort_join.test

Attachment: ndb_sort_join.test (application/octet-stream, text), 1.10 KiB.

[5 Aug 2005 10:00] Martin Skold
Added test file
[11 Aug 2005 13:35] Martin Skold
Can't reproduce this anymore (could have been bugs in SPs fixed,
since it was not repeatable in 4.1 where tables were not populated
through SPs)