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

Assertion `!thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()' failed in mysql_execute_command, mariadb-binlog output differences between versions

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      When executing a corrupted BINLOG command sequence:

      BINLOG ' O1ZVRw8BAAAAZgAAAGoAAAAAAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA7VlVHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC ';
      BINLOG '1iZAZwIBAAAAjQAAAHJ4AAAAACQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYEpAgAAAAAAAIIEnQAAAAAAAAB0ZXN0AGFsdGVyICB0YWJsZSB0NiBhZGQgY29sdW1uIGMgaW50LCBmb3JjZSwgYWxnb3JpdGhtPWNvcHlIBde4';
      

      We will see an error at the CLI:

      CS 11.4.8 8c6cbb336081a5e1ad781df4a9778b61e3b4d73f (Debug) Build 06/06/2025

      ERROR 1800 (HY000): Unknown ALGORITHM 'copyH'
      

      And in the error log:

      CS 11.4.8 8c6cbb336081a5e1ad781df4a9778b61e3b4d73f (Debug) Build 06/06/2025

      2025-06-10 17:19:34 4 [ERROR]  BINLOG_BASE64_EVENT: Error 'Unknown ALGORITHM 'copyH'' on query. Default database: 'test'. Query: 'alter  table t6 add column c int, force, algorithm=copyH^E׸', Internal MariaDB error code: 1800
      

      Due to corruption, visibile in the error log and also by using:

      BINLOG='1iZAZwIBAAAAjQAAAHJ4AAAAACQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYEpAgAAAAAAAIIEnQAAAAAAAAB0ZXN0AGFsdGVyICB0YWJsZSB0NiBhZGQgY29sdW1uIGMgaW50LCBmb3JjZSwgYWxnb3JpdGhtPWNvcHlIBde4'
      BINLOG_TEMP=$(mktemp)
      {  printf '\xfe\x62\x69\x6e'  # Binlog Header
         echo "${BINLOG}" | base64 -di
      } > "${BINLOG_TEMP}"
      ./bin/mariadb-binlog --verbose "${BINLOG_TEMP}"
      rm -f "${BINLOG_TEMP}"
      

      i.e. the second BINLOG command is this:

      alter  table t6 add column c int, force, algorithm=copyH׸
      

      I do not consider this a bug (where the corruption is not produced by MariaDB), however the following does seem to be a bug:

      BINLOG 'AMqaOw8BAAAAdAAAAHgAAAAAAAQANS42LjM0LTc5LjEtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAYVx w2w=';
      CREATE TABLE t (id INT,KEY id (id)) CHARSET=latin1;
      SET @@autocommit=0;
      SELECT * FROM t;
      BINLOG '1iZAZwIBAAAAjQAAAHJ4AAAAACQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYEpAgAAAAAAAIIEnQAAAAAAAAB0ZXN0AGFsdGVyICB0YWJsZSB0NiBhZGQgY29sdW1uIGMgaW50LCBmb3JjZSwgYWxnb3JpdGhtPWNvcHlIBde4';
      

      Leads to:

      CS 11.4.8 8c6cbb336081a5e1ad781df4a9778b61e3b4d73f (Debug) Build 06/06/2025

      mariadbd: /test/11.4_dbg/sql/sql_parse.cc:5905: int mysql_execute_command(THD *, bool): Assertion `!thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()' failed.
      

      CS 11.4.8 8c6cbb336081a5e1ad781df4a9778b61e3b4d73f (Debug) Build 06/06/2025

      Core was generated by `/test/MD060625-mariadb-11.4.8-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
       
      [Current thread is 1 (LWP 1930927)]
      (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  0x00007f1845c4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007f1845c288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007f1845c2881b in __assert_fail_base (fmt=0x7f1845dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x56521e03afe3 "!thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()", file=file@entry=0x56521e12d992 "/test/11.4_dbg/sql/sql_parse.cc", line=line@entry=5905, function=function@entry=0x56521e0dc982 "int mysql_execute_command(THD *, bool)") at ./assert/assert.c:94
      #6  0x00007f1845c3b507 in __assert_fail (assertion=0x56521e03afe3 "!thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()", file=0x56521e12d992 "/test/11.4_dbg/sql/sql_parse.cc", line=5905, function=0x56521e0dc982 "int mysql_execute_command(THD *, bool)")at ./assert/assert.c:103
      #7  0x000056521ec83ee7 in mysql_execute_command (thd=0x7f1718000d58, is_called_from_prepared_stmt=false) at /test/11.4_dbg/sql/sql_parse.cc:5904
      #8  0x000056521ec72f84 in mysql_parse (thd=0x7f1718000d58, rawbuf=0x7f17180183f3 "alter  table t6 add column c int, force, algorithm=copy", length=55, parser_state=0x7f183ff2fe60)at /test/11.4_dbg/sql/sql_parse.cc:7898
      #9  0x000056521e99953f in Query_log_event::do_apply_event (this=0x7f171807b6c8, rgi=0x7f171807acb0, query_arg=0x7f17180183f3 "alter  table t6 add column c int, force, algorithm=copy", q_len_arg=55) at /test/11.4_dbg/sql/log_event_server.cc:2079
      #10 0x000056521e998427 in Query_log_event::do_apply_event (this=0x7f171807b6c8, rgi=0x7f171807acb0)at /test/11.4_dbg/sql/log_event_server.cc:1504
      #11 0x000056521e9c1962 in Log_event::apply_event (this=0x7f171807b6c8, rgi=0x7f171807acb0) at /test/11.4_dbg/sql/log_event.cc:3957
      #12 0x000056521ee4c30b in save_restore_context_apply_event (ev=0x7f171807b6c8, rgi=0x7f171807acb0) at /test/11.4_dbg/sql/sql_binlog.cc:212
      #13 0x000056521ee4ca43 in mysql_client_binlog_statement (thd=0x7f1718000d58)at /test/11.4_dbg/sql/sql_binlog.cc:428
      #14 0x000056521ec83668 in mysql_execute_command (thd=0x7f1718000d58, is_called_from_prepared_stmt=false) at /test/11.4_dbg/sql/sql_parse.cc:5792
      #15 0x000056521ec72f84 in mysql_parse (thd=0x7f1718000d58, rawbuf=0x7f1718019ac0 "BINLOG '1iZAZwIBAAAAjQAAAHJ4AAAAACQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYEpAgAAAAAAAIIEnQAAAAAAAAB0ZXN0AGFsdGVyICB0YWJsZSB0NiBhZGQgY29sdW1uIGMgaW50LCBmb3JjZSwgYWxnb3JpdGhtPWNvcHlIBde4'", length=197, parser_state=0x7f183ff31a30) at /test/11.4_dbg/sql/sql_parse.cc:7898
      #16 0x000056521ec70434 in dispatch_command (command=COM_QUERY, thd=0x7f1718000d58, packet=0x7f171800afd9 "BINLOG '1iZAZwIBAAAAjQAAAHJ4AAAAACQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYEpAgAAAAAAAIIEnQAAAAAAAAB0ZXN0AGFsdGVyICB0YWJsZSB0NiBhZGQgY29sdW1uIGMgaW50LCBmb3JjZSwgYWxnb3JpdGhtPWNvcHlIBde4'", packet_length=197, blocking=true) at /test/11.4_dbg/sql/sql_parse.cc:1904
      #17 0x000056521ec73b33 in do_command (thd=0x7f1718000d58, blocking=true)at /test/11.4_dbg/sql/sql_parse.cc:1417
      #18 0x000056521ee84a89 in do_handle_one_connection (connect=0x5652227251e8, put_in_cache=true) at /test/11.4_dbg/sql/sql_connect.cc:1408
      #19 0x000056521ee84822 in handle_one_connection (arg=0x5652227f9e18)at /test/11.4_dbg/sql/sql_connect.cc:1320
      #20 0x00007f1845c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #21 0x00007f1845d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  060625  643319a7fb1e273797c2a1e46d76cfac0fa1da8f  No bug found                  
      CS  10.6   opt  060625  643319a7fb1e273797c2a1e46d76cfac0fa1da8f  No bug found                  
      CS  10.11  dbg  060625  11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32  !thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()|SIGABRT|mysql_execute_command|mysql_parse|Query_log_event::do_apply_event|Query_log_event::do_apply_event
      CS  10.11  opt  060625  11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32  MARIADB_ERROR_CODE|MariaDB error code: 1146
      CS  11.4   dbg  060625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  !thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()|SIGABRT|mysql_execute_command|mysql_parse|Query_log_event::do_apply_event|Query_log_event::do_apply_event
      CS  11.4   opt  060625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  MARIADB_ERROR_CODE|MariaDB error code: 1146
      CS  11.8   dbg  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  !thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()|SIGABRT|mysql_execute_command|mysql_parse|Query_log_event::do_apply_event|Query_log_event::do_apply_event
      CS  11.8   opt  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  MARIADB_ERROR_CODE|MariaDB error code: 1146
      CS  12.0   dbg  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  !thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()|SIGABRT|mysql_execute_command|mysql_parse|Query_log_event::do_apply_event|Query_log_event::do_apply_event
      CS  12.0   opt  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  MARIADB_ERROR_CODE|MariaDB error code: 1146
      CS  12.1   dbg  060625  4b79d7b8ee557d53a859aedec839b8673585b514  !thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()|SIGABRT|mysql_execute_command|mysql_parse|Query_log_event::do_apply_event|Query_log_event::do_apply_event
      CS  12.1   opt  060625  4b79d7b8ee557d53a859aedec839b8673585b514  MARIADB_ERROR_CODE|MariaDB error code: 1146
      ES  10.5   dbg  060625  ec7bc4f84e490b25f52db7422a1e0e8bbea72fb1  No bug found                  
      ES  10.5   opt  060625  ec7bc4f84e490b25f52db7422a1e0e8bbea72fb1  No bug found                  
      ES  10.6   dbg  060625  8541ea1e4c2fa15789dd162f6ba4b32681f74e61  No bug found                  
      ES  10.6   opt  060625  8541ea1e4c2fa15789dd162f6ba4b32681f74e61  No bug found                  
      ES  11.4   dbg  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  !thd->in_active_multi_stmt_transaction() || thd->in_multi_stmt_transaction_mode()|SIGABRT|mysql_execute_command|mysql_parse|Query_log_event::do_apply_event|Query_log_event::do_apply_event
      ES  11.4   opt  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  MARIADB_ERROR_CODE|MariaDB error code: 1146
      MS  5.5    dbg  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.5    opt  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.6    dbg  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.6    opt  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.7    dbg  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  8.0    dbg  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  8.0    opt  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  9.1    dbg  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      MS  9.1    opt  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      

      This regression is visible as of 10.11, according to current versions tested. It is not present in 10.6 which gives (in both dbg+opt):

      CS 10.6.22 643319a7fb1e273797c2a1e46d76cfac0fa1da8f (Debug) Build 06/06/2025

      10.6.22-dbg>BINLOG '1iZAZwIBAAAAjQAAAHJ4AAAAACQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYEpAgAAAAAAAIIEnQAAAAAAAAB0ZXN0AGFsdGVyICB0YWJsZSB0NiBhZGQgY29sdW1uIGMgaW50LCBmb3JjZSwgYWxnb3JpdGhtPWNvcHlIBde4';
      ERROR 1730 (HY000): Only Format_description_log_event and row events are allowed in BINLOG statements (but Query was provided)
      

      On a positive note, optimized builds seem to have correct output:

      CS 10.11.14 11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32 (Optimized) Build 06/06/2025

      10.11.14-opt>BINLOG '1iZAZwIBAAAAjQAAAHJ4AAAAACQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYEpAgAAAAAAAIIEnQAAAAAAAAB0ZXN0AGFsdGVyICB0YWJsZSB0NiBhZGQgY29sdW1uIGMgaW50LCBmb3JjZSwgYWxnb3JpdGhtPWNvcHlIBde4';
      ERROR 1146 (42S02): Table 'test.t6' doesn't exist
      

      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.