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

DDL on temporary object is prohibited when XA is in prepare state

Details

    Description

      # mysqld options required for replay: --log-bin 
      USE test;
      XA START '0';
      CREATE TEMPORARY TABLE t(c INT);
      XA END '0';
      XA PREPARE '0';
      DROP TEMPORARY TABLE t;
      # shutdown of sever, or some delay, may be required before crash happens
      

      Leads to:

      10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

      2020-04-30  1:33:06 0 [Note] /test/MD210420-mariadb-10.5.3-linux-x86_64-dbg/bin/mysqld: ready for connections.
      Version: '10.5.3-MariaDB-debug-log'  socket: '/test/MD210420-mariadb-10.5.3-linux-x86_64-dbg/socket.sock'  port: 15092  MariaDB Server
      2020-04-30  1:33:26 5 [Warning] WSREP: binlog trx cache not empty (113 bytes) @ connection close 5
      2020-04-30  1:33:26 5 [Warning] WSREP: binlog stmt cache not empty (0 bytes) @ connection close 5
      mysqld: /test/10.5_dbg/sql/log.cc:1733: int binlog_close_connection(handlerton*, THD*): Assertion `cache_mngr->trx_cache.empty()' failed.
      200430  1:33:26 [ERROR] mysqld got signal 6 ;
      

      10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

      Core was generated by `/test/MD210420-mariadb-10.5.3-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x7fc92b02c700 (LWP 511539))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000558edb73b03d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x0000558edaee0d7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x00007fc9297bb801 in __GI_abort () at abort.c:79
      #6  0x00007fc9297ab39a in __assert_fail_base (fmt=0x7fc9299327d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x558edba6b49a "cache_mngr->trx_cache.empty()", file=file@entry=0x558edba6afe7 "/test/10.5_dbg/sql/log.cc", line=line@entry=1733, function=function@entry=0x558edba6f9c0 <binlog_close_connection(handlerton*, THD*)::__PRETTY_FUNCTION__> "int binlog_close_connection(handlerton*, THD*)") at assert.c:92
      #7  0x00007fc9297ab412 in __GI___assert_fail (assertion=assertion@entry=0x558edba6b49a "cache_mngr->trx_cache.empty()", file=file@entry=0x558edba6afe7 "/test/10.5_dbg/sql/log.cc", line=line@entry=1733, function=function@entry=0x558edba6f9c0 <binlog_close_connection(handlerton*, THD*)::__PRETTY_FUNCTION__> "int binlog_close_connection(handlerton*, THD*)") at assert.c:101
      #8  0x0000558edb0158a2 in binlog_close_connection (hton=<optimized out>, thd=0x7fc8fdc15088) at /test/10.5_dbg/sql/log.cc:1733
      #9  0x0000558edaee589c in ha_close_connection (thd=thd@entry=0x7fc8fdc15088) at /test/10.5_dbg/sql/handler.cc:840
      #10 0x0000558edabd59a6 in THD::free_connection (this=this@entry=0x7fc8fdc15088) at /test/10.5_dbg/sql/sql_class.cc:1618
      #11 0x0000558edab32b80 in unlink_thd (thd=0x7fc8fdc15088) at /test/10.5_dbg/sql/mysqld.cc:2621
      #12 0x0000558edad89472 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7fc9093c9aa8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1433
      #13 0x0000558edad89744 in handle_one_connection (arg=arg@entry=0x7fc9093c9aa8) at /test/10.5_dbg/sql/sql_connect.cc:1319
      #14 0x0000558edb1e9fb0 in pfs_spawn_thread (arg=0x7fc928c45d88) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #15 0x00007fc92a49e6db in start_thread (arg=0x7fc92b02c700) at pthread_create.c:463
      #16 0x00007fc92989c88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.2 (dbg), 10.5.3 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (dbg), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      Similar to MDEV-21307 but all these differ; assert message, stack, testcase, affected versions.

      Attachments

        Activity

          Elkin Andrei Elkin added a comment - - edited

          Roel Thanks for reporting it! MDEV-21307 is different, as it requires a feature of not reporting an error from before-trigger.
          I could reproduce this one, but after some (not really wild ) guessing about the actual ENGINE in
          CREATE TEMPORARY TABLE t(c INT);..
          Yes, that's right it may be MyISAM for some who would like to reproduce, and then nothing happens.
          Just let you know that it's better to always specify engines, or mention the default for them.

          To the bug again, the assert should be fixed all right, but I am also suspecting the parser may not be right here to accept such DROP in this XA state.

          serg, FYI, ^ I think the parser is wrong and after XA PREPARE it must reject any operation that modifies resources involved into the prepared transaction. In our case that is binlog resource, turning which OFF is also prohibited within transaction scope.

          Elkin Andrei Elkin added a comment - - edited Roel Thanks for reporting it! MDEV-21307 is different, as it requires a feature of not reporting an error from before-trigger. I could reproduce this one, but after some (not really wild ) guessing about the actual ENGINE in CREATE TEMPORARY TABLE t(c INT); .. Yes, that's right it may be MyISAM for some who would like to reproduce, and then nothing happens. Just let you know that it's better to always specify engines, or mention the default for them. To the bug again, the assert should be fixed all right, but I am also suspecting the parser may not be right here to accept such DROP in this XA state. serg , FYI, ^ I think the parser is wrong and after XA PREPARE it must reject any operation that modifies resources involved into the prepared transaction. In our case that is binlog resource, turning which OFF is also prohibited within transaction scope.
          Elkin Andrei Elkin added a comment -

          Sergei, hallo.

          Could you please check the patch - also in the HEAD of bb-10.5-andrei -
          that implements the summary line requirement.

          Cheers,

          Andrei

          Elkin Andrei Elkin added a comment - Sergei, hallo. Could you please check the patch - also in the HEAD of bb-10.5-andrei - that implements the summary line requirement. Cheers, Andrei
          Elkin Andrei Elkin added a comment -

          Just to make sure my reply to one of two questions satisfies. Then I go to address extraneous er_xaer_rmfail().

          Elkin Andrei Elkin added a comment - Just to make sure my reply to one of two questions satisfies. Then I go to address extraneous er_xaer_rmfail().

          Elkin Right thank you. CLI is always default InnoDB, MTR is always default MyISAM. Fun

          Roel Roel Van de Paar added a comment - Elkin Right thank you. CLI is always default InnoDB, MTR is always default MyISAM. Fun

          People

            Elkin Andrei Elkin
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.