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

Assertion `fields[i].same(instant.fields[i])' failed in dict_index_t::instant_add_field

Details

    Description

      USE test;
      CREATE TABLE t (a CHAR(198)) ENGINE=InnoDB;
      ALTER TABLE t CHANGE COLUMN a a CHAR(220) BINARY;
      ALTER TABLE t ADD COLUMN b INT FIRST;
      

      Leads to:

      10.5.4 8569dac1ec9f6853a0b2f3ea9bcbda67644ead24

      mysqld: /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:430: void dict_index_t::instant_add_field(const dict_index_t&): Assertion `fields[i].same(instant.fields[i])' failed.
      

      10.5.4 8569dac1ec9f6853a0b2f3ea9bcbda67644ead24

      Core was generated by `/test/MD260520-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x147767d9f700 (LWP 1055573))]
      (gdb) bt
      (gdb) (gdb) #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x000055673b390d7a in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x000055673ab36385 in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x00001477664e3801 in __GI_abort () at abort.c:79
      #6  0x00001477664d339a in __assert_fail_base (fmt=0x14776665a7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55673b78c0c0 "fields[i].same(instant.fields[i])", file=file@entry=0x55673b7829a8 "/test/10.5_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=430, function=function@entry=0x55673b787b40 <dict_index_t::instant_add_field(dict_index_t const&)::__PRETTY_FUNCTION__> "void dict_index_t::instant_add_field(const dict_index_t&)") at assert.c:92
      #7  0x00001477664d3412 in __GI___assert_fail (assertion=assertion@entry=0x55673b78c0c0 "fields[i].same(instant.fields[i])", file=file@entry=0x55673b7829a8 "/test/10.5_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=430, function=function@entry=0x55673b787b40 <dict_index_t::instant_add_field(dict_index_t const&)::__PRETTY_FUNCTION__> "void dict_index_t::instant_add_field(const dict_index_t&)") at assert.c:101
      #8  0x000055673af35a42 in dict_index_t::instant_add_field (this=this@entry=0x147745081a18, instant=@0x147745081d98: {static MAX_N_FIELDS = 1023, id = 0, heap = 0x147745063818, name = {m_name = 0x1477450c7b98 "GEN_CLUST_INDEX"}, table = 0x147745053998, page = 4294967295, merge_threshold = 50, type = 1, trx_id_offset = 6, n_user_defined_cols = 0, nulls_equal = 0, n_uniq = 1, n_def = 5, n_fields = 5, n_nullable = 2, n_core_fields = 4, n_core_null_bytes = 1, static NO_CORE_NULL_BYTES = 255, static DICT_INDEXES_ID = 3, cached = 1, to_be_dropped = 0, online_status = 0, uncommitted = 0, is_dummy = false, in_instant_init = false, magic_n = 76789786, fields = 0x147745043fd0, parser = 0x0, has_new_v_col = false, indexes = {prev = 0x0, next = 0x0}, search_info = 0x1477450c7c40, online_log = 0x0, stat_n_diff_key_vals = 0x1477450c7c28, stat_n_sample_sizes = 0x1477450c7c30, stat_n_non_null_key_vals = 0x1477450c7c38, stat_index_size = 1, stat_n_leaf_pages = 1, stats_error_printed = false, stat_defrag_modified_counter = 0, stat_defrag_n_pages_freed = 0, stat_defrag_n_page_split = 0, stat_defrag_data_size_sample = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, stat_defrag_sample_next_slot = 0, rtr_ssn = {m = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, rtr_track = 0x0, trx_id = 0, zip_pad = {mutex = {m_impl = {m_freed = false, m_locked = false, m_destroy_at_exit = true, m_mutex = {m_freed = false, m_mutex = pthread_mutex_t = {
                      Type = Normal,
                      Status = Not acquired,
                      Robust = No,
                      Shared = No,
                      Protocol = None
                    }}, m_policy = {context = {<latch_t> = {_vptr.latch_t = 0x55673beecf80 <vtable for MutexDebug<OSTrackMutex<GenericPolicy> >+16>, m_id = LATCH_ID_ZIP_PAD_MUTEX, m_rw_lock = false}, m_mutex = 0x0, m_filename = 0x0, m_line = 0, m_thread_id = 18446744073709551615, m_debug_mutex = {m_freed = false, m_mutex = pthread_mutex_t = {
                          Type = Normal,
                          Status = Not acquired,
                          Robust = No,
                          Shared = No,
                          Protocol = None
                        }}}, m_count = {m_spins = 0, m_waits = 0, m_calls = 0, m_enabled = false}, m_id = LATCH_ID_ZIP_PAD_MUTEX}}, m_ptr = 0x0}, pad = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, success = 0, failure = 0, n_rounds = 0}, lock = {<latch_t> = {_vptr.latch_t = 0x55673beed538 <vtable for rw_lock_t+16>, m_id = LATCH_ID_INDEX_TREE, m_rw_lock = true}, lock_word = {m = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = 536870912}, <No data fields>}}, waiters = {m = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, sx_recursive = 0, writer_is_wait_ex = false, writer_thread = 0, event = 0x147745061df8, wait_ex_event = 0x147745061e98, cfile_name = 0x55673b83f0b0 "/test/10.5_dbg/storage/innobase/dict/dict0dict.cc", last_x_file_name = 0x55673b8007e1 "not yet reserved", cline = 2139, is_block_lock = 0, last_x_line = 0, count_os_wait = 0, list = {prev = 0x0, next = 0x147745053b50}, pfs_psi = 0x0, debug_list = {count = 0, start = 0x0, end = 0x0, node = &rw_lock_debug_t::list, init = 51966}, level = SYNC_INDEX_TREE}}) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:430
      #9  0x000055673af3f3e9 in dict_table_t::instant_column (this=0x147745052598, table=<optimized out>, col_map=<optimized out>) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:604
      #10 0x000055673af3f9f4 in ha_innobase_inplace_ctx::instant_column (this=this@entry=0x147745075780) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:1050
      #11 0x000055673af3fc4a in innobase_instant_try (ha_alter_info=ha_alter_info@entry=0x147767d9a9c0, ctx=ctx@entry=0x147745075780, altered_table=altered_table@entry=0x147767d9aa60, table=table@entry=0x1477450fa088, trx=trx@entry=0x1477538033b0) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:5629
      #12 0x000055673af4343f in commit_try_norebuild (ha_alter_info=ha_alter_info@entry=0x147767d9a9c0, ctx=ctx@entry=0x147745075780, altered_table=altered_table@entry=0x147767d9aa60, old_table=0x1477450fa088, trx=0x1477538033b0, table_name=<optimized out>) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:10179
      #13 0x000055673af2fae6 in ha_innobase::commit_inplace_alter_table (this=0x1477450376a0, altered_table=0x147767d9aa60, ha_alter_info=0x147767d9a9c0, commit=true) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:10899
      #14 0x000055673ab44943 in handler::ha_commit_inplace_alter_table (this=0x1477450376a0, altered_table=altered_table@entry=0x147767d9aa60, ha_alter_info=ha_alter_info@entry=0x147767d9a9c0, commit=commit@entry=true) at /test/10.5_dbg/sql/handler.cc:4732
      #15 0x000055673a9566fa in mysql_inplace_alter_table (thd=thd@entry=0x147745015088, table_list=0x147745074198, table=table@entry=0x1477450fa088, altered_table=altered_table@entry=0x147767d9aa60, ha_alter_info=ha_alter_info@entry=0x147767d9a9c0, inplace_supported=inplace_supported@entry=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x147767d9b820, alter_ctx=0x147767d9c6b0) at /test/10.5_dbg/sql/sql_table.cc:7920
      #16 0x000055673a962acf in mysql_alter_table (thd=thd@entry=0x147745015088, new_db=new_db@entry=0x147745019948, new_name=new_name@entry=0x147745019d50, create_info=create_info@entry=0x147767d9d2a0, table_list=<optimized out>, table_list@entry=0x147745074198, alter_info=alter_info@entry=0x147767d9d1d0, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.5_dbg/sql/sql_table.cc:10442
      #17 0x000055673a9e6572 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x147745015088) at /test/10.5_dbg/sql/sql_alter.cc:532
      #18 0x000055673a89173b in mysql_execute_command (thd=thd@entry=0x147745015088) at /test/10.5_dbg/sql/sql_parse.cc:5950
      #19 0x000055673a89902e in mysql_parse (thd=thd@entry=0x147745015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x147767d9e3d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7991
      #20 0x000055673a885b42 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x147745015088, packet=packet@entry=0x147745067089 "ALTER TABLE t ADD COLUMN b INT FIRST", packet_length=packet_length@entry=36, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874
      #21 0x000055673a88431c in do_command (thd=0x147745015088) at /test/10.5_dbg/sql/sql_parse.cc:1355
      #22 0x000055673a9de73f in do_handle_one_connection (connect=<optimized out>, connect@entry=0x147746c453a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
      #23 0x000055673a9dee5b in handle_one_connection (arg=arg@entry=0x147746c453a8) at /test/10.5_dbg/sql/sql_connect.cc:1313
      #24 0x000055673ae3e14e in pfs_spawn_thread (arg=0x147765845888) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #25 0x00001477671c66db in start_thread (arg=0x147767d9f700) at pthread_create.c:463
      #26 0x00001477665c488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.14 (dbg), 10.5.4 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (opt), 10.5.4 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      Attachments

        Issue Links

          Activity

            I think that the condition for ROW_FORMAT is bogus when it comes to CHAR columns. We should instead check if the character set is variable-length. With the following fix, the test case works for me:

            diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
            index f85ee3f26fb..d0b1bbc8a33 100644
            --- a/storage/innobase/handler/ha_innodb.cc
            +++ b/storage/innobase/handler/ha_innodb.cc
            @@ -20986,43 +20986,34 @@ is_part_of_a_primary_key(const Field* field)
             	       && field->part_of_key.is_set(s->primary_key);
             }
             
            -bool
            -ha_innobase::can_convert_string(const Field_string* field,
            -				const Column_definition& new_type) const
            +bool ha_innobase::can_convert_string(const Field_string *field,
            +                                     const Column_definition &new_type) const
             {
            -	DBUG_ASSERT(!field->compression_method());
            -	if (new_type.type_handler() != field->type_handler()) {
            -		return false;
            -	}
            +  DBUG_ASSERT(!field->compression_method());
            +  if (new_type.type_handler() != field->type_handler())
            +    return false;
             
            -	if (new_type.char_length < field->char_length()) {
            -		return false;
            -	}
            +  if (new_type.char_length < field->char_length())
            +    return false;
             
            -	if (new_type.charset != field->charset()) {
            -		if (new_type.length != field->max_display_length()
            -		    && !m_prebuilt->table->not_redundant()) {
            -			return IS_EQUAL_NO;
            -		}
            +  const Charset field_cs(field->charset());
             
            -		Charset field_cs(field->charset());
            -		if (!field_cs.encoding_allows_reinterpret_as(
            -			new_type.charset)) {
            -			return false;
            -		}
            +  if (field_cs.mbminlen() == field_cs.mbmaxlen() &&
            +      new_type.length != field->max_display_length())
            +    return false;
             
            -		if (!field_cs.eq_collation_specific_names(new_type.charset)) {
            -			return !is_part_of_a_primary_key(field);
            -		}
            +  if (new_type.charset != field->charset())
            +  {
            +    if (!field_cs.encoding_allows_reinterpret_as(new_type.charset))
            +      return false;
             
            -		return true;
            -	}
            +    if (!field_cs.eq_collation_specific_names(new_type.charset))
            +      return !is_part_of_a_primary_key(field);
             
            -	if (new_type.length != field->max_display_length()) {
            -		return false;
            -	}
            +    return true;
            +  }
             
            -	return true;
            +  return true;
             }
             
             static bool
            

            The essential fix is that we remove the code that returned IS_EQUAL_NO, and enforce the ‘enlargement check’ independent of any charset change:

              if (field_cs.mbminlen() == field_cs.mbmaxlen() &&
                  new_type.length != field->max_display_length())
                return false;
            

            This also replaces the check at the very end of the function.

            marko Marko Mäkelä added a comment - I think that the condition for ROW_FORMAT is bogus when it comes to CHAR columns. We should instead check if the character set is variable-length. With the following fix, the test case works for me: diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f85ee3f26fb..d0b1bbc8a33 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -20986,43 +20986,34 @@ is_part_of_a_primary_key(const Field* field) && field->part_of_key.is_set(s->primary_key); } -bool -ha_innobase::can_convert_string(const Field_string* field, - const Column_definition& new_type) const +bool ha_innobase::can_convert_string(const Field_string *field, + const Column_definition &new_type) const { - DBUG_ASSERT(!field->compression_method()); - if (new_type.type_handler() != field->type_handler()) { - return false; - } + DBUG_ASSERT(!field->compression_method()); + if (new_type.type_handler() != field->type_handler()) + return false; - if (new_type.char_length < field->char_length()) { - return false; - } + if (new_type.char_length < field->char_length()) + return false; - if (new_type.charset != field->charset()) { - if (new_type.length != field->max_display_length() - && !m_prebuilt->table->not_redundant()) { - return IS_EQUAL_NO; - } + const Charset field_cs(field->charset()); - Charset field_cs(field->charset()); - if (!field_cs.encoding_allows_reinterpret_as( - new_type.charset)) { - return false; - } + if (field_cs.mbminlen() == field_cs.mbmaxlen() && + new_type.length != field->max_display_length()) + return false; - if (!field_cs.eq_collation_specific_names(new_type.charset)) { - return !is_part_of_a_primary_key(field); - } + if (new_type.charset != field->charset()) + { + if (!field_cs.encoding_allows_reinterpret_as(new_type.charset)) + return false; - return true; - } + if (!field_cs.eq_collation_specific_names(new_type.charset)) + return !is_part_of_a_primary_key(field); - if (new_type.length != field->max_display_length()) { - return false; - } + return true; + } - return true; + return true; } static bool The essential fix is that we remove the code that returned IS_EQUAL_NO , and enforce the ‘enlargement check’ independent of any charset change: if (field_cs.mbminlen() == field_cs.mbmaxlen() && new_type.length != field->max_display_length()) return false ; This also replaces the check at the very end of the function.

            I forgot that for ROW_FORMAT=REDUNDANT, we cannot support any CHAR extension even for variable-length character sets, because the optimization related to trying to allocate n*mbminlen bytes for CHAR only applies to ROW_FORMAT=COMPACT and later formats. For COMPACT and DYNAMIC, I would still get a failure

            10.4 with tentative fix

            CURRENT_TEST: innodb.instant_alter_extend
            mysqltest: At line 61: query 'select count(a) from t where a = @bigval' failed: 2013: Lost connection to MySQL server during query
            mysqld: /mariadb/10.4/storage/innobase/row/row0sel.cc:2806: void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint): Assertion `len * templ->mbmaxlen >= templ->mysql_col_len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0) || templ->rec_field_is_prefix' failed.
            

            We are reading a row from the table, and the column had a length of 600 bytes, corresponding to CHAR(200) in {my_charset_utf8_general_ci}}, while the column had meanwhile been extended to CHAR(220). For compatibility with DML code, we must not allow any instantaneous change of the number of characters. We can only allow a change of bytes when the number of characters remains unchanged.
            I am now testing the following change:

            diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
            index f85ee3f26fb..6d100576c20 100644
            --- a/storage/innobase/handler/ha_innodb.cc
            +++ b/storage/innobase/handler/ha_innodb.cc
            @@ -20986,43 +20986,35 @@ is_part_of_a_primary_key(const Field* field)
             	       && field->part_of_key.is_set(s->primary_key);
             }
             
            -bool
            -ha_innobase::can_convert_string(const Field_string* field,
            -				const Column_definition& new_type) const
            +bool ha_innobase::can_convert_string(const Field_string *field,
            +                                     const Column_definition &new_type) const
             {
            -	DBUG_ASSERT(!field->compression_method());
            -	if (new_type.type_handler() != field->type_handler()) {
            -		return false;
            -	}
            +  DBUG_ASSERT(!field->compression_method());
            +  if (new_type.type_handler() != field->type_handler())
            +    return false;
             
            -	if (new_type.char_length < field->char_length()) {
            -		return false;
            -	}
            +  if (new_type.char_length != field->char_length())
            +    return false;
             
            -	if (new_type.charset != field->charset()) {
            -		if (new_type.length != field->max_display_length()
            -		    && !m_prebuilt->table->not_redundant()) {
            -			return IS_EQUAL_NO;
            -		}
            +  const Charset field_cs(field->charset());
             
            -		Charset field_cs(field->charset());
            -		if (!field_cs.encoding_allows_reinterpret_as(
            -			new_type.charset)) {
            -			return false;
            -		}
            +  if (new_type.length != field->max_display_length() &&
            +      (!m_prebuilt->table->not_redundant() ||
            +       field_cs.mbminlen() == field_cs.mbmaxlen()))
            +    return false;
             
            -		if (!field_cs.eq_collation_specific_names(new_type.charset)) {
            -			return !is_part_of_a_primary_key(field);
            -		}
            +  if (new_type.charset != field->charset())
            +  {
            +    if (!field_cs.encoding_allows_reinterpret_as(new_type.charset))
            +      return false;
             
            -		return true;
            -	}
            +    if (!field_cs.eq_collation_specific_names(new_type.charset))
            +      return !is_part_of_a_primary_key(field);
             
            -	if (new_type.length != field->max_display_length()) {
            -		return false;
            -	}
            +    return true;
            +  }
             
            -	return true;
            +  return true;
             }
             
             static bool
            

            marko Marko Mäkelä added a comment - I forgot that for ROW_FORMAT=REDUNDANT , we cannot support any CHAR extension even for variable-length character sets, because the optimization related to trying to allocate n*mbminlen bytes for CHAR only applies to ROW_FORMAT=COMPACT and later formats. For COMPACT and DYNAMIC , I would still get a failure 10.4 with tentative fix CURRENT_TEST: innodb.instant_alter_extend mysqltest: At line 61: query 'select count(a) from t where a = @bigval' failed: 2013: Lost connection to MySQL server during query … mysqld: /mariadb/10.4/storage/innobase/row/row0sel.cc:2806: void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint): Assertion `len * templ->mbmaxlen >= templ->mysql_col_len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0) || templ->rec_field_is_prefix' failed. We are reading a row from the table, and the column had a length of 600 bytes, corresponding to CHAR(200) in {my_charset_utf8_general_ci}}, while the column had meanwhile been extended to CHAR(220) . For compatibility with DML code, we must not allow any instantaneous change of the number of characters. We can only allow a change of bytes when the number of characters remains unchanged. I am now testing the following change: diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f85ee3f26fb..6d100576c20 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -20986,43 +20986,35 @@ is_part_of_a_primary_key(const Field* field) && field->part_of_key.is_set(s->primary_key); } -bool -ha_innobase::can_convert_string(const Field_string* field, - const Column_definition& new_type) const +bool ha_innobase::can_convert_string(const Field_string *field, + const Column_definition &new_type) const { - DBUG_ASSERT(!field->compression_method()); - if (new_type.type_handler() != field->type_handler()) { - return false; - } + DBUG_ASSERT(!field->compression_method()); + if (new_type.type_handler() != field->type_handler()) + return false; - if (new_type.char_length < field->char_length()) { - return false; - } + if (new_type.char_length != field->char_length()) + return false; - if (new_type.charset != field->charset()) { - if (new_type.length != field->max_display_length() - && !m_prebuilt->table->not_redundant()) { - return IS_EQUAL_NO; - } + const Charset field_cs(field->charset()); - Charset field_cs(field->charset()); - if (!field_cs.encoding_allows_reinterpret_as( - new_type.charset)) { - return false; - } + if (new_type.length != field->max_display_length() && + (!m_prebuilt->table->not_redundant() || + field_cs.mbminlen() == field_cs.mbmaxlen())) + return false; - if (!field_cs.eq_collation_specific_names(new_type.charset)) { - return !is_part_of_a_primary_key(field); - } + if (new_type.charset != field->charset()) + { + if (!field_cs.encoding_allows_reinterpret_as(new_type.charset)) + return false; - return true; - } + if (!field_cs.eq_collation_specific_names(new_type.charset)) + return !is_part_of_a_primary_key(field); - if (new_type.length != field->max_display_length()) { - return false; - } + return true; + } - return true; + return true; } static bool

            The following test case change would also trigger another assertion failure:

            diff --git a/mysql-test/suite/innodb/t/instant_alter_extend.test b/mysql-test/suite/innodb/t/instant_alter_extend.test
            index 4320d9bae05..7258ba6d238 100644
            --- a/mysql-test/suite/innodb/t/instant_alter_extend.test
            +++ b/mysql-test/suite/innodb/t/instant_alter_extend.test
            @@ -64,6 +64,15 @@ select a, length(a) from t where a = 'z';
             check table t extended;
             call check_table('t');
             
            +--enable_info
            +ALTER TABLE t CHANGE COLUMN a a CHAR(230) BINARY;
            +ALTER TABLE t ADD COLUMN b INT FIRST;
            +ALTER TABLE t DROP b;
            +--disable_info
            +
            +check table t extended;
            +call check_table('t');
            +
             --echo # Convert from VARCHAR to a bigger CHAR
             --enable_info
             alter table t modify a varchar(200);
            

            10.4 0a7faed75ad49b99bace0882f89e08639c85679b

            innodb.instant_alter_extend 'debug,dynamic,innodb,utf8' [ fail ]
                    Test ended at 2020-07-20 14:25:44
             
            CURRENT_TEST: innodb.instant_alter_extend
            mysqltest: At line 78: query 'alter table t modify a varchar(200)' failed: 2013: Lost connection to MySQL server during query
            mysqld: /mariadb/10.4/storage/innobase/row/row0sel.cc:2806: void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint): Assertion `len * templ->mbmaxlen >= templ->mysql_col_len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0) || templ->rec_field_is_prefix' failed.
            

            marko Marko Mäkelä added a comment - The following test case change would also trigger another assertion failure: diff --git a/mysql-test/suite/innodb/t/instant_alter_extend.test b/mysql-test/suite/innodb/t/instant_alter_extend.test index 4320d9bae05..7258ba6d238 100644 --- a/mysql-test/suite/innodb/t/instant_alter_extend.test +++ b/mysql-test/suite/innodb/t/instant_alter_extend.test @@ -64,6 +64,15 @@ select a, length(a) from t where a = 'z'; check table t extended; call check_table('t'); +--enable_info +ALTER TABLE t CHANGE COLUMN a a CHAR(230) BINARY; +ALTER TABLE t ADD COLUMN b INT FIRST; +ALTER TABLE t DROP b; +--disable_info + +check table t extended; +call check_table('t'); + --echo # Convert from VARCHAR to a bigger CHAR --enable_info alter table t modify a varchar(200); 10.4 0a7faed75ad49b99bace0882f89e08639c85679b innodb.instant_alter_extend 'debug,dynamic,innodb,utf8' [ fail ] Test ended at 2020-07-20 14:25:44   CURRENT_TEST: innodb.instant_alter_extend mysqltest: At line 78: query 'alter table t modify a varchar(200)' failed: 2013: Lost connection to MySQL server during query … mysqld: /mariadb/10.4/storage/innobase/row/row0sel.cc:2806: void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint): Assertion `len * templ->mbmaxlen >= templ->mysql_col_len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0) || templ->rec_field_is_prefix' failed.
            Roel Roel Van de Paar added a comment - - edited

            Another similar testcase.

            USE test;
            CREATE TABLE t (c CHAR(255), PRIMARY KEY (c)) CHARSET=utf8;
            ALTER TABLE t ADD COLUMN b INT FIRST;
            SET GLOBAL INNODB_DEFAULT_ROW_FORMAT = 0;
            ALTER TABLE t ADD COLUMN a INT FIRST;
            

            Leads to:

            10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b (Debug)

            mysqld: /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:417: void dict_index_t::instant_add_field(const dict_index_t&): Assertion `trx_id_offset == instant.trx_id_offset' failed.
            

            10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b (Debug)

            Core was generated by `/test/MD140720-mariadb-10.5.5-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
                at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
            [Current thread is 1 (Thread 0x1487b10ff700 (LWP 999380))]
            (gdb) bt
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
            #1  0x0000561dcf67b4d7 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
            #2  0x0000561dcee359ba in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
            #3  <signal handler called>
            #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
            #5  0x00001487af3958b1 in __GI_abort () at abort.c:79
            #6  0x00001487af38542a in __assert_fail_base (fmt=0x1487af50ca38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x561dcfa78900 "trx_id_offset == instant.trx_id_offset", file=file@entry=0x561dcfa6f428 "/test/10.5_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=417, function=function@entry=0x561dcfa745a0 <dict_index_t::instant_add_field(dict_index_t const&)::__PRETTY_FUNCTION__> "void dict_index_t::instant_add_field(const dict_index_t&)") at assert.c:92
            #7  0x00001487af3854a2 in __GI___assert_fail (assertion=assertion@entry=0x561dcfa78900 "trx_id_offset == instant.trx_id_offset", file=file@entry=0x561dcfa6f428 "/test/10.5_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=417, function=function@entry=0x561dcfa745a0 <dict_index_t::instant_add_field(dict_index_t const&)::__PRETTY_FUNCTION__> "void dict_index_t::instant_add_field(const dict_index_t&)") at assert.c:101
            #8  0x0000561dcf239900 in dict_index_t::instant_add_field (this=this@entry=0x14878d0dc698, instant=@0x14878d0dd818: {static MAX_N_FIELDS = 1023, id = 0, heap = 0x14878d063718, name = {m_name = 0x14878d0e8298 "PRIMARY"}, table = 0x14878d055298, page = 4294967295, merge_threshold = 50, type = 3, trx_id_offset = 765, n_user_defined_cols = 1, nulls_equal = 0, n_uniq = 1, n_def = 5, n_fields = 5, n_nullable = 2, n_core_fields = 3, n_core_null_bytes = 0, static NO_CORE_NULL_BYTES = 255, static DICT_INDEXES_ID = 3, cached = 1, to_be_dropped = 0, online_status = 0, uncommitted = 0, is_dummy = false, in_instant_init = false, magic_n = 76789786, fields = 0x14878d043ff0, parser = 0x0, has_new_v_col = false, indexes = {prev = 0x0, next = 0x0}, search_info = 0x14878d0e8368, online_log = 0x0, stat_n_diff_key_vals = 0x14878d0e8350, stat_n_sample_sizes = 0x14878d0e8358, stat_n_non_null_key_vals = 0x14878d0e8360, stat_index_size = 1, stat_n_leaf_pages = 1, stats_error_printed = false, stat_defrag_modified_counter = 0, stat_defrag_n_pages_freed = 0, stat_defrag_n_page_split = 0, stat_defrag_data_size_sample = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, stat_defrag_sample_next_slot = 0, rtr_ssn = {m = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, rtr_track = 0x0, trx_id = 0, zip_pad = {mutex = {m_impl = {m_freed = false, m_locked = false, m_destroy_at_exit = true, m_mutex = {m_freed = false, m_mutex = pthread_mutex_t = {
                            Type = Normal,
                            Status = Not acquired,
                            Robust = No,
                            Shared = No,
                            Protocol = None
                          }}, m_policy = {context = {<latch_t> = {_vptr.latch_t = 0x561dd01d1fa0 <vtable for MutexDebug<OSTrackMutex<GenericPolicy> >+16>, m_id = LATCH_ID_ZIP_PAD_MUTEX, m_rw_lock = false}, m_mutex = 0x0, m_filename = 0x0, m_line = 0, m_thread_id = 18446744073709551615, m_debug_mutex = {m_freed = false, m_mutex = pthread_mutex_t = {
                                Type = Normal,
                                Status = Not acquired,
                                Robust = No,
                                Shared = No,
                                Protocol = None
                              }}}, m_filename = 0x561dcfb2f068 "/test/10.5_dbg/storage/innobase/dict/dict0mem.cc", m_line = 807, m_count = {m_spins = 0, m_waits = 0, m_calls = 0, m_enabled = false}, m_id = LATCH_ID_ZIP_PAD_MUTEX}}, m_ptr = 0x0}, pad = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, success = 0, failure = 0, n_rounds = 0}, lock = {<latch_t> = {_vptr.latch_t = 0x561dd01d2510 <vtable for rw_lock_t+16>, m_id = LATCH_ID_INDEX_TREE, m_rw_lock = true}, <ilist_node<void>> = {next = 0x14878d055460, prev = 0x561dd0c95520 <rw_lock_list>}, created = true, lock_word = {m = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = 536870912}, <No data fields>}}, waiters = {m = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, sx_recursive = 0, writer_is_wait_ex = false, writer_thread = 0, event = 0x14878d061178, wait_ex_event = 0x14878d0617b8, cfile_name = 0x561dcfb274b0 "/test/10.5_dbg/storage/innobase/dict/dict0dict.cc", last_x_file_name = 0x561dcfaeb4af "not yet reserved", cline = 2155, is_block_lock = 0, last_x_line = 0, count_os_wait = 0, pfs_psi = 0x0, debug_list = {count = 0, start = 0x0, end = 0x0, node = &rw_lock_debug_t::list, init = 51966}, level = SYNC_INDEX_TREE}}) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:417
            #9  0x0000561dcf2434af in dict_table_t::instant_column (this=0x14878d052f98, table=<optimized out>, col_map=<optimized out>) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:604
            #10 0x0000561dcf243aba in ha_innobase_inplace_ctx::instant_column (this=this@entry=0x14878d075b10) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:1050
            #11 0x0000561dcf243d10 in innobase_instant_try (ha_alter_info=ha_alter_info@entry=0x1487b10fb330, ctx=ctx@entry=0x14878d075b10, altered_table=altered_table@entry=0x1487b10fb3d0, table=table@entry=0x14878d053988, trx=trx@entry=0x14879bc03578) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:5629
            #12 0x0000561dcf2474e6 in commit_try_norebuild (ha_alter_info=ha_alter_info@entry=0x1487b10fb330, ctx=ctx@entry=0x14878d075b10, altered_table=altered_table@entry=0x1487b10fb3d0, old_table=0x14878d053988, trx=0x14879bc03578, table_name=<optimized out>) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:10179
            #13 0x0000561dcf233b54 in ha_innobase::commit_inplace_alter_table (this=0x14878d0394a0, altered_table=0x1487b10fb3d0, ha_alter_info=0x1487b10fb330, commit=true) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:10900
            #14 0x0000561dcee44665 in handler::ha_commit_inplace_alter_table (this=0x14878d0394a0, altered_table=altered_table@entry=0x1487b10fb3d0, ha_alter_info=ha_alter_info@entry=0x1487b10fb330, commit=commit@entry=true) at /test/10.5_dbg/sql/handler.cc:4839
            #15 0x0000561dcec51686 in mysql_inplace_alter_table (thd=thd@entry=0x14878d015088, table_list=0x14878d074198, table=table@entry=0x14878d053988, altered_table=altered_table@entry=0x1487b10fb3d0, ha_alter_info=ha_alter_info@entry=0x1487b10fb330, inplace_supported=inplace_supported@entry=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x1487b10fb7a0, alter_ctx=0x1487b10fc630) at /test/10.5_dbg/sql/sql_table.cc:8038
            #16 0x0000561dcec61cb1 in mysql_alter_table (thd=thd@entry=0x14878d015088, new_db=new_db@entry=0x14878d019948, new_name=new_name@entry=0x14878d019d50, create_info=create_info@entry=0x1487b10fd220, table_list=<optimized out>, table_list@entry=0x14878d074198, alter_info=alter_info@entry=0x1487b10fd150, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.5_dbg/sql/sql_table.cc:10564
            #17 0x0000561dcece5a6a in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x14878d015088) at /test/10.5_dbg/sql/sql_alter.cc:532
            #18 0x0000561dceb8ee4a in mysql_execute_command (thd=thd@entry=0x14878d015088) at /test/10.5_dbg/sql/sql_parse.cc:5951
            #19 0x0000561dceb96752 in mysql_parse (thd=thd@entry=0x14878d015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1487b10fe350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7993
            #20 0x0000561dceb83204 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14878d015088, packet=packet@entry=0x14878d067089 "ALTER TABLE t ADD COLUMN a INT FIRST", packet_length=packet_length@entry=36, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1866
            #21 0x0000561dceb819de in do_command (thd=0x14878d015088) at /test/10.5_dbg/sql/sql_parse.cc:1347
            #22 0x0000561dcecddc3b in do_handle_one_connection (connect=<optimized out>, connect@entry=0x1487900c7808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
            #23 0x0000561dcecde357 in handle_one_connection (arg=arg@entry=0x1487900c7808) at /test/10.5_dbg/sql/sql_connect.cc:1313
            #24 0x0000561dcf141ca8 in pfs_spawn_thread (arg=0x1487adc46508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
            #25 0x00001487b00786db in start_thread (arg=0x1487b10ff700) at pthread_create.c:463
            #26 0x00001487af476a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Bug confirmed present in:
            MariaDB: 10.4.14 (dbg), 10.4.14 (opt), 10.5.5 (dbg), 10.5.5 (opt)

            Bug confirmed not present in:
            MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt)
            MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

            Assume it is covered in the fix.

            Roel Roel Van de Paar added a comment - - edited Another similar testcase. USE test; CREATE TABLE t (c CHAR(255), PRIMARY KEY (c)) CHARSET=utf8; ALTER TABLE t ADD COLUMN b INT FIRST; SET GLOBAL INNODB_DEFAULT_ROW_FORMAT = 0; ALTER TABLE t ADD COLUMN a INT FIRST; Leads to: 10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b (Debug) mysqld: /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:417: void dict_index_t::instant_add_field(const dict_index_t&): Assertion `trx_id_offset == instant.trx_id_offset' failed. 10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b (Debug) Core was generated by `/test/MD140720-mariadb-10.5.5-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'. Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57 [Current thread is 1 (Thread 0x1487b10ff700 (LWP 999380))] (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57 #1 0x0000561dcf67b4d7 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518 #2 0x0000561dcee359ba in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #5 0x00001487af3958b1 in __GI_abort () at abort.c:79 #6 0x00001487af38542a in __assert_fail_base (fmt=0x1487af50ca38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x561dcfa78900 "trx_id_offset == instant.trx_id_offset", file=file@entry=0x561dcfa6f428 "/test/10.5_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=417, function=function@entry=0x561dcfa745a0 <dict_index_t::instant_add_field(dict_index_t const&)::__PRETTY_FUNCTION__> "void dict_index_t::instant_add_field(const dict_index_t&)") at assert.c:92 #7 0x00001487af3854a2 in __GI___assert_fail (assertion=assertion@entry=0x561dcfa78900 "trx_id_offset == instant.trx_id_offset", file=file@entry=0x561dcfa6f428 "/test/10.5_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=417, function=function@entry=0x561dcfa745a0 <dict_index_t::instant_add_field(dict_index_t const&)::__PRETTY_FUNCTION__> "void dict_index_t::instant_add_field(const dict_index_t&)") at assert.c:101 #8 0x0000561dcf239900 in dict_index_t::instant_add_field (this=this@entry=0x14878d0dc698, instant=@0x14878d0dd818: {static MAX_N_FIELDS = 1023, id = 0, heap = 0x14878d063718, name = {m_name = 0x14878d0e8298 "PRIMARY"}, table = 0x14878d055298, page = 4294967295, merge_threshold = 50, type = 3, trx_id_offset = 765, n_user_defined_cols = 1, nulls_equal = 0, n_uniq = 1, n_def = 5, n_fields = 5, n_nullable = 2, n_core_fields = 3, n_core_null_bytes = 0, static NO_CORE_NULL_BYTES = 255, static DICT_INDEXES_ID = 3, cached = 1, to_be_dropped = 0, online_status = 0, uncommitted = 0, is_dummy = false, in_instant_init = false, magic_n = 76789786, fields = 0x14878d043ff0, parser = 0x0, has_new_v_col = false, indexes = {prev = 0x0, next = 0x0}, search_info = 0x14878d0e8368, online_log = 0x0, stat_n_diff_key_vals = 0x14878d0e8350, stat_n_sample_sizes = 0x14878d0e8358, stat_n_non_null_key_vals = 0x14878d0e8360, stat_index_size = 1, stat_n_leaf_pages = 1, stats_error_printed = false, stat_defrag_modified_counter = 0, stat_defrag_n_pages_freed = 0, stat_defrag_n_page_split = 0, stat_defrag_data_size_sample = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, stat_defrag_sample_next_slot = 0, rtr_ssn = {m = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, rtr_track = 0x0, trx_id = 0, zip_pad = {mutex = {m_impl = {m_freed = false, m_locked = false, m_destroy_at_exit = true, m_mutex = {m_freed = false, m_mutex = pthread_mutex_t = { Type = Normal, Status = Not acquired, Robust = No, Shared = No, Protocol = None }}, m_policy = {context = {<latch_t> = {_vptr.latch_t = 0x561dd01d1fa0 <vtable for MutexDebug<OSTrackMutex<GenericPolicy> >+16>, m_id = LATCH_ID_ZIP_PAD_MUTEX, m_rw_lock = false}, m_mutex = 0x0, m_filename = 0x0, m_line = 0, m_thread_id = 18446744073709551615, m_debug_mutex = {m_freed = false, m_mutex = pthread_mutex_t = { Type = Normal, Status = Not acquired, Robust = No, Shared = No, Protocol = None }}}, m_filename = 0x561dcfb2f068 "/test/10.5_dbg/storage/innobase/dict/dict0mem.cc", m_line = 807, m_count = {m_spins = 0, m_waits = 0, m_calls = 0, m_enabled = false}, m_id = LATCH_ID_ZIP_PAD_MUTEX}}, m_ptr = 0x0}, pad = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, success = 0, failure = 0, n_rounds = 0}, lock = {<latch_t> = {_vptr.latch_t = 0x561dd01d2510 <vtable for rw_lock_t+16>, m_id = LATCH_ID_INDEX_TREE, m_rw_lock = true}, <ilist_node<void>> = {next = 0x14878d055460, prev = 0x561dd0c95520 <rw_lock_list>}, created = true, lock_word = {m = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = 536870912}, <No data fields>}}, waiters = {m = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, sx_recursive = 0, writer_is_wait_ex = false, writer_thread = 0, event = 0x14878d061178, wait_ex_event = 0x14878d0617b8, cfile_name = 0x561dcfb274b0 "/test/10.5_dbg/storage/innobase/dict/dict0dict.cc", last_x_file_name = 0x561dcfaeb4af "not yet reserved", cline = 2155, is_block_lock = 0, last_x_line = 0, count_os_wait = 0, pfs_psi = 0x0, debug_list = {count = 0, start = 0x0, end = 0x0, node = &rw_lock_debug_t::list, init = 51966}, level = SYNC_INDEX_TREE}}) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:417 #9 0x0000561dcf2434af in dict_table_t::instant_column (this=0x14878d052f98, table=<optimized out>, col_map=<optimized out>) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:604 #10 0x0000561dcf243aba in ha_innobase_inplace_ctx::instant_column (this=this@entry=0x14878d075b10) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:1050 #11 0x0000561dcf243d10 in innobase_instant_try (ha_alter_info=ha_alter_info@entry=0x1487b10fb330, ctx=ctx@entry=0x14878d075b10, altered_table=altered_table@entry=0x1487b10fb3d0, table=table@entry=0x14878d053988, trx=trx@entry=0x14879bc03578) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:5629 #12 0x0000561dcf2474e6 in commit_try_norebuild (ha_alter_info=ha_alter_info@entry=0x1487b10fb330, ctx=ctx@entry=0x14878d075b10, altered_table=altered_table@entry=0x1487b10fb3d0, old_table=0x14878d053988, trx=0x14879bc03578, table_name=<optimized out>) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:10179 #13 0x0000561dcf233b54 in ha_innobase::commit_inplace_alter_table (this=0x14878d0394a0, altered_table=0x1487b10fb3d0, ha_alter_info=0x1487b10fb330, commit=true) at /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:10900 #14 0x0000561dcee44665 in handler::ha_commit_inplace_alter_table (this=0x14878d0394a0, altered_table=altered_table@entry=0x1487b10fb3d0, ha_alter_info=ha_alter_info@entry=0x1487b10fb330, commit=commit@entry=true) at /test/10.5_dbg/sql/handler.cc:4839 #15 0x0000561dcec51686 in mysql_inplace_alter_table (thd=thd@entry=0x14878d015088, table_list=0x14878d074198, table=table@entry=0x14878d053988, altered_table=altered_table@entry=0x1487b10fb3d0, ha_alter_info=ha_alter_info@entry=0x1487b10fb330, inplace_supported=inplace_supported@entry=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x1487b10fb7a0, alter_ctx=0x1487b10fc630) at /test/10.5_dbg/sql/sql_table.cc:8038 #16 0x0000561dcec61cb1 in mysql_alter_table (thd=thd@entry=0x14878d015088, new_db=new_db@entry=0x14878d019948, new_name=new_name@entry=0x14878d019d50, create_info=create_info@entry=0x1487b10fd220, table_list=<optimized out>, table_list@entry=0x14878d074198, alter_info=alter_info@entry=0x1487b10fd150, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.5_dbg/sql/sql_table.cc:10564 #17 0x0000561dcece5a6a in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x14878d015088) at /test/10.5_dbg/sql/sql_alter.cc:532 #18 0x0000561dceb8ee4a in mysql_execute_command (thd=thd@entry=0x14878d015088) at /test/10.5_dbg/sql/sql_parse.cc:5951 #19 0x0000561dceb96752 in mysql_parse (thd=thd@entry=0x14878d015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1487b10fe350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7993 #20 0x0000561dceb83204 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14878d015088, packet=packet@entry=0x14878d067089 "ALTER TABLE t ADD COLUMN a INT FIRST", packet_length=packet_length@entry=36, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1866 #21 0x0000561dceb819de in do_command (thd=0x14878d015088) at /test/10.5_dbg/sql/sql_parse.cc:1347 #22 0x0000561dcecddc3b in do_handle_one_connection (connect=<optimized out>, connect@entry=0x1487900c7808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411 #23 0x0000561dcecde357 in handle_one_connection (arg=arg@entry=0x1487900c7808) at /test/10.5_dbg/sql/sql_connect.cc:1313 #24 0x0000561dcf141ca8 in pfs_spawn_thread (arg=0x1487adc46508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201 #25 0x00001487b00786db in start_thread (arg=0x1487b10ff700) at pthread_create.c:463 #26 0x00001487af476a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Bug confirmed present in: MariaDB: 10.4.14 (dbg), 10.4.14 (opt), 10.5.5 (dbg), 10.5.5 (opt) Bug confirmed not present in: MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt) MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt) Assume it is covered in the fix.
            Roel Roel Van de Paar added a comment - - edited

            Unique id's seen

            trx_id_offset == instant.trx_id_offset|SIGABRT|dict_index_t::instant_add_field|dict_table_t::instant_column|ha_innobase_inplace_ctx::instant_column|innobase_instant_try
            fields[i].same(instant.fields[i])|SIGABRT|dict_index_t::instant_add_field|dict_table_t::instant_column|ha_innobase_inplace_ctx::instant_column|innobase_instant_try
            c.same_type(*o)|SIGABRT|dict_table_t::instant_column|ha_innobase_inplace_ctx::instant_column|innobase_instant_try|commit_try_norebuild
            SIGABRT|ib::fatal::~fatal|btr_page_reorganize_low|btr_page_reorganize|btr_cur_pessimistic_update
            

            Roel Roel Van de Paar added a comment - - edited Unique id's seen trx_id_offset == instant.trx_id_offset|SIGABRT|dict_index_t::instant_add_field|dict_table_t::instant_column|ha_innobase_inplace_ctx::instant_column|innobase_instant_try fields[i].same(instant.fields[i])|SIGABRT|dict_index_t::instant_add_field|dict_table_t::instant_column|ha_innobase_inplace_ctx::instant_column|innobase_instant_try c.same_type(*o)|SIGABRT|dict_table_t::instant_column|ha_innobase_inplace_ctx::instant_column|innobase_instant_try|commit_try_norebuild SIGABRT|ib::fatal::~fatal|btr_page_reorganize_low|btr_page_reorganize|btr_cur_pessimistic_update

            People

              marko Marko Mäkelä
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.