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

Assertion `trx->undo_no == 1' fails upon ALTER IGNORE

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • ALTER TABLE ... IGNORE could trigger the assertion trx->undo_no == 1 in InnoDB's undo log handling when a duplicate key error occurred during the copy phase.
    • Q1/2026 Server Development

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t (a INT) ENGINE=InnoDB;
      INSERT INTO t VALUES (1),(2),(1),(2);
      ALTER IGNORE TABLE t ADD UNIQUE(a);
       
      DROP TABLE t;
      

      10.11 14f96a2e08073e7fa4aee5b182ca0111380089ad

      mariadbd: /data/bld/10.11-bug/storage/innobase/trx/trx0rec.cc:1931: dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*): Assertion `trx->undo_no == 1' failed.
      260306 12:20:32 [ERROR] /share8t/bld/10.11-bug/sql/mariadbd got signal 6 ;
       
      #8  0x00007f9284845395 in __assert_fail_base (fmt=0x7f92849b9a90 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55caca871320 "trx->undo_no == 1", file=file@entry=0x55caca86eca0 "/data/bld/10.11-bug/storage/innobase/trx/trx0rec.cc", line=line@entry=1931, function=function@entry=0x55caca870f00 "dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*)") at ./assert/assert.c:92
      #9  0x00007f9284853eb2 in __GI___assert_fail (assertion=0x55caca871320 "trx->undo_no == 1", file=0x55caca86eca0 "/data/bld/10.11-bug/storage/innobase/trx/trx0rec.cc", line=1931, function=0x55caca870f00 "dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*)") at ./assert/assert.c:101
      #10 0x000055cac9182c76 in trx_undo_report_row_operation (thr=0x620000011870, index=0x6160009fbe20, clust_entry=0x617000056ea0, update=0x0, cmpl_info=0, rec=0x0, offsets=0x0, roll_ptr=0x7792756b4f70) at /data/bld/10.11-bug/storage/innobase/trx/trx0rec.cc:1931
      #11 0x000055cac925ea29 in btr_cur_ins_lock_and_undo (flags=0, cursor=0x7792756b57d0, entry=0x617000056ea0, thr=0x620000011870, mtr=0x7792756b5bc0, inherit=0x7792756b5100) at /data/bld/10.11-bug/storage/innobase/btr/btr0cur.cc:2352
      #12 0x000055cac92603df in btr_cur_optimistic_insert (flags=0, cursor=0x7792756b57d0, offsets=0x7792756b5700, heap=0x7792756b56e0, entry=0x617000056ea0, rec=0x7792756b5720, big_rec=0x7792756b56c0, n_ext=0, thr=0x620000011870, mtr=0x7792756b5bc0) at /data/bld/10.11-bug/storage/innobase/btr/btr0cur.cc:2579
      #13 0x000055cac8fd03da in row_ins_clust_index_entry_low (flags=0, mode=BTR_MODIFY_LEAF, index=0x6160009fbe20, n_uniq=0, entry=0x617000056ea0, n_ext=0, thr=0x620000011870) at /data/bld/10.11-bug/storage/innobase/row/row0ins.cc:2954
      #14 0x000055cac8fd2d36 in row_ins_clust_index_entry (index=0x6160009fbe20, entry=0x617000056ea0, thr=0x620000011870, n_ext=0) at /data/bld/10.11-bug/storage/innobase/row/row0ins.cc:3357
      #15 0x000055cac8fd3a0e in row_ins_index_entry (index=0x6160009fbe20, entry=0x617000056ea0, thr=0x620000011870) at /data/bld/10.11-bug/storage/innobase/row/row0ins.cc:3502
      #16 0x000055cac8fd4c33 in row_ins_index_entry_step (node=0x6200000115f8, thr=0x620000011870) at /data/bld/10.11-bug/storage/innobase/row/row0ins.cc:3668
      #17 0x000055cac8fd57c2 in row_ins (node=0x6200000115f8, thr=0x620000011870) at /data/bld/10.11-bug/storage/innobase/row/row0ins.cc:3793
      #18 0x000055cac8fd6ac0 in row_ins_step (thr=0x620000011870) at /data/bld/10.11-bug/storage/innobase/row/row0ins.cc:3922
      #19 0x000055cac902a9a8 in row_insert_for_mysql (mysql_rec=0x625000297150 "\375\002", prebuilt=0x620000011120, ins_mode=ROW_INS_NORMAL) at /data/bld/10.11-bug/storage/innobase/row/row0mysql.cc:1296
      #20 0x000055cac8b57eeb in ha_innobase::write_row (this=0x625000296948, record=0x625000297150 "\375\002") at /data/bld/10.11-bug/storage/innobase/handler/ha_innodb.cc:7796
      #21 0x000055cac816e455 in handler::ha_write_row (this=0x625000296948, buf=0x625000297150 "\375\002") at /data/bld/10.11-bug/sql/handler.cc:7808
      #22 0x000055cac7b42374 in copy_data_between_tables (thd=0x62c0001f0218, from=0x6190000bd198, to=0x6190000bef98, ignore=true, order_num=0, order=0x0, copied=0x7792756b8020, deleted=0x7792756b8040, alter_info=0x7792756baf20, alter_ctx=0x7792756ba060) at /data/bld/10.11-bug/sql/sql_table.cc:12429
      #23 0x000055cac7b3b087 in mysql_alter_table (thd=0x62c0001f0218, new_db=0x62c0001f4fc8, new_name=0x62c0001f5428, create_info=0x7792756bb0d0, table_list=0x62d0000a0568, recreate_info=0x7792756bae60, alter_info=0x7792756baf20, order_num=0, order=0x0, ignore=true, if_exists=false) at /data/bld/10.11-bug/sql/sql_table.cc:11597
      #24 0x000055cac7d07986 in Sql_cmd_alter_table::execute (this=0x62d0000a0d90, thd=0x62c0001f0218) at /data/bld/10.11-bug/sql/sql_alter.cc:688
      #25 0x000055cac7836ce7 in mysql_execute_command (thd=0x62c0001f0218, is_called_from_prepared_stmt=false) at /data/bld/10.11-bug/sql/sql_parse.cc:6201
      #26 0x000055cac7843b66 in mysql_parse (thd=0x62c0001f0218, rawbuf=0x62d0000a0438 "ALTER IGNORE TABLE t ADD UNIQUE(a)", length=34, parser_state=0x7792756bca80) at /data/bld/10.11-bug/sql/sql_parse.cc:8223
      #27 0x000055cac7818f86 in dispatch_command (command=COM_QUERY, thd=0x62c0001f0218, packet=0x62900028a219 "ALTER IGNORE TABLE t ADD UNIQUE(a)", packet_length=34, blocking=true) at /data/bld/10.11-bug/sql/sql_parse.cc:1924
      #28 0x000055cac7815c59 in do_command (thd=0x62c0001f0218, blocking=true) at /data/bld/10.11-bug/sql/sql_parse.cc:1434
      #29 0x000055cac7ce867e in do_handle_one_connection (connect=0x6080000195b8, put_in_cache=true) at /data/bld/10.11-bug/sql/sql_connect.cc:1475
      #30 0x000055cac7ce81dd in handle_one_connection (arg=0x608000019538) at /data/bld/10.11-bug/sql/sql_connect.cc:1387
      #31 0x000055cac89288a0 in pfs_spawn_thread (arg=0x617000007e98) at /data/bld/10.11-bug/storage/perfschema/pfs.cc:2201
      #32 0x00007f92848a81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #33 0x00007f928492885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure started happening after this commit in 10.11:

      commit 14f96a2e08073e7fa4aee5b182ca0111380089ad (HEAD -> 10.11, origin/HEAD, origin/10.11)
      Author: Thirunarayanan Balathandayuthapani
      Date:   Thu Mar 5 13:45:58 2026 +0530
       
          MDEV-38928 Assertion `undo_no <= 1' failed in trx_t::reset_and_truncate_undo()
      

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              elenst Elena Stepanova
              Thirunarayanan Balathandayuthapani Thirunarayanan Balathandayuthapani
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.