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

Assertion undo_no <= 1 in reset_and_truncate_undo during ALTER IGNORE on temporary table

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      --source include/have_innodb.inc
       
      CREATE TEMPORARY TABLE t (c INT) ENGINE=INNODB;
      INSERT INTO t (c) VALUES (0),(0);
      ALTER IGNORE TABLE t CHANGE c c DOUBLE (0,0);
       
      #cleanup 
      DROP TABLE t;
      

      Leads to:

      CS 10.11.17 c84dfbd94d8cd21e473d416773e7cc3641fe488a (Debug, Clang 18.1.3-11) Build 27/02/2026

      mariadbd: /test/10.11_dbg/storage/innobase/handler/ha_innodb.cc:15817: void trx_t::reset_and_truncate_undo(const dict_table_t *): Assertion `undo_no <= 1' failed.
      

      CS 10.11.17 c84dfbd94d8cd21e473d416773e7cc3641fe488a (Debug, Clang 18.1.3-11) Build 27/02/2026

      Core was generated by `/test/MD270226-mariadb-10.11.17-linux-x86_64-dbg/bin/mariadbd --no-defaults --m'.
      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 3199156)]
      #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  0x000072153524527e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #4  0x00007215352288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000072153522881b in __assert_fail_base (fmt=0x7215353d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x64b4a4c2d8d3 "undo_no <= 1", file=file@entry=0x64b4a4c254b8 "/test/10.11_dbg/storage/innobase/handler/ha_innodb.cc", line=line@entry=15817, function=function@entry=0x64b4a4c2d8e0 "void trx_t::reset_and_truncate_undo(const dict_table_t *)") at ./assert/assert.c:96
      #6  0x000072153523b517 in __assert_fail (assertion=0x64b4a4c2d8d3 "undo_no <= 1", file=0x64b4a4c254b8 "/test/10.11_dbg/storage/innobase/handler/ha_innodb.cc", line=15817, function=0x64b4a4c2d8e0 "void trx_t::reset_and_truncate_undo(const dict_table_t *)") at ./assert/assert.c:105
      #7  0x000064b4a435d798 in trx_t::reset_and_truncate_undo (this=0x721534dffb80, table=0x721440054b30) at /test/10.11_dbg/storage/innobase/handler/ha_innodb.cc:15817
      #8  0x000064b4a43422ab in ha_innobase::extra (this=0x72144003cf18, operation=HA_EXTRA_END_COPY) at /test/10.11_dbg/storage/innobase/handler/ha_innodb.cc:15927
      #9  0x000064b4a3ca2156 in copy_data_between_tables (thd=0x721440000d58, from=0x72144018ae88, to=0x721440058d08, ignore=true, order_num=0, order=0x0, copied=0x721534323340, deleted=0x721534323338, alter_info=0x721534326120, alter_ctx=0x7215343241b8) at /test/10.11_dbg/sql/sql_table.cc:12475
      #10 0x000064b4a3c981f4 in mysql_alter_table (thd=0x721440000d58, new_db=0x721440005908, new_name=0x721440005d68, create_info=0x721534326290, table_list=0x721440014778, recreate_info=0x721534325970, alter_info=0x721534326120, order_num=0, order=0x0, ignore=true, if_exists=false) at /test/10.11_dbg/sql/sql_table.cc:11597
      #11 0x000064b4a3d57ade in Sql_cmd_alter_table::execute (this=0x721440014fc8, thd=0x721440000d58) at /test/10.11_dbg/sql/sql_alter.cc:688
      #12 0x000064b4a3b80a19 in mysql_execute_command (thd=0x721440000d58, is_called_from_prepared_stmt=false) at /test/10.11_dbg/sql/sql_parse.cc:6201
      #13 0x000064b4a3b6e754 in mysql_parse (thd=0x721440000d58, rawbuf=0x721440014670 "ALTER IGNORE TABLE t CHANGE c c DOUBLE (0,0)", length=44, parser_state=0x721534327ae0) at /test/10.11_dbg/sql/sql_parse.cc:8223
      #14 0x000064b4a3b6bbf9 in dispatch_command (command=COM_QUERY, thd=0x721440000d58, packet=0x7214400a07a9 "", packet_length=44, blocking=true) at /test/10.11_dbg/sql/sql_parse.cc:1924
      #15 0x000064b4a3b6f303 in do_command (thd=0x721440000d58, blocking=true) at /test/10.11_dbg/sql/sql_parse.cc:1434
      #16 0x000064b4a3d4c9c9 in do_handle_one_connection (connect=0x64b4bb1c3648, put_in_cache=true) at /test/10.11_dbg/sql/sql_connect.cc:1475
      #17 0x000064b4a3d4c762 in handle_one_connection (arg=0x64b4bb27bc18) at /test/10.11_dbg/sql/sql_connect.cc:1387
      #18 0x000072153529caa4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
      #19 0x0000721535329c6c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      The assertion is visible after this commit

      commit e5fed9eaf49419fe81d3695a4323816db1df8e32 (HEAD)
      Author: Thirunarayanan Balathandayuthapani <thiru@mariadb.com>
      Date:   Thu Feb 26 12:07:23 2026 +0530
       
          MDEV-36436  Assertion "unexpected references" == 0 after ALTER IGNORE TABLE
       
          Problem:
          =========
          An assertion failure occurs in InnoDB during consecutive
          ALTER TABLE operations using the COPY algorithm. The crash
          happens during the table rename phase because the
          source table (dict_table_t::n_ref_count) is non-zero, despite
          the thread holding an exclusive Metadata Lock (MDL).
      

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              ramesh Ramesh Sivaraman
              Thirunarayanan Balathandayuthapani Thirunarayanan Balathandayuthapani
              Marko Mäkelä Marko Mäkelä
              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.