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

Assertion `n_fields > n_cols || type & 32' failed in dict_index_t::init_change_cols on ALTER

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
      CREATE TABLE t (c1 FLOAT KEY) ENGINE=InnoDB;
      ALTER TABLE t MODIFY c1 VARCHAR(1) CHARACTER SET 'latin1' COLLATE 'latin1_bin';
      ALTER TABLE t MODIFY c1 VARCHAR(2049) BINARY CHARACTER SET 'latin1' COLLATE 'latin1_bin',ADD INDEX (c1);
      

      Leads to:

      CS 13.0.1 3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23 (Debug, Clang 21.1.3-20250923) Build 10/04/2026

      mariadbd: /test/13.0_dbg/storage/innobase/include/dict0mem.h:1348: void dict_index_t::init_change_cols(unsigned int): Assertion `n_fields > n_cols || type & 32' failed.
      

      CS 13.0.1 3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23 (Debug, Clang 21.1.3-20250923) Build 10/04/2026

      Core was generated by `/test/MD100426-mariadb-13.0.1-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 795051)]
      (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  0x00007fc4d7a4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007fc4d7a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007fc4d7a2881b in __assert_fail_base (fmt=0x7fc4d7bd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x60bc5fa79b31 "n_fields > n_cols || type & 32", file=file@entry=0x60bc5fabff52 "/test/13.0_dbg/storage/innobase/include/dict0mem.h", line=line@entry=1348, function=function@entry=0x60bc5fa8c953 "void dict_index_t::init_change_cols(unsigned int)") at ./assert/assert.c:94
      #6  0x00007fc4d7a3b507 in __assert_fail (assertion=0x60bc5fa79b31 "n_fields > n_cols || type & 32", file=0x60bc5fabff52 "/test/13.0_dbg/storage/innobase/include/dict0mem.h", line=1348, function=0x60bc5fa8c953 "void dict_index_t::init_change_cols(unsigned int)") at ./assert/assert.c:103
      #7  0x000060bc60f81648 in dict_index_t::init_change_cols (this=0x77c3900081d8, n_cols=1) at include/dict0mem.h:1348
      #8  0x000060bc60f7dd6c in ha_innobase_inplace_ctx::change_col_collation (this=0x77c39001bc78, index=0x77c3900081d8, altered_table=@0x7fc4d4b1f000: {s = 0x7fc4d4b1f3f8, file = 0x77c3900749d8, next = 0x0, prev = 0x0, share_all_next = 0x0, share_all_prev = 0x0, global_free_next = 0x0, global_free_prev = 0x0, in_use = 0x77c390000d58, record = {0x77c390075240 "", 0x77c390075240 "", 0x77c390075240 ""}, write_row_record = 0x0, insert_values = 0x0, covering_keys = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, intersect_keys = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, keys_in_use_for_query = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, keys_in_use_for_group_by = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, keys_in_use_for_order_by = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, keys_in_use_for_rowid_filter = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, constraint_dependent_keys = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, key_info = 0x77c390075c60, field = 0x77c390075a48, vfield = 0x0, default_field = 0x0, next_number_field = 0x0, found_next_number_field = 0x0, check_constraints = 0x0, triggers = 0x0, pos_in_table_list = 0x0, pos_in_locked_tables = 0x0, internal_tables = 0x0, hlindex = 0x0, {group = 0x0, context = 0x0}, alias = {<Charset> = {m_charset = 0x60bc6173aa00 <my_charset_bin>}, <Binary_string> = {<Sql_alloc> = {<No data fields>}, Ptr = 0x77c3900749d0 "t", str_length = 1, Alloced_length = 0, extra_alloc = 0, alloced = false, thread_specific = false}, <No data fields>}, null_flags = 0x77c390075240 "", def_read_set = {bitmap = 0x77c390075e60, last_word_ptr = 0x77c390075e60, last_bit_mask = 18446744073709551614, n_bits = 1, bitmap_allocated = 0 '\000'}, def_write_set = {bitmap = 0x77c390075e68, last_word_ptr = 0x77c390075e68, last_bit_mask = 18446744073709551614, n_bits = 1, bitmap_allocated = 0 '\000'}, tmp_set = {bitmap = 0x77c390075e78, last_word_ptr = 0x77c390075e78, last_bit_mask = 18446744073709551614, n_bits = 1, bitmap_allocated = 0 '\000'}, def_rpl_write_set = {bitmap = 0x77c390075e90, last_word_ptr = 0x77c390075e90, last_bit_mask = 18446744073709551614, n_bits = 1, bitmap_allocated = 0 '\000'}, eq_join_set = {bitmap = 0x77c390075e80, last_word_ptr = 0x77c390075e80, last_bit_mask = 18446744073709551614, n_bits = 1, bitmap_allocated = 0 '\000'}, cond_set = {bitmap = 0x77c390075e88, last_word_ptr = 0x77c390075e88, last_bit_mask = 18446744073709551614, n_bits = 1, bitmap_allocated = 0 '\000'}, read_set = 0x7fc4d4b1f7c0, write_set = 0x7fc4d4b1f7c0, rpl_write_set = 0x0, has_value_set = {bitmap = 0x77c390075e70, last_word_ptr = 0x77c390075e70, last_bit_mask = 18446744073709551614, n_bits = 1, bitmap_allocated = 0 '\000'}, query_id = 0, collected_stats = 0x0, used_stat_records = 0, opt_range_keys = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, opt_range = 0x77c390075a58, const_key_parts = 0x77c390075b60, opt_range_condition_rows = 0, cond_selectivity = 1, cond_selectivity_sampling_explain = 0x0, map = 0, lock_position = 0, lock_data_start = 0, lock_count = 0, tablenr = 0, used_fields = 0, temp_pool_slot = 0, status = 3, db_stat = 0, derived_select_number = 0, maybe_null = 0, max_keys = 0, current_lock = 2, range_rowid_filter_cost_info_elems = 0, instance = 0, copy_blobs = false, next_number_field_updated = false, null_row = false, no_rows_with_nulls = false, null_catch_flags = 0 '\000', force_index = false, force_index_join = false, force_index_order = false, force_index_group = false, distinct = false, const_table = false, no_rows = false, used_for_duplicate_elimination = false, keep_row_order = false, no_keyread = false, locked_by_logger = false, locked_by_name = false, fulltext_searched = false, no_cache = false, open_by_handler = false, auto_increment_field_not_null = false, alias_name_used = false, get_fields_in_item_tree = false, m_needs_reopen = false, created = false, master_had_triggers = false, restore_row_logging = false, stats_is_read = false, histograms_are_read = false, all_partitions_pruned_away = false, vers_write = false, vcol_refix_list = {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x60bc61936f70 <end_of_list>, last = 0x7fc4d4b1f2d8, elements = 0}, <No data fields>}, reginfo = {join_tab = 0x0, lock_type = TL_UNLOCK, skip_locked = false, not_exists_optimize = false, impossible_range = false}, mem_root = {free = 0x77c3900749b8, used = 0x0, pre_alloc = 0x77c3900749b8, min_malloc = 32, block_size = 4064, block_num = 4, first_block_usage = 0, flags = 0, error_handler = 0x60bc60a07eb0 <sql_alloc_error_handler()>, psi_key = 0}, {group_concat = false, blob_storage = 0x0}, grant = {grant_table_user = 0x0, grant_table_role = 0x0, grant_public = 0x0, version = 0, privilege = NO_ACL, want_privilege = NO_ACL, orig_want_privilege = NO_ACL, m_internal = {m_schema_lookup_done = false, m_schema_access = 0x0, m_table_lookup_done = false, m_table_access = 0x0}}, expr_arena = 0x0, part_info = 0x0, mdl_ticket = 0x0, spl_opt_info = 0x0, keys_usable_for_splitting = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, notnull_cond = 0x0, stats_cb = 0x0, online_alter_cache = 0x0, with_impossible_ranges = {static BITS_PER_ELEMENT = 64, static ARRAY_ELEMENTS = 1, static ALL_BITS_SET = 18446744073709551615, buffer = {0}}, range_rowid_filter_cost_info = 0x0, range_rowid_filter_cost_info_ptr = 0x0})at /test/13.0_dbg/storage/innobase/handler/handler0alter.cc:1454
      #9  0x000060bc60f611d9 in prepare_inplace_alter_table_dict (ha_alter_info=0x7fc4d4b1ecd8, altered_table=0x7fc4d4b1f000, old_table=0x77c390034d18, old_opt=0x77c390033f10, table_name=0x77c3900333c5 "t", flags=33, flags2=80, fts_doc_id_col=18446744073709551615, add_fts_doc_id=false, add_fts_doc_id_idx=false)at /test/13.0_dbg/storage/innobase/handler/handler0alter.cc:7362
      #10 0x000060bc60f59600 in ha_innobase::prepare_inplace_alter_table (this=0x77c39006df18, altered_table=0x7fc4d4b1f000, ha_alter_info=0x7fc4d4b1ecd8)at /test/13.0_dbg/storage/innobase/handler/handler0alter.cc:8753
      #11 0x000060bc603e91b1 in handler::ha_prepare_inplace_alter_table (this=0x77c39006df18, altered_table=0x7fc4d4b1f000, ha_alter_info=0x7fc4d4b1ecd8) at /test/13.0_dbg/sql/handler.cc:5994
      #12 0x000060bc609a1398 in mysql_inplace_alter_table (thd=0x77c390000d58, table_list=0x77c39001a288, table=0x77c390034d18, altered_table=0x7fc4d4b1f000, ha_alter_info=0x7fc4d4b1ecd8, target_mdl_request=0x7fc4d4b20ec0, ddl_log_state=0x7fc4d4b1ef70, trigger_param=0x7fc4d4b20ac0, alter_ctx=0x7fc4d4b1fe18, partial_alter=@0x7fc4d4b1ef3d: false, start_alter_id=@0x7fc4d4b1ef30: 0, if_exists=false) at /test/13.0_dbg/sql/sql_table.cc:8255
      #13 0x000060bc6099a428 in mysql_alter_table (thd=0x77c390000d58, new_db=0x77c390005b90, new_name=0x77c390006008, create_info=0x7fc4d4b21f90, table_list=0x77c39001a288, recreate_info=0x7fc4d4b216a8, alter_info=0x7fc4d4b21e18, order_num=0, order=0x0, ignore=false, if_exists=false)at /test/13.0_dbg/sql/sql_table.cc:11812
      #14 0x000060bc60a6e73d in Sql_cmd_alter_table::execute (this=0x77c39001ac20, thd=0x77c390000d58) at /test/13.0_dbg/sql/sql_alter.cc:695
      #15 0x000060bc6086d835 in mysql_execute_command (thd=0x77c390000d58, is_called_from_prepared_stmt=false) at /test/13.0_dbg/sql/sql_parse.cc:5902
      #16 0x000060bc6085e9c8 in mysql_parse (thd=0x77c390000d58, rawbuf=0x77c39001a110 "ALTER TABLE t MODIFY c1 VARCHAR(2049) BINARY CHARACTER SET 'latin1' COLLATE 'latin1_bin',ADD INDEX (c1)", length=103, parser_state=0x7fc4d4b239f0) at /test/13.0_dbg/sql/sql_parse.cc:7941
      #17 0x000060bc6085c11e in dispatch_command (command=COM_QUERY, thd=0x77c390000d58, packet=0x77c39000b4b9 "ALTER TABLE t MODIFY c1 VARCHAR(2049) BINARY CHARACTER SET 'latin1' COLLATE 'latin1_bin',ADD INDEX (c1)", packet_length=103, blocking=true) at /test/13.0_dbg/sql/sql_parse.cc:1898
      #18 0x000060bc6085f44a in do_command (thd=0x77c390000d58, blocking=true)at /test/13.0_dbg/sql/sql_parse.cc:1432
      #19 0x000060bc60a6270e in do_handle_one_connection (connect=0x60bc63b2a828, put_in_cache=true) at /test/13.0_dbg/sql/sql_connect.cc:1503
      #20 0x000060bc60a624f1 in handle_one_connection (arg=0x60bc63aeeb58)at /test/13.0_dbg/sql/sql_connect.cc:1415
      #21 0x00007fc4d7a9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #22 0x00007fc4d7b29c3c 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  100426  f39b634db715cd9dc1835653d1ce544df2aa1613  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      CS  10.6   opt  100426  f39b634db715cd9dc1835653d1ce544df2aa1613  No bug found                  
      CS  10.11  dbg  100426  ba774a0a90fac0163babe9d7a964aa36503e1711  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      CS  10.11  opt  100426  ba774a0a90fac0163babe9d7a964aa36503e1711  No bug found                  
      CS  11.4   dbg  100426  dc89915ad9bf3dcb67e66d2844c77ec0403373de  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      CS  11.4   opt  100426  dc89915ad9bf3dcb67e66d2844c77ec0403373de  No bug found                  
      CS  11.8   dbg  100426  e47db94aea7f0d6e0177e948486fc8860331f05f  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      CS  11.8   opt  100426  e47db94aea7f0d6e0177e948486fc8860331f05f  No bug found                  
      CS  12.3   dbg  100426  f5bb9922107672e88f7b5cbdb3d25151cc5744bb  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      CS  12.3   opt  100426  f5bb9922107672e88f7b5cbdb3d25151cc5744bb  No bug found                  
      CS  13.0   dbg  100426  3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      CS  13.0   opt  100426  3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23  No bug found                  
      ES  10.6   dbg  100426  84a80c8b38208d362225496da08d86d8d454e453  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      ES  10.6   opt  100426  84a80c8b38208d362225496da08d86d8d454e453  No bug found                  
      ES  11.4   dbg  100426  8b2bf17b733262409422ce7d039a0c021fc47077  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      ES  11.4   opt  100426  8b2bf17b733262409422ce7d039a0c021fc47077  No bug found                  
      ES  11.8   dbg  100426  854cae81f52e477c7777a51db26ba640d8755b81  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      ES  11.8   opt  100426  854cae81f52e477c7777a51db26ba640d8755b81  No bug found                  
      ES  12.3   dbg  220426  613a6253fe9efc12e166f83a97663ba263db8317  n_fields > n_cols || type & 32|SIGABRT|dict_index_t::init_change_cols|ha_innobase_inplace_ctx::change_col_collation|prepare_inplace_alter_table_dict|ha_innobase::prepare_inplace_alter_table
      ES  12.3   opt  220426  613a6253fe9efc12e166f83a97663ba263db8317  No bug found                  
      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                  
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.