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

Assertion `thd->lex->sql_command != SQLCOM_XA_ROLLBACK || thd->transaction->xid_state.is_explicit_XA()' failed in ha_rollback_trans on XA ROLLBACK

    XMLWordPrintable

Details

    • Q2/2025 Development

    Description

      --source include/have_innodb.inc
      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      SET max_session_mem_used=32768;
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      XA START 'a';
      --error ER_OPTION_PREVENTS_STATEMENT
      INSERT INTO t VALUES ();
      INSERT INTO t VALUES ();
      SET pseudo_slave_mode=1;
      XA END 'a';
      XA PREPARE 'a';
      XA ROLLBACK 'a';
      

      Leads to:

      bb-12.1-MDEV-32830_xa CS 12.0.1 4331ea8ae45a25ba29ff0412f2c9b25b12b14d2c (Debug) Build 15/05/2025

      mariadbd: /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2371: int ha_rollback_trans(THD *, bool): Assertion `thd->lex->sql_command != SQLCOM_XA_ROLLBACK || thd->transaction->xid_state.is_explicit_XA()' failed.
      

      bb-12.1-MDEV-32830_xa CS 12.0.1 4331ea8ae45a25ba29ff0412f2c9b25b12b14d2c (Debug) Build 15/05/2025

      Core was generated by `/test/MDEV-32830_MD150525-mariadb-12.0.1-linux-x86_64-dbg/bin/mariadbd --no-def'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 2351291)]
      (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  0x00007d142c84526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007d142c8288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007d142c82881b in __assert_fail_base (fmt=0x7d142c9d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x578bdd8e3475 "thd->lex->sql_command != SQLCOM_XA_ROLLBACK || thd->transaction->xid_state.is_explicit_XA()", file=file@entry=0x578bdd8d5707 "/test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc", line=line@entry=2371, function=function@entry=0x578bdd795e51 "int ha_rollback_trans(THD *, bool)") at ./assert/assert.c:94
      #6  0x00007d142c83b507 in __assert_fail (assertion=0x578bdd8e3475 "thd->lex->sql_command != SQLCOM_XA_ROLLBACK || thd->transaction->xid_state.is_explicit_XA()", file=0x578bdd8d5707 "/test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc", line=2371, function=0x578bdd795e51 "int ha_rollback_trans(THD *, bool)")at ./assert/assert.c:103
      #7  0x0000578bddfd81af in ha_rollback_trans (thd=0x7d12f8000d58, all=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2370
      #8  0x0000578bde6a9ee2 in trans_rollback_stmt (thd=0x7d12f8000d58)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/transaction.cc:567
      #9  0x0000578bde3037c7 in open_ltable (thd=0x7d12f8000d58, table_list=0x7d14242e1620, lock_type=TL_WRITE, lock_flags=2075)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_base.cc:5617
      #10 0x00007d14241a8297 in spider_sys_open_table (thd=0x7d12f8000d58, tables=0x7d14242e1620, open_tables_backup=0x7d14242e1e28)at /test/bb-12.1-MDEV-32830_xa_dbg/storage/spider/spd_sys_table.cc:454
      #11 0x00007d14241a7a28 in spider_open_sys_table (thd=0x7d12f8000d58, table_name=0x7d1424186197 "spider_xa", table_name_length=9, write=true, open_tables_backup=0x7d14242e1e28, error_num=0x7d14242e2074)at /test/bb-12.1-MDEV-32830_xa_dbg/storage/spider/spd_sys_table.cc:261
      #12 0x00007d14241baaf7 in spider_internal_xa_rollback_by_xid (thd=0x7d12f8000d58, trx=0x7d12f8078608, xid=0x7d12f840dc08)at /test/bb-12.1-MDEV-32830_xa_dbg/storage/spider/spd_trx.cc:2575
      #13 0x00007d14241bc151 in spider_xa_rollback_by_xid (xid=0x7d12f840dc08)at /test/bb-12.1-MDEV-32830_xa_dbg/storage/spider/spd_trx.cc:3115
      #14 0x0000578bddfdb6ca in xarollback_handlerton (hton=0x578be2514d48, arg=0x7d14242e4dd0) at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2515
      #15 0x0000578bddfd6d5a in tp_foreach (thd=0x0, func=0x578bddfdb630 <xarollback_handlerton(THD*, transaction_participant*, void*)>, arg=0x7d14242e4dd0)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:892
      #16 0x0000578bddfdb757 in commit_or_rollback_xa_engine (xid=0x7d12f840dc08, is_commit=false, ordered=0)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2535
      #17 0x0000578bddfdb907 in ha_commit_or_rollback_by_xid (xid=0x7d12f840dc08, is_commit=false, thd=0x7d12f8000d58)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2571
      #18 0x0000578bde800c54 in xa_complete (thd=0x7d12f8000d58, do_commit=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/xa.cc:782
      #19 0x0000578bde800dd8 in trans_xa_rollback (thd=0x7d12f8000d58)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/xa.cc:923
      #20 0x0000578bde47d4f6 in mysql_execute_command (thd=0x7d12f8000d58, is_called_from_prepared_stmt=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:5745
      #21 0x0000578bde46cff4 in mysql_parse (thd=0x7d12f8000d58, rawbuf=0x7d12f8019ee0 "XA ROLLBACK 'a'", length=15, parser_state=0x7d14242e6a10)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:7891
      #22 0x0000578bde46a3c8 in dispatch_command (command=COM_QUERY, thd=0x7d12f8000d58, packet=0x7d12f800b259 "XA ROLLBACK 'a'", packet_length=15, blocking=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:1877
      #23 0x0000578bde46dba3 in do_command (thd=0x7d12f8000d58, blocking=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:1416
      #24 0x0000578bde68aba9 in do_handle_one_connection (connect=0x578be25d2338, put_in_cache=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_connect.cc:1414
      #25 0x0000578bde68a94e in handle_one_connection (arg=0x578be259fc98)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_connect.cc:1326
      #26 0x00007d142c89ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #27 0x00007d142c929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Testcase is MTR and CLI compatible.

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.