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

Assertion `trx_is_registered_for_2pc(trx)' failed in innobase_xa_prepare on XA PREPARE after setting master_demote_to_slave

    XMLWordPrintable

Details

    Description

      Possibly related to MDEV-22848, however different versions are affected (due to master_demote_to_slave), and XA is involved and the stack differs.

      # mysqld options required for replay: --log-bin
      XA START 'a';
      CHANGE MASTER TO master_demote_to_slave=1;
      XA END 'a';
      XA PREPARE 'a';
      

      Leads to:

      11.6.1 05fe3f1c186a221c4455b4d83a9d59f09f2dfadb (Debug)

      mariadbd: /test/11.6_dbg/storage/innobase/handler/ha_innodb.cc:17031: int innobase_xa_prepare(handlerton*, THD*, bool): Assertion `trx_is_registered_for_2pc(trx)' failed.
      

      11.6.1 05fe3f1c186a221c4455b4d83a9d59f09f2dfadb (Debug)

      Core was generated by `/test/MD130824-mariadb-11.6.1-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      warning: 44	./nptl/pthread_kill.c: No such file or directory
      [Current thread is 1 (LWP 2017822)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x0000146ac9a4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000146ac9a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000146ac9a2881b in __assert_fail_base (fmt=0x146ac9bd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55b55ac099e8 "trx_is_registered_for_2pc(trx)", file=file@entry=0x55b55ac07660 "/test/11.6_dbg/storage/innobase/handler/ha_innodb.cc", line=line@entry=17031, function=function@entry=0x55b55ac09a08 "int innobase_xa_prepare(handlerton*, THD*, bool)") at ./assert/assert.c:94
      #6  0x0000146ac9a3b507 in __assert_fail (assertion=0x55b55ac099e8 "trx_is_registered_for_2pc(trx)", file=0x55b55ac07660 "/test/11.6_dbg/storage/innobase/handler/ha_innodb.cc", line=17031, function=0x55b55ac09a08 "int innobase_xa_prepare(handlerton*, THD*, bool)")at ./assert/assert.c:103
      #7  0x000055b55a4563ef in innobase_xa_prepare (hton=0x55b55c1145f8, thd=0x146a5c000d58, prepare_trx=<optimized out>)at /test/11.6_dbg/storage/innobase/handler/ha_innodb.cc:2871
      #8  0x000055b55a0da371 in prepare_or_error (ht=0x55b55c1145f8, thd=thd@entry=0x146a5c000d58, all=all@entry=true)at /test/11.6_dbg/sql/handler.cc:1499
      #9  0x000055b55a0dd065 in ha_prepare (thd=thd@entry=0x146a5c000d58)at /test/11.6_dbg/sql/handler.cc:1537
      #10 0x000055b55a04aa1a in trans_xa_prepare (thd=thd@entry=0x146a5c000d58)at /test/11.6_dbg/sql/xa.cc:551
      #11 0x000055b559dc1a1c in mysql_execute_command (thd=thd@entry=0x146a5c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.6_dbg/sql/sql_parse.cc:5703
      #12 0x000055b559dc30df in mysql_parse (thd=thd@entry=0x146a5c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146ac8296250)at /test/11.6_dbg/sql/sql_parse.cc:7869
      #13 0x000055b559dc5466 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146a5c000d58, packet=packet@entry=0x146a5c00b3c9 "XA PREPARE 'a'", packet_length=packet_length@entry=14, blocking=blocking@entry=true)at /test/11.6_dbg/sql/sql_class.h:256
      #14 0x000055b559dc788e in do_command (thd=0x146a5c000d58, blocking=blocking@entry=true) at /test/11.6_dbg/sql/sql_parse.cc:1405
      #15 0x000055b559f38ead in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55b55cae9c08, put_in_cache=put_in_cache@entry=true)at /test/11.6_dbg/sql/sql_connect.cc:1448
      #16 0x000055b559f391ae in handle_one_connection (arg=arg@entry=0x55b55cae9c08)at /test/11.6_dbg/sql/sql_connect.cc:1350
      #17 0x000055b55a39c039 in pfs_spawn_thread (arg=0x55b55ca72ea8)at /test/11.6_dbg/storage/perfschema/pfs.cc:2198
      #18 0x0000146ac9a9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #19 0x0000146ac9b29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug confirmed present in 10.11 (dbg) and 11.6 (dbg). Not present in release builds.

      Attachments

        Issue Links

          Activity

            People

              bnestere Brandon Nesterenko
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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