Bug #23945 crash during drop table, AUTOCOMMIT=0, CREATE TABLE .. AS SELECT
Submitted: 3 Nov 2006 15:59 Modified: 7 Nov 2006 23:44
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S1 (Critical)
Version: OS:Any
Assigned to: Jim Starkey CPU Architecture:Any

[3 Nov 2006 15:59] Matthias Leich
Description:
Heavy modified testcase derived from not yet pushed mix1_falcon:
----------------------------------------------------------------
SET STORAGE_ENGINE = Falcon;
DROP TABLE IF EXISTS t1;
SET AUTOCOMMIT = 1;
CREATE TABLE t1 (PRIMARY KEY (a)) SELECT 1 AS a UNION ALL SELECT 1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'
   !! Everything above is correct. We repeat this now without AUTOCOMMIT !!
ET AUTOCOMMIT = 0;
CREATE TABLE t1 (PRIMARY KEY (a)) SELECT 1 AS a UNION ALL SELECT 1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist
DROP TABLE t1;
ERROR HY000: Lost connection to MySQL server during query

Combined master.err and stacktrace
####################################################
...
Version: '5.1.13-falcon-alpha-pb-debug-log' ...
CURRENT_TEST: ml04
...
mysqld got signal 11;
...
thd=0x90e1db0
Attempting backtrace. ...
Cannot determine thread, fp=0xb3442e58, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x82873db handle_segfault + 491
0x8520f1b _ZN14SRLUpdateIndex6appendEP11TransactionP13DeferredIndex + 53
0x84b98d5 _ZN3Dbb15logIndexUpdatesEP11TransactionP13DeferredIndex + 49
0x8494a78 _ZN11Transaction6commitEv + 170
0x84aaecc _ZN10Connection6commitEv + 184
0x847e85c _ZN17StorageConnection6commitEv + 40
0x847afae _ZN15NfsStorageTable6commitEP10handlertonP3THDb + 162
0x838cf08 _Z19ha_commit_one_phaseP3THDb + 214
0x838d354 _Z15ha_commit_transP3THDb + 848
0x829ef1b _Z16end_active_transP3THD + 431
0x82a55e5 _Z21mysql_execute_commandP3THD + 14311
0x82ab636 _Z11mysql_parseP3THDPcj + 536
0x82ac11e _Z16dispatch_command19enum_server_commandP3THDPcj + 2434
0x82ad658 _Z10do_commandP3THD + 598
0x82ada51 handle_one_connection + 783
0xb7cd834b _end + -1356297989
0xb7da865e _end + -1355445234
New value of fp=(nil) failed sanity check, terminating stack trace!
...
thd->query at 0x9106f48 = DROP TABLE t1
...
Writing a core file

backtrace of this test with server running in GDB:
(gdb) bt
#0  0x08520f1b in SRLUpdateIndex::append (this=0xb7a816a4, 
    transaction=0xb7a9db78, deferredIndex=0xb3244270) at SRLUpdateIndex.cpp:40
#1  0x084b98d5 in Dbb::logIndexUpdates (this=0xb7a7f720, 
    transaction=0xb7a9db78, deferredIndex=0xb3244270) at Dbb.cpp:894
#2  0x08494a78 in Transaction::commit (this=0xb7a9db78) at Transaction.cpp:142
#3  0x084aaecc in Connection::commit (this=0xb7aa91e4) at Connection.cpp:267
#4  0x0847e85c in StorageConnection::commit (this=0xb7aa8130)
    at StorageConnection.cpp:260
#5  0x0847afae in NfsStorageTable::commit (hton=0x8a6e1e0, thd=0x90dd328, 
    all=true) at ha_falcon.cpp:702
#6  0x0838cf08 in ha_commit_one_phase (thd=0x90dd328, all=true)
    at handler.cc:761
#7  0x0838d354 in ha_commit_trans (thd=0x90dd328, all=true) at handler.cc:731
#8  0x0829ef1b in end_active_trans (thd=0x90dd328) at sql_parse.cc:161
#9  0x082a55e5 in mysql_execute_command (thd=0x90dd328) at sql_parse.cc:3564
#10 0x082ab636 in mysql_parse (thd=0x90dd328, inBuf=0x9106ab0 "DROP TABLE t1", 
    length=13) at sql_parse.cc:6080
#11 0x082ac11e in dispatch_command (command=COM_QUERY, thd=0x90dd328, 
    packet=0x90fea51 "DROP TABLE t1", packet_length=14) at sql_parse.cc:1828
#12 0x082ad658 in do_command (thd=0x90dd328) at sql_parse.cc:1612
#13 0x082ada51 in handle_one_connection (arg=0x90dd328) at sql_parse.cc:1227
#14 0xb7ccf34b in start_thread () from /lib/libpthread.so.0
#15 0xb7d9f65e in clone () from /lib/libc.so.6
(gdb)

My environment:
 - PC Intel Pentium M (x86-32Bit) with Linux(SuSE 10.1)
 - MySQL compiled from source
     mysql-5.1-falcon last ChangeSet@1.2363, 2006-11-02
     BUILD/compile-pentium-debug-max

How to repeat:
I will push a testcase falcon_bug_nnnnn just after sending this bug report.
[3 Nov 2006 16:14] Matthias Leich
The pushed test is falcon_bug_23945.
[3 Nov 2006 22:33] Calvin Sun
It crashed at:

	uint indexId = deferredIndex->index->indexId;

where deferredIndex->index = 0.
[6 Nov 2006 17:01] Jim Starkey
Falcon was trying to log a deferred index that had been deleted.
[7 Nov 2006 23:44] Hakan Küçükyılmaz
Works for me on Linux 32-bit and Linux 64-bit, change set 1.2366, 2006-11-07.

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

falcon_bug_23945               [ pass ]            630
-------------------------------------------------------
Stopping All Servers
Shutting-down Instance Manager
All 1 tests were successful.
The servers were restarted 0 times
Spent 0.63 seconds actually executing testcases

Regards, Hakan