[MDEV-493] Assertion thd->transaction.stmt.is_empty() in prepared statement when MEMORY table implicitly dropped after server restart Created: 2012-08-27  Updated: 2012-09-06  Resolved: 2012-09-06

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.25
Fix Version/s: 5.5.28

Type: Bug Priority: Major
Reporter: Kristian Nielsen Assignee: Oleksandr Byelkin
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-510 assert triggered by ./mtr --ps-proto... Closed

 Description   

I get the following assertion when using ./mtr --ps-protocol in 5.5:

#7  0x00000000006c49e0 in Prepared_statement::prepare (this=0x47bb410, 
    packet=0x7f11c41293d1 "", packet_len=44)
    at /home/buildbot/build/sql/sql_prepare.cc:3373
#8  0x00000000006bfb02 in mysqld_stmt_prepare (thd=0x7f11c4123d40, 
    packet=0x7f11c41293d1 "", packet_length=44)
    at /home/buildbot/build/sql/sql_prepare.cc:2279
#9  0x000000000068a0b8 in dispatch_command (command=COM_STMT_PREPARE, 
    thd=0x7f11c4123d40, packet=0x7f11c41293d1 "", packet_length=44)
    at /home/buildbot/build/sql/sql_parse.cc:1024
#10 0x0000000000688f61 in do_command (thd=0x7f11c4123d40)
    at /home/buildbot/build/sql/sql_parse.cc:794

Here is a full test case, remember it only causes assertion/crash if run with
--ps-protocol in a debug build:

--source include/have_binlog_format_statement.inc
 
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=heap;
INSERT INTO t1 VALUES (1), (2), (5);
 
# Restart the master mysqld.
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait-rpl_mdev382.test
EOF
 
--shutdown_server 30
 
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-rpl_mdev382.test
EOF
 
--enable_reconnect
--source include/wait_until_connected_again.inc
 
SELECT * FROM t1;
DROP TABLE t1;

The situation is the following. We have a MEMORY table. We restart the server,
so this implicitly causes the table to loose its content.

We then access the table with a prepared statement. As a side effect an
explicit DROP TABLE is put in the binlog.

In this situation, we hit this assertion in sql_prepare.cc:

/* No need to commit statement transaction, it's not started. */
DBUG_ASSERT(thd->transaction.stmt.is_empty());



 Comments   
Comment by Sergei Golubchik [ 2012-09-06 ]

Fixed as MDEV-510

Generated at Thu Feb 08 06:29:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.