Bug #14212 BDB: Server crash after COMMIT + ALTER TABLE
Submitted: 21 Oct 2005 15:46 Modified: 18 Jan 2006 18:26
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: BDB Severity:S1 (Critical)
Version:5.0.15 OS:Linux (Linux)
Assigned to: Jim Winstead CPU Architecture:Any

[21 Oct 2005 15:46] Georg Richter
Description:
see how to repeat.

Backtrace:
(gdb) bt
#0  0x083bb80c in __txn_commit (txnp=0x8eb0db0, flags=0) at ../../bdb/txn/txn.c:459
#1  0x083bad13 in txn_commit (txnp=0x8eb0db0, flags=0) at ../../bdb/txn/txn.c:151
#2  0x082c5de0 in berkeley_commit (thd=0x8e82a58, all=false) at ha_berkeley.cc:261
#3  0x082b902c in ha_commit_one_phase (thd=0x8e82a58, all=false) at handler.cc:734
#4  0x082b8e88 in ha_commit_trans (thd=0x8e82a58, all=false) at handler.cc:704
#5  0x082ff0b8 in copy_data_between_tables (from=0x8e6b520, to=0x8eb0e38, create=@0x4b475000, handle_duplicates=DUP_ERROR, ignore=false, order_num=0,
    order=0x0, copied=0x4b476008, deleted=0x4b476000) at sql_table.cc:4011
#6  0x082fde00 in mysql_alter_table (thd=0x8e82a58, new_db=0x8e844a0 "test", new_name=0x8eb3bc8 "t1", create_info=0x8e82fc0, table_list=0x8eb3bf0,
    fields=@0x8e82ee8, keys=@0x8e82edc, order_num=0, order=0x0, handle_duplicates=DUP_ERROR, ignore=false, alter_info=0x8e83104, do_send_ok=true)
    at sql_table.cc:3629
#7  0x081f9dc2 in mysql_execute_command (thd=0x8e82a58) at sql_parse.cc:3012
#8  0x0820158d in mysql_parse (thd=0x8e82a58, inBuf=0x8eb3b68 "ALTER TABLE t1 ADD PRIMARY KEY(a)", length=33) at sql_parse.cc:5521
#9  0x081f6a0d in dispatch_command (command=COM_QUERY, thd=0x8e82a58, packet=0x8eabb09 "ALTER TABLE t1 ADD PRIMARY KEY(a)", packet_length=34)
    at sql_parse.cc:1697
#10 0x081f61e6 in do_command (thd=0x8e82a58) at sql_parse.cc:1498
#11 0x081f5263 in handle_one_connection (arg=0x8e82a58) at sql_parse.cc:1143
#12 0x4016f9dd in start_thread () from /lib/tls/libpthread.so.0
#13 0x4029affa in clone () from /lib/tls/libc.so.6

How to repeat:
SET AUTOCOMMIT=0;
CREATE TABLE bdb_test (a int) ENGINE=BDB;
COMMIT;
/* the following statement crashes the server */
ALTER TABLE bdb_test ADD PRIMARY KEY(a);
[21 Oct 2005 16:27] MySQL Verification Team
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.16-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET AUTOCOMMIT=0;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE bdb_test (a int) ENGINE=BDB;
Query OK, 0 rows affected (0.48 sec)

mysql> COMMIT;
Query OK, 0 rows affected (0.00 sec)

mysql> ALTER TABLE bdb_test ADD PRIMARY KEY(a);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[26 Oct 2005 0:01] 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/internals/31475
[9 Dec 2005 23:00] 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/internals/33197
[9 Jan 2006 16:17] Jim Winstead
Fixed in 5.0.19 and 5.1.5.
[18 Jan 2006 18:26] Mike Hillyer
Added to 5.0.19 and 5.1.5 changelogs:

<listitem>
        <para>
          A <literal>COMMIT</literal> statement followed by a
          <literal>ALTER TABLE</literal> statement on a BDB table caused
          server crash. (Bug #14212)
        </para>
      </listitem>