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

Assertion `user_table->get_ref_count() == 1' failed during ALTER TABLE conflicting with rollback of recovered transaction

    XMLWordPrintable

Details

    • Can result in hang or crash
    • Q4/2026 Server Maintenance

    Description

        --source include/have_innodb.inc
        --source include/have_debug.inc
        --source include/have_sequence.inc
        CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB;
        INSERT INTO t1 SELECT seq, seq FROM seq_1_to_50000;
        BEGIN;
        UPDATE t1 SET b = b + 1;
        --source include/kill_mysqld.inc
        --source include/start_mysqld.inc
        SET SESSION innodb_lock_wait_timeout = 0;
        --disable_query_log
        --let $i= 100000
        while ($i)
        {
          --error 0,ER_LOCK_WAIT_TIMEOUT
          ALTER TABLE t1 FORCE;
          if (!$mysql_errno) { --let $i= 1 }
          dec $i;
        }
        --enable_query_log
        DROP TABLE t1;
      

      Leads to:

      ES 10.6.29-25 aa3fb9800c358182ee2a1f8cca8ffbdd6d0a37eb (Debug, Clang 22.1.8-20260621) Build 09/09/2026

      mariadbd: /test/10.6-es_dbg/storage/innobase/handler/handler0alter.cc:6663: bool prepare_inplace_alter_table_dict(Alter_inplace_info *, const TABLE *, const TABLE *, const char *, ulint, ulint, ulint, bool, bool): Assertion `user_table->get_ref_count() == 1' failed.
      

      ES 10.6.29-25 aa3fb9800c358182ee2a1f8cca8ffbdd6d0a37eb (Debug, Clang 22.1.8-20260621) Build 09/09/2026

      Core was generated by `/test/EMD090926-mariadb-10.6.29-25-linux-x86_64-dbg/bin/mariadbd --defaults-gro'.
      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 2685562)]
      (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  0x000077c60ca4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000077c60ca288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000077c60ca2881b in __assert_fail_base (fmt=0x77c60cbd1208 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x58ac0d145b04 "user_table->get_ref_count() == 1", file=file@entry=0x58ac0d14216e "/test/10.6-es_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=6663, function=function@entry=0x58ac0d144bd0 "bool prepare_inplace_alter_table_dict(Alter_inplace_info *, const TABLE *, const TABLE *, const char *, ulint, ulint, ulint, bool, bool)") at ./assert/assert.c:96
      #6  0x000077c60ca3b517 in __assert_fail (assertion=0x58ac0d145b04 "user_table->get_ref_count() == 1", file=0x58ac0d14216e "/test/10.6-es_dbg/storage/innobase/handler/handler0alter.cc", line=6663, function=0x58ac0d144bd0 "bool prepare_inplace_alter_table_dict(Alter_inplace_info *, const TABLE *, const TABLE *, const char *, ulint, ulint, ulint, bool, bool)") at ./assert/assert.c:105
      #7  0x000058ac0cae2ef7 in prepare_inplace_alter_table_dict (ha_alter_info=0x77c5ef772098, altered_table=0x77c5ef7723c0, old_table=0x6fc49c015ae8, table_name=0x6fc49c0210fd "t1", flags=33, flags2=80, fts_doc_id_col=18446744073709551615, add_fts_doc_id=false, add_fts_doc_id_idx=false)at /test/10.6-es_dbg/storage/innobase/handler/handler0alter.cc:6663
      #8  0x000058ac0cadee28 in ha_innobase::prepare_inplace_alter_table (this=0x6fc49c023b78, altered_table=0x77c5ef7723c0, ha_alter_info=0x77c5ef772098)at /test/10.6-es_dbg/storage/innobase/handler/handler0alter.cc:8770
      #9  0x000058ac0c6f8201 in handler::ha_prepare_inplace_alter_table (this=0x6fc49c023b78, altered_table=0x77c5ef7723c0, ha_alter_info=0x77c5ef772098) at /test/10.6-es_dbg/sql/handler.cc:5443
      #10 0x000058ac0c46b481 in mysql_inplace_alter_table (thd=0x6fc49c000d58, table_list=0x6fc49c016b88, table=0x6fc49c015ae8, altered_table=0x77c5ef7723c0, ha_alter_info=0x77c5ef772098, target_mdl_request=0x77c5ef774230, ddl_log_state=0x77c5ef772330, trigger_param=0x77c5ef773df8, alter_ctx=0x77c5ef773188)at /test/10.6-es_dbg/sql/sql_table.cc:7850
      #11 0x000058ac0c4653fb in mysql_alter_table (thd=0x6fc49c000d58, new_db=0x6fc49c005818, new_name=0x6fc49c005ca0, create_info=0x77c5ef7752a8, table_list=0x6fc49c016b88, recreate_info=0x77c5ef774998, alter_info=0x77c5ef775138, order_num=0, order=0x0, ignore=false, if_exists=false)at /test/10.6-es_dbg/sql/sql_table.cc:11099
      #12 0x000058ac0c510d66 in Sql_cmd_alter_table::execute (this=0x6fc49c017298, thd=0x6fc49c000d58) at /test/10.6-es_dbg/sql/sql_alter.cc:685
      #13 0x000058ac0c3678a9 in mysql_execute_command (thd=0x6fc49c000d58, is_called_from_prepared_stmt=false)at /test/10.6-es_dbg/sql/sql_parse.cc:6174
      #14 0x000058ac0c3571a8 in mysql_parse (thd=0x6fc49c000d58, rawbuf=0x6fc49c016ab0 "ALTER TABLE t1 FORCE", length=20, parser_state=0x77c5ef776a28) at /test/10.6-es_dbg/sql/sql_parse.cc:8228
      #15 0x000058ac0c3549a1 in dispatch_command (command=COM_QUERY, thd=0x6fc49c000d58, packet=0x6fc49c00aed9 "ALTER TABLE t1 FORCE", packet_length=20, blocking=true) at /test/10.6-es_dbg/sql/sql_parse.cc:1918
      #16 0x000058ac0c357c4f in do_command (thd=0x6fc49c000d58, blocking=true)at /test/10.6-es_dbg/sql/sql_parse.cc:1428
      #17 0x000058ac0c506f5e in do_handle_one_connection (connect=0x58ac2f6460f8, put_in_cache=true) at /test/10.6-es_dbg/sql/sql_connect.cc:1393
      #18 0x000058ac0c506d45 in handle_one_connection (arg=0x58ac2f6460f8)at /test/10.6-es_dbg/sql/sql_connect.cc:1305
      #19 0x000077c60ca9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #20 0x000077c60cb29ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      INFO: no cores found at data*/core nor at node*/core, and no *SAN or Valgrind report found in the error log

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.11  dbg  090926  2753b5919a10abd32ba822877c6a1cbf602d3748  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      CS  10.11  opt  090926  2753b5919a10abd32ba822877c6a1cbf602d3748  Assert: no error log(s) found - exiting
      CS  11.4   dbg  090926  42038e1145dd43b3910055c364fb720a8a152d61  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      CS  11.4   opt  090926  42038e1145dd43b3910055c364fb720a8a152d61  Assert: no error log(s) found - exiting
      CS  11.8   dbg  090926  e2e060ce3d8c3ce11b6c7ba28ced0f1a30c50a54  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      CS  11.8   opt  090926  e2e060ce3d8c3ce11b6c7ba28ced0f1a30c50a54  Assert: no error log(s) found - exiting
      CS  12.3   dbg  090926  e9f84a1fdf7093191e55b55dc14b08b9d4ebaa20  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      CS  12.3   opt  090926  e9f84a1fdf7093191e55b55dc14b08b9d4ebaa20  Assert: no error log(s) found - exiting
      CS  13.0   dbg  090926  b2c4e675049e23ce8c7346985f40840fcd4e583f  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      CS  13.0   opt  090926  b2c4e675049e23ce8c7346985f40840fcd4e583f  Assert: no error log(s) found - exiting
      CS  13.1   dbg  090926  02c842c30dcb05a962eaac58c69920e6be3369cf  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      CS  13.1   opt  090926  02c842c30dcb05a962eaac58c69920e6be3369cf  Assert: no error log(s) found - exiting
      ES  10.6   dbg  090926  aa3fb9800c358182ee2a1f8cca8ffbdd6d0a37eb  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      ES  10.6   opt  090926  aa3fb9800c358182ee2a1f8cca8ffbdd6d0a37eb  Assert: no error log(s) found - exiting
      ES  11.4   dbg  090926  32807340954440071ca8ae8e2de51fb180d134c6  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      ES  11.4   opt  090926  32807340954440071ca8ae8e2de51fb180d134c6  Assert: no error log(s) found - exiting
      ES  11.8   dbg  090926  c4af6f687a2dd983072457429aa2294f11957650  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      ES  11.8   opt  090926  c4af6f687a2dd983072457429aa2294f11957650  Assert: no error log(s) found - exiting
      ES  12.3   dbg  090926  c3bd5108d81f19e33efb93f7b6ae971293732fd0  user_table->get_ref_count() == 1|SIGABRT|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table|handler::ha_prepare_inplace_alter_table|mysql_inplace_alter_table
      ES  12.3   opt  090926  c3bd5108d81f19e33efb93f7b6ae971293732fd0  Assert: no error log(s) found - exiting
      

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 2h 31m Original Estimate - 2h 31m
                2h 31m
                Remaining:
                Time Spent - 1d 4.7h Remaining Estimate - 3h 14m
                3h 14m
                Logged:
                Time Spent - 1d 4.7h Remaining Estimate - 3h 14m
                1d 4.7h

                Git Integration

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