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

Assertion `n_fields <= index->n_fields' failed

    XMLWordPrintable

Details

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

    Description

      --source include/have_innodb.inc
      --source include/have_debug.inc
      --source include/have_debug_sync.inc
      # A table that already has an instant ADD COLUMN metadata record.
      CREATE TABLE t1(a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
      INSERT INTO t1 VALUES(1,2);
      ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=INSTANT;
      # Kill an instant ADD of two columns after the metadata record update,
      # before the commit, so that recovery rolls it back.
      connect con1,localhost,root;
      SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL s WAIT_FOR ever';
      send ALTER TABLE t1 ADD COLUMN d INT, ADD COLUMN e INT, ALGORITHM=INSTANT;
      connection default;
      SET DEBUG_SYNC='now WAIT_FOR s';
      FLUSH ENGINE LOGS;
      let $shutdown_timeout=0;
      --source include/restart_mysqld.inc
      disconnect con1;
      CHECK TABLE t1;
      SELECT * FROM t1;
      DROP TABLE t1;
      

      Leads to:

      ES 10.6.29-25 4cdc4f0b741fd1a3cc3fc34c7dc197a5b12c65cc (Debug, Clang 22.1.8-20260621) Build 12/10/2026

      mariadbd: /test/10.6-es_dbg/storage/innobase/rem/rem0rec.cc:343: void rec_init_offsets_comp_ordinary(const rec_t *, const dict_index_t *, rec_offs *, ulint, const dict_col_t::def_t *, rec_leaf_format) [mblob = false, redundant_temp = false]: Assertion `n_fields <= index->n_fields' failed.
      

      ES 10.6.29-25 4cdc4f0b741fd1a3cc3fc34c7dc197a5b12c65cc (Debug, Clang 22.1.8-20260621) Build 12/10/2026

      Core was generated by `/test/EMD121026-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 2765125)]
      (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  0x000077416ae4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000077416ae288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000077416ae2881b in __assert_fail_base (fmt=0x77416afd1208 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x63bd03c47182 "n_fields <= index->n_fields", file=file@entry=0x63bd03c4677e "/test/10.6-es_dbg/storage/innobase/rem/rem0rec.cc", line=line@entry=343, function=function@entry=0x63bd03c4836b "void rec_init_offsets_comp_ordinary(const rec_t *, const dict_index_t *, rec_offs *, ulint, const dict_col_t::def_t *, rec_leaf_format) [mblob = false, redundant_temp = false]")at ./assert/assert.c:96
      #6  0x000077416ae3b517 in __assert_fail (assertion=0x63bd03c47182 "n_fields <= index->n_fields", file=0x63bd03c4677e "/test/10.6-es_dbg/storage/innobase/rem/rem0rec.cc", line=343, function=0x63bd03c4836b "void rec_init_offsets_comp_ordinary(const rec_t *, const dict_index_t *, rec_offs *, ulint, const dict_col_t::def_t *, rec_leaf_format) [mblob = false, redundant_temp = false]") at ./assert/assert.c:105
      #7  0x000063bd036f35d1 in rec_init_offsets_comp_ordinary<false, false> (rec=0x6f414427c07f "\200", index=0x63bd30f85ce0, offsets=0x63bd30efb270, n_core=4, def_val=0x0, format=REC_LEAF_INSTANT)at /test/10.6-es_dbg/storage/innobase/rem/rem0rec.cc:343
      #8  0x000063bd036ed5cb in rec_init_offsets (rec=0x6f414427c07f "\200", index=0x63bd30f85ce0, n_core=4, offsets=0x63bd30efb270)at /test/10.6-es_dbg/storage/innobase/rem/rem0rec.cc:651
      #9  0x000063bd036ebf01 in rec_get_offsets_func (rec=0x6f414427c07f "\200", index=0x63bd30f85ce0, offsets=0x63bd30efb270, n_core=4, n_fields=18446744073709551615, file=0x63bd03c6e96d "/test/10.6-es_dbg/storage/innobase/btr/btr0cur.cc", line=403, heap=0x7fff56306d80)at /test/10.6-es_dbg/storage/innobase/rem/rem0rec.cc:938
      #10 0x000063bd0383a4a2 in btr_cur_instant_init_low (index=0x63bd30f85ce0, mtr=0x7fff56307360)at /test/10.6-es_dbg/storage/innobase/btr/btr0cur.cc:401
      #11 0x000063bd03839489 in btr_cur_instant_init (table=0x63bd30f7d340)at /test/10.6-es_dbg/storage/innobase/btr/btr0cur.cc:471
      #12 0x000063bd038d203b in dict_load_table_one (name=@0x7fff563084c8: {data_ = 0x6f414427815d "test/t1", size_ = 7}, ignore_err=DICT_ERR_IGNORE_RECOVER_LOCK, fk_tables=std::deque with 0 elements)at /test/10.6-es_dbg/storage/innobase/dict/dict0load.cc:2486
      #13 0x000063bd038d0e8d in dict_sys_t::load_table (this=0x63bd0439a780 <dict_sys>, name=@0x7fff563084c8: {data_ = 0x6f414427815d "test/t1", size_ = 7}, ignore=DICT_ERR_IGNORE_RECOVER_LOCK)at /test/10.6-es_dbg/storage/innobase/dict/dict0load.cc:2554
      #14 0x000063bd038d2a58 in dict_load_table_on_id (table_id=18, ignore_err=DICT_ERR_IGNORE_RECOVER_LOCK)at /test/10.6-es_dbg/storage/innobase/dict/dict0load.cc:2627
      #15 0x000063bd038ba663 in dict_table_open_on_id (table_id=18, dict_locked=false, table_op=DICT_TABLE_OP_LOAD_TABLESPACE, thd=0x0, mdl=0x0) at /test/10.6-es_dbg/storage/innobase/dict/dict0dict.cc:917
      #16 0x000063bd037f7f8d in trx_resurrect_table_locks (trx=0x77416a9ffb80, undo=@0x63bd30f6fa60: {id = 0, state = 1, trx_id = 29, xid = {formatID = -1, gtrid_length = 0, bqual_length = 140734639408392, data = "\360\2040V\377\177\000\000]\340a\003\275c\000\000\000\000\000\000\000\000\000\000\b\2050V\377\177\000\0000\032\000DAo\000\0000\032\000DAo\000\000\002", '\000' <repeats 11 times>, "\003\000\000\0000\032\000DAo\000\000\003\000\000\000\003\000\000\000\003\000\000\000\003\000\000\000P\2130V\377\177\000\000`\2050V\377\177\000\000\266\344a\003\275c\000\000\005\000\000\000\005\000\000\000P\2130V\377\177\000"}, dict_operation = true, rseg = 0x63bd0438f180 <trx_sys+26880>, hdr_page_no = 310, last_page_no = 310, hdr_offset = 86, size = 1, top_page_no = 310, top_offset = 349, top_undo_no = 3, guess_block = 0x0, undo_list = {prev = 0x0, next = 0x0}})at /test/10.6-es_dbg/storage/innobase/trx/trx0trx.cc:611
      #17 0x000063bd037f7a2f in trx_resurrect (undo=0x63bd30f6fa60, rseg=0x63bd0438f180 <trx_sys+26880>, start_time=1792657380, start_time_micro=4115051029713, rows_to_undo=0x7fff56309010)at /test/10.6-es_dbg/storage/innobase/trx/trx0trx.cc:690
      #18 0x000063bd037f71d9 in trx_lists_init_at_db_start ()at /test/10.6-es_dbg/storage/innobase/trx/trx0trx.cc:747
      #19 0x000063bd037bb67a in srv_start (create_new_db=false)at /test/10.6-es_dbg/storage/innobase/srv/srv0start.cc:1794
      #20 0x000063bd03593c19 in innodb_init (p=0x63bd30e757c8)at /test/10.6-es_dbg/storage/innobase/handler/ha_innodb.cc:4258
      #21 0x000063bd031cbd2f in ha_initialize_handlerton (plugin_=0x63bd30e52980)at /test/10.6-es_dbg/sql/handler.cc:665
      #22 0x000063bd02e6c51f in plugin_do_initialize (plugin=0x63bd30e52980, state=@0x7fff5630b424: 4) at /test/10.6-es_dbg/sql/sql_plugin.cc:1456
      #23 0x000063bd02e6bfb5 in plugin_initialize (tmp_root=0x7fff5630b940, plugin=0x63bd30e52980, argc=0x63bd0455a740 <remaining_argc>, argv=0x63bd30df3eb0, options_only=false)at /test/10.6-es_dbg/sql/sql_plugin.cc:1510
      #24 0x000063bd02e6b8e9 in plugin_init (argc=0x63bd0455a740 <remaining_argc>, argv=0x63bd30df3eb0, flags=0) at /test/10.6-es_dbg/sql/sql_plugin.cc:1766
      #25 0x000063bd02cfcce7 in init_server_components ()at /test/10.6-es_dbg/sql/mysqld.cc:5156
      #26 0x000063bd02cf9bba in mysqld_main (argc=156, argv=0x63bd30df3eb0)at /test/10.6-es_dbg/sql/mysqld.cc:5815
      #27 0x000063bd02cf70d2 in main (argc=23, argv=0x7fff5630df88)at /test/10.6-es_dbg/sql/main.cc:34
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.11  dbg  121026  7aecfef1072045404167edaaba4656edf218a7a8  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      CS  10.11  opt  121026  7aecfef1072045404167edaaba4656edf218a7a8  No bug found                  
      CS  11.4   dbg  121026  fd85202eb2f866bac7117b5a4542b76f438e2780  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      CS  11.4   opt  121026  fd85202eb2f866bac7117b5a4542b76f438e2780  No bug found                  
      CS  11.8   dbg  121026  14362356d14b80242d60dceb9b34f988bbcc9945  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      CS  11.8   opt  121026  14362356d14b80242d60dceb9b34f988bbcc9945  No bug found                  
      CS  12.3   dbg  121026  5e1d303aa6acf34c09309a9d64d750f20fc1921d  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      CS  12.3   opt  121026  5e1d303aa6acf34c09309a9d64d750f20fc1921d  No bug found                  
      CS  13.0   dbg  121026  620a4b5624222048fece7fe1789978ae0675cae2  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      CS  13.0   opt  121026  620a4b5624222048fece7fe1789978ae0675cae2  No bug found                  
      CS  13.2   dbg  121026  cf542109f3389838b4b688b78941797f6a95d51f  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      CS  13.2   opt  121026  cf542109f3389838b4b688b78941797f6a95d51f  No bug found                  
      ES  10.6   dbg  121026  4cdc4f0b741fd1a3cc3fc34c7dc197a5b12c65cc  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      ES  10.6   opt  121026  4cdc4f0b741fd1a3cc3fc34c7dc197a5b12c65cc  No bug found                  
      ES  11.4   dbg  121026  f1a52e7bb41922f37759b2d6a7d7dbd6b779dd40  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      ES  11.4   opt  121026  f1a52e7bb41922f37759b2d6a7d7dbd6b779dd40  No bug found                  
      ES  11.8   dbg  121026  2b449b705bc9223b003a05bed300873361e5e970  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      ES  11.8   opt  121026  2b449b705bc9223b003a05bed300873361e5e970  No bug found                  
      ES  12.3   dbg  121026  b09ac90250cf897f23f243954754ed88c57f4f31  n_fields <= index->n_fields|SIGABRT|rec_init_offsets_comp_ordinary<false, false>|rec_init_offsets|rec_get_offsets_func|btr_cur_instant_init_low
      ES  12.3   opt  121026  b09ac90250cf897f23f243954754ed88c57f4f31  No bug found                  
      

      Attachments

        Activity

          People

            tafzeel Mohammad Tafzeel Shams
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0d
                0d
                Remaining:
                Time Spent - 1.5h Remaining Estimate - 3d
                3d
                Logged:
                Time Spent - 1.5h Remaining Estimate - 3d
                1.5h

                Git Integration

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