Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-493

Assertion thd->transaction.stmt.is_empty() in prepared statement when MEMORY table implicitly dropped after server restart

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 5.5.25
    • Fix Version/s: 5.5.28
    • Component/s: None
    • Labels:
      None

      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());

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              knielsen Kristian Nielsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration