Description:
A query
select count(*) from t1 where b=1;
where b is part of an ordered index
cause the server to crash.
How to repeat:
#
#multi part key
#
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null
) engine = ndb;
create index a1 on t1 (b, c);
...
select * from t1 where b=1;
+----+---+---+
| a | b | c |
+----+---+---+
| 18 | 1 | 7 |
+----+---+---+
1 row in set (0.01 sec)
mysql> select count(*) from t1 where b=1;
mysqld crashes!
-----------------------------
vio_read: enter: sd=16, buf=0x8769008, size=34
vio_blocking: enter: set_blocking_mode: 0 old_mode: 1
do_command: info: Command on socket (16) = 3 (Query)
free_root: enter: root: 0x8768068 flags: 0
check_access: enter: want_access: 1 master_access: 0
_mymalloc: enter: Size: 24
external_lock: enter: transaction.ndb_lock_count: 0
external_lock: info: lock_type != F_UNLCK
_mymalloc: enter: Size: 24
WHERE:(after remove) (test.t1.b = 1)
info: enter: flag: 18
info: info: HA_STATUS_NO_LOCK
info: info: HA_STATUS_VARIABLE
_mymalloc: enter: Size: 720
test_quick_select: enter: keys_to_use: 2 prev_tables: 0 const_tables: 0
test_quick_select: info: Time to scan table: 100022
init_alloc_root: enter: root: 0x4356e2ac
_mymalloc: enter: Size: 1992
index_flags: info: idx_no: 1
records_in_range: enter: inx: 1
test_quick_select: info: read_time: 100022 found_read_time: 13
init_alloc_root: enter: root: 0x875ca64
index_init: enter: index: 1
_mymalloc: enter: Size: 1992
free_root: enter: root: 0x4356e2ac flags: 0
_myfree: enter: ptr: 0x878d578
Used quick_range on key: 1 (other_keys: 0x0):
1 <= X <= 1
index_flags: info: idx_no: 1
free_root: enter: root: 0x875ca64 flags: 0
_myfree: enter: ptr: 0x878dd60
Info about JOIN
t1 type: ref q_keys: 2 refs: 1 key: 1 len: 4
select used
refs: 1 index_init: enter: index: 1
index_read: enter: active_index: 1, key_len: 4, find_flag: 0
ha_ndbcluster::read_range_first: info: eq_range: 0, sorted: 1
ordered_index_scan: enter: index: 1, sorted: 1
ordered_index_scan: enter: Starting new ordered scan on t1
set_bounds: enter: bound: 4
set_bounds: enter: key_parts: 2
set_bounds: enter: key->length: 4
set_bounds: enter: key->flag: 0
set_bounds: info: Set BoundEQ on b
set_bounds: key: Memory: 877b630 Bytes: (4)
01 00 00 00
get_ndb_value: enter: fieldnr: 0 flags: 40043
get_ndb_value: enter: fieldnr: 1 flags: 40051
next_result: info: Call nextResult, contact_ndb: 1
0x8766f28: ok: 0 tAttrId: 0 currRecAttr: (nil)
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
2
2
1
mysqld got signal 6;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.
key_buffer_size=8388572
read_buffer_size=131072
max_used_connections=1
max_connections=100
threads_connected=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 225788 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
thd=(nil)
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0x400216a8, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x8182311
0x4017f67e
0x40251671
0x4017ce9b
0x40251414
0x4025294b
0x83c4d1d
0x83af183
0x83aebd7
0x83da05b
0x83e07dc
0x83dfe1b
0x83da787
0x83da6f4
0x4017aa21
0x4030a527
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://www.mysql.com/doc/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file
Aborted
gdb ./mysqld ~/MySQL/test/run/var/core.18031
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
Core was generated by `./mysqld --ndbcluster --default-storage-engine=ndbcluster --debug=d,info,enter,'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/i686/librt.so.1...done.
Loaded symbols for /lib/i686/librt.so.1
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libssl.so.4...done.
Loaded symbols for /lib/libssl.so.4
Reading symbols from /lib/libcrypto.so.4...done.
Loaded symbols for /lib/libcrypto.so.4
Reading symbols from /lib/i686/libpthread.so.0...done.
Loaded symbols for /lib/i686/libpthread.so.0
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/kerberos/lib/libgssapi_krb5.so.2...done.
Loaded symbols for /usr/kerberos/lib/libgssapi_krb5.so.2
Reading symbols from /usr/kerberos/lib/libkrb5.so.3...done.
Loaded symbols for /usr/kerberos/lib/libkrb5.so.3
Reading symbols from /usr/kerberos/lib/libcom_err.so.3...done.
Loaded symbols for /usr/kerberos/lib/libcom_err.so.3
---Type <return> to continue, or q <return> to quit---
Reading symbols from /usr/kerberos/lib/libk5crypto.so.3...done.
Loaded symbols for /usr/kerberos/lib/libk5crypto.so.3
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
#0 0x40251671 in kill () from /lib/i686/libc.so.6
(gdb) bt
#0 0x40251671 in kill () from /lib/i686/libc.so.6
#1 0x4017cafd in pthread_kill () from /lib/i686/libpthread.so.0
#2 0x08271d6f in write_core (sig=18031) at stacktrace.c:220
#3 0x081823bc in handle_segfault (sig=18031) at mysqld.cc:1823
#4 0x4017f67e in __pthread_sighandler () from /lib/i686/libpthread.so.0
#5 <signal handler called>
#6 0x40251671 in kill () from /lib/i686/libc.so.6
#7 0x4017cafd in pthread_kill () from /lib/i686/libpthread.so.0
#8 0x4017ce9b in raise () from /lib/i686/libpthread.so.0
#9 0x40251414 in raise () from /lib/i686/libc.so.6
#10 0x4025294b in abort () from /lib/i686/libc.so.6
#11 0x083c4d1d in NdbReceiver::execTRANSID_AI(unsigned const*, unsigned) (this=0x8766f28,
aDataPtr=0x873a6c0, aLength=6) at NdbReceiver.cpp:193
#12 0x083af183 in Ndb::handleReceivedSignal(NdbApiSignal*, LinearSectionPtr*) (this=0x8780470,
aSignal=0x40021cec, ptr=0x0) at Ndbif.cpp:363
#13 0x083aebd7 in Ndb::executeMessage(void*, NdbApiSignal*, LinearSectionPtr*) (NdbObject=0x0,
aSignal=0x0, ptr=0x0) at Ndbif.cpp:202
#14 0x083da05b in execute(void*, SignalHeader*, unsigned char, unsigned*, LinearSectionPtr*) (
callbackObj=0x87248e0, header=0x40021e4c, prio=1 '\001', theData=0x873a6a4, ptr=0x0)
at TransporterFacade.cpp:243
#15 0x083e07dc in TransporterRegistry::unpack(unsigned*, unsigned, unsigned short, IOState) (
this=0x8724f48, readPtr=0x873a694, sizeOfData=56, remoteNodeId=2, state=NoHalt) at Packer.cpp:104
#16 0x083dfe1b in TransporterRegistry::performReceive() (this=0x8724f48) at TransporterRegistry.cpp:837
---Type <return> to continue, or q <return> to quit---
#17 0x083da787 in TransporterFacade::threadMainReceive() (this=0x87248e0) at TransporterFacade.cpp:526
#18 0x083da6f4 in runReceiveResponse_C (me=0x87248e0) at TransporterFacade.cpp:510
#19 0x4017aa21 in pthread_start_thread () from /lib/i686/libpthread.so.0
(gdb) up
#1 0x4017cafd in pthread_kill () from /lib/i686/libpthread.so.0
(gdb) up
#2 0x08271d6f in write_core (sig=18031) at stacktrace.c:220
220 pthread_kill(pthread_self(), sig);
Current language: auto; currently c
(gdb) up
#3 0x081823bc in handle_segfault (sig=18031) at mysqld.cc:1823
1823 write_core(sig);
Current language: auto; currently c++
(gdb) up
#4 0x4017f67e in __pthread_sighandler () from /lib/i686/libpthread.so.0
(gdb) up
#5 <signal handler called>
(gdb) up
#6 0x40251671 in kill () from /lib/i686/libc.so.6
(gdb) up
#7 0x4017cafd in pthread_kill () from /lib/i686/libpthread.so.0
(gdb) up
#8 0x4017ce9b in raise () from /lib/i686/libpthread.so.0
(gdb) up
#9 0x40251414 in raise () from /lib/i686/libc.so.6
(gdb) up
#10 0x4025294b in abort () from /lib/i686/libc.so.6
(gdb) up
#11 0x083c4d1d in NdbReceiver::execTRANSID_AI(unsigned const*, unsigned) (this=0x8766f28,
aDataPtr=0x873a6c0, aLength=6) at NdbReceiver.cpp:193
193 abort();
(gdb) up
#12 0x083af183 in Ndb::handleReceivedSignal(NdbApiSignal*, LinearSectionPtr*) (this=0x8780470,
aSignal=0x40021cec, ptr=0x0) at Ndbif.cpp:363
363 com = tRec->execTRANSID_AI(tDataPtr + TransIdAI::HeaderLength,
(gdb)