|
I am unable to reproduce this. Not only with recent 10.4 7df4706619898c025fbc1d3d48420da039e889cf and 10.5cf87f3e08c10dd7a944447ddee93fbc3827e6570, but also with the stated revision, I am getting the following:
|
10.4 09e9f884f1c87f2236d6ab66e05cfcd95302eacd
|
CREATE TABLE t1 (a TEXT, PRIMARY KEY(a(1871))) ENGINE=InnoDB;
|
ALTER TABLE t1 MODIFY IF EXISTS b TINYINT AFTER c;
|
Warnings:
|
Note 1054 Unknown column 'b' in 't1'
|
DROP TABLE t1;
|
|
|
Sorry about the confusion. The test needs to be run with --mysqld=--innodb-page-size=8K, I missed that. I'll add it to the description now as well.
|
|
If I invoke the test with
./mtr --mysqld=--innodb-page-size=4k
|
then I do get the assertion failure:
|
10.4 7df4706619898c025fbc1d3d48420da039e889cf
|
(gdb) p *pk->fields@pk->n_fields
|
$2 = {{col = 0x7fc1bc159110, name = {m_name = 0x7fc1bc1591a0 "DB_ROW_HASH_1"},
|
prefix_len = 0, fixed_len = 8}, {col = 0x7fc1bc1590b0, name = {
|
m_name = 0x7fc1bc1591ba "DB_ROW_ID"}, prefix_len = 0, fixed_len = 6}, {
|
col = 0x7fc1bc1590d0, name = {m_name = 0x7fc1bc1591c4 "DB_TRX_ID"},
|
prefix_len = 0, fixed_len = 6}, {col = 0x7fc1bc1590f0, name = {
|
m_name = 0x7fc1bc1591ce "DB_ROLL_PTR"}, prefix_len = 0, fixed_len = 7}, {
|
col = 0x7fc1bc159090, name = {m_name = 0x7fc1bc1591b8 "a"},
|
prefix_len = 0, fixed_len = 0}}
|
I do not think that InnoDB can possibly support a PRIMARY KEY that includes virtual columns.
We are missing that assertion in dict_index_build_internal_clust(). With it added, I get a crash earlier:
mysqltest: At line 3: query 'CREATE TABLE t1 (a TEXT, PRIMARY KEY(a(1871))) ENGINE=InnoDB' failed: 2013: Lost connection to MySQL server during query
|
sachin.setiya.007, I believe that the problem was caused by MDEV-371 or some follow-up fix. Please include the following in your fix:
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
|
index 38eeacf0f6e..30b56828b82 100644
|
--- a/storage/innobase/dict/dict0dict.cc
|
+++ b/storage/innobase/dict/dict0dict.cc
|
@@ -2312,8 +2312,8 @@ dict_index_build_internal_clust(
|
ulint i;
|
ibool* indexed;
|
|
- ut_ad(dict_index_is_clust(index));
|
- ut_ad(!dict_index_is_ibuf(index));
|
+ ut_ad(index->is_primary());
|
+ ut_ad(!index->has_virtual());
|
|
ut_ad(mutex_own(&dict_sys.mutex));
|
|
|
|
Seeing this one also. Also affects 10.6.
# mysqld options required for replay: --innodb_page_size=4k
|
CREATE TABLE t (c1 BLOB,PRIMARY KEY(c1(3072))) ENGINE=InnoDB;
|
ALTER TABLE t ADD COLUMN j INT;
|
Leads to:
|
10.6.2 06dd151bb86ad5b87d4d46011f36da1289c01074 (Debug)
|
mysqld: /test/10.6_dbg/storage/innobase/handler/handler0alter.cc:1491: bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*, bool): Assertion `!pk->has_virtual()' failed.
|
|
10.6.2 06dd151bb86ad5b87d4d46011f36da1289c01074 (Debug)
|
Core was generated by `/test/MD050621-mariadb-10.6.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
[Current thread is 1 (Thread 0x153190151700 (LWP 1959659))]
|
(gdb) bt
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
#1 0x0000153192f10859 in __GI_abort () at abort.c:79
|
#2 0x0000153192f10729 in __assert_fail_base (fmt=0x1531930a6588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55fbb3b8619c "!pk->has_virtual()", file=0x55fbb3b81d08 "/test/10.6_dbg/storage/innobase/handler/handler0alter.cc", line=1491, function=<optimized out>) at assert.c:92
|
#3 0x0000153192f21f36 in __GI___assert_fail (assertion=assertion@entry=0x55fbb3b8619c "!pk->has_virtual()", file=file@entry=0x55fbb3b81d08 "/test/10.6_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=1491, function=function@entry=0x55fbb3b82260 "bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*, bool)") at assert.c:101
|
#4 0x000055fbb337c47c in instant_alter_column_possible (ib_table=Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
|
Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
|
@0x153140020a38: {id = 18, id_hash = 0x0, name = {m_name = 0x15314001d2d8 "test/t", static part_suffix = "#P#"}, name_hash = 0x0, heap = 0x1531400208a8, data_dir_path = 0x0, space = 0x153140021678, space_id = 5, flags = 33, flags2 = 80, skip_alter_undo = 0, file_unreadable = 0, cached = 1, to_be_dropped = 0, n_def = 4, n_cols = 4, n_t_cols = 5, n_t_def = 5, n_v_def = 1, n_v_cols = 1, persistent_autoinc = 0, can_be_evicted = 1, corrupted = 0, drop_aborted = 0, cols = 0x153140020d68, v_cols = 0x153140020de8, s_cols = 0x0, instant = 0x0, col_names = 0x153140020e98 "c1", v_col_names = 0x153140020e80 "DB_ROW_HASH_1", vers_start = 0, vers_end = 0, is_system_db = false, dict_frm_mismatch = DICT_FRM_CONSISTENT, fts_doc_id_index = 0x0, indexes = {count = 1, start = 0x1531400235e8, end = 0x1531400235e8, node = &dict_index_t::indexes, init = 51966}, freed_indexes = {count = 0, start = 0x0, end = 0x0, node = &dict_index_t::indexes, init = 51966}, foreign_list = {count = 0, start = 0x0, end = 0x0, node = &dict_foreign_t::heap, init = 0}, referenced_list = {count = 0, start = 0x0, end = 0x0, node = &dict_foreign_t::heap, init = 0}, table_LRU = {prev = 0x153164016688, next = 0x153148014b28}, fk_max_recusive_level = 0 '\000', n_foreign_key_checks_running = {m_counter = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, def_trx_id = 17, bulk_trx_id = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, foreign_set = std::set with 0 elements, referenced_set = std::set with 0 elements, stat_initialized = 1, stats_last_recalc = 0, stat_persistent = 0, stats_auto_recalc = 0, stats_sample_pages = 0, stat_n_rows = 0, stat_clustered_index_size = 1, stat_sum_of_other_index_sizes = 0, stat_modified_counter = 0, stats_bg_flag = 0 '\000', stats_error_printed = false, autoinc_lock = 0x153140020e28, autoinc_mutex = {lock = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}, static HOLDER = 2147483648}, lock_mutex = {lock = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}, static HOLDER = 2147483648}, lock_mutex_owner = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, autoinc = 0, autoinc_trx = {m = {_M_b = {_M_p = 0x0}}}, n_waiting_or_granted_auto_inc_locks = 0, n_lock_x_or_s = 0, fts = 0x0, quiesce = QUIESCE_NONE, n_rec_locks = {m_counter = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, n_ref_count = {m_counter = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 1}, <No data fields>}}, locks = {count = 0, start = 0x0, end = 0x0, node = &lock_table_t::locks, init = 51966}, update_time = {m = {<std::__atomic_base<long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, query_cache_inv_trx_id = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, magic_n = 76333786, vc_templ = 0x153140008358}, ha_alter_info=ha_alter_info@entry=0x15319014cf50, table=0x15314001e118, altered_table=altered_table@entry=0x15319014d010, strict=<optimized out>) at /test/10.6_dbg/storage/innobase/include/dict0mem.h:1198
|
#5 0x000055fbb33842d7 in ha_innobase::check_if_supported_inplace_alter (this=0x153140027320, altered_table=0x15319014d010, ha_alter_info=0x15319014cf50) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.h:445
|
#6 0x000055fbb2d6ab59 in mysql_alter_table (thd=thd@entry=0x153140000db8, new_db=new_db@entry=0x1531400059c8, new_name=new_name@entry=0x153140005de0, create_info=create_info@entry=0x15319014f4c0, table_list=<optimized out>, table_list@entry=0x153140014090, alter_info=alter_info@entry=0x15319014f3d0, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>, if_exists=<optimized out>) at /test/10.6_dbg/sql/sql_table.cc:10158
|
#7 0x000055fbb2df9eb5 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x153140000db8) at /test/10.6_dbg/sql/structs.h:567
|
#8 0x000055fbb2c9522d in mysql_execute_command (thd=thd@entry=0x153140000db8) at /test/10.6_dbg/sql/sql_parse.cc:5983
|
#9 0x000055fbb2c7badc in mysql_parse (thd=thd@entry=0x153140000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x153190150400) at /test/10.6_dbg/sql/sql_parse.cc:8016
|
#10 0x000055fbb2c8a646 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153140000db8, packet=packet@entry=0x15314000b769 "ALTER TABLE t ADD COLUMN j INT", packet_length=packet_length@entry=30, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1340
|
#11 0x000055fbb2c8da26 in do_command (thd=0x153140000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
|
#12 0x000055fbb2df1ec2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55fbb626bdd8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
|
#13 0x000055fbb2df24c7 in handle_one_connection (arg=arg@entry=0x55fbb626bdd8) at /test/10.6_dbg/sql/sql_connect.cc:1312
|
#14 0x000055fbb329e03a in pfs_spawn_thread (arg=0x55fbb6154368) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
|
#15 0x000015319341e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#16 0x000015319300d293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.4.19 (dbg), 10.5.10 (dbg), 10.6.2 (dbg)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (dbg), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.2 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)
|
|
Slightly different stack with this testcase
# mysqld options required for replay: --innodb_page_size=4k
|
CREATE TABLE t (c1 TEXT (4000),c2 TEXT (4000),PRIMARY KEY(c1(3072))) ENGINE=InnoDB;
|
OPTIMIZE TABLE t;
|
Leads to:
|
10.6.2 06dd151bb86ad5b87d4d46011f36da1289c01074 (Debug)
|
mysqld: /test/10.6_dbg/storage/innobase/handler/handler0alter.cc:1491: bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*, bool): Assertion `!pk->has_virtual()' failed.
|
|
10.6.2 06dd151bb86ad5b87d4d46011f36da1289c01074 (Debug)
|
Core was generated by `/test/MD050621-mariadb-10.6.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
[Current thread is 1 (Thread 0x1545e0f2f700 (LWP 3203030))]
|
(gdb) bt
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
#1 0x00001545e3aed859 in __GI_abort () at abort.c:79
|
#2 0x00001545e3aed729 in __assert_fail_base (fmt=0x1545e3c83588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x558f4124c19c "!pk->has_virtual()", file=0x558f41247d08 "/test/10.6_dbg/storage/innobase/handler/handler0alter.cc", line=1491, function=<optimized out>) at assert.c:92
|
#3 0x00001545e3afef36 in __GI___assert_fail (assertion=assertion@entry=0x558f4124c19c "!pk->has_virtual()", file=file@entry=0x558f41247d08 "/test/10.6_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=1491, function=function@entry=0x558f41248260 "bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*, bool)") at assert.c:101
|
#4 0x0000558f40a4247c in instant_alter_column_possible (ib_table=Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
|
Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
|
@0x15459c020ec8: {id = 18, id_hash = 0x0, name = {m_name = 0x15459c01d2d8 "test/t", static part_suffix = "#P#"}, name_hash = 0x0, heap = 0x15459c020d38, data_dir_path = 0x0, space = 0x15459c021b08, space_id = 5, flags = 33, flags2 = 80, skip_alter_undo = 0, file_unreadable = 0, cached = 1, to_be_dropped = 0, n_def = 5, n_cols = 5, n_t_cols = 6, n_t_def = 6, n_v_def = 1, n_v_cols = 1, persistent_autoinc = 0, can_be_evicted = 1, corrupted = 0, drop_aborted = 0, cols = 0x15459c0211f8, v_cols = 0x15459c021298, s_cols = 0x0, instant = 0x0, col_names = 0x15459c021348 "c1", v_col_names = 0x15459c021330 "DB_ROW_HASH_1", vers_start = 0, vers_end = 0, is_system_db = false, dict_frm_mismatch = DICT_FRM_CONSISTENT, fts_doc_id_index = 0x0, indexes = {count = 1, start = 0x15459c023a78, end = 0x15459c023a78, node = &dict_index_t::indexes, init = 51966}, freed_indexes = {count = 0, start = 0x0, end = 0x0, node = &dict_index_t::indexes, init = 51966}, foreign_list = {count = 0, start = 0x0, end = 0x0, node = &dict_foreign_t::heap, init = 0}, referenced_list = {count = 0, start = 0x0, end = 0x0, node = &dict_foreign_t::heap, init = 0}, table_LRU = {prev = 0x1545a8013ec8, next = 0x154598014b28}, fk_max_recusive_level = 0 '\000', n_foreign_key_checks_running = {m_counter = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, def_trx_id = 17, bulk_trx_id = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, foreign_set = std::set with 0 elements, referenced_set = std::set with 0 elements, stat_initialized = 1, stats_last_recalc = 0, stat_persistent = 0, stats_auto_recalc = 0, stats_sample_pages = 0, stat_n_rows = 0, stat_clustered_index_size = 1, stat_sum_of_other_index_sizes = 0, stat_modified_counter = 0, stats_bg_flag = 0 '\000', stats_error_printed = false, autoinc_lock = 0x15459c0212d8, autoinc_mutex = {lock = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}, static HOLDER = 2147483648}, lock_mutex = {lock = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}, static HOLDER = 2147483648}, lock_mutex_owner = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, autoinc = 0, autoinc_trx = {m = {_M_b = {_M_p = 0x0}}}, n_waiting_or_granted_auto_inc_locks = 0, n_lock_x_or_s = 0, fts = 0x0, quiesce = QUIESCE_NONE, n_rec_locks = {m_counter = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, n_ref_count = {m_counter = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 1}, <No data fields>}}, locks = {count = 0, start = 0x0, end = 0x0, node = &lock_table_t::locks, init = 51966}, update_time = {m = {<std::__atomic_base<long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, query_cache_inv_trx_id = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, magic_n = 76333786, vc_templ = 0x15459c008358}, ha_alter_info=ha_alter_info@entry=0x1545e0f2ad50, table=0x15459c020398, altered_table=altered_table@entry=0x1545e0f2ae10, strict=<optimized out>) at /test/10.6_dbg/storage/innobase/include/dict0mem.h:1198
|
#5 0x0000558f40a4a2d7 in ha_innobase::check_if_supported_inplace_alter (this=0x15459c027580, altered_table=0x1545e0f2ae10, ha_alter_info=0x1545e0f2ad50) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.h:445
|
#6 0x0000558f40430b59 in mysql_alter_table (thd=thd@entry=0x15459c000db8, new_db=<optimized out>, new_name=<optimized out>, create_info=create_info@entry=0x1545e0f2d290, table_list=<optimized out>, table_list@entry=0x15459c014068, alter_info=alter_info@entry=0x1545e0f2d1a0, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>, if_exists=<optimized out>) at /test/10.6_dbg/sql/sql_table.cc:10158
|
#7 0x0000558f404342c5 in mysql_recreate_table (thd=thd@entry=0x15459c000db8, table_list=table_list@entry=0x15459c014068, table_copy=table_copy@entry=false) at /test/10.6_dbg/sql/sql_table.cc:11261
|
#8 0x0000558f404c84b1 in admin_recreate_table (thd=thd@entry=0x15459c000db8, table_list=table_list@entry=0x15459c014068) at /test/10.6_dbg/sql/sql_admin.cc:78
|
#9 0x0000558f404cbd4f in mysql_admin_table (thd=thd@entry=0x15459c000db8, tables=tables@entry=0x15459c014068, check_opt=check_opt@entry=0x15459c0063c8, operator_name=operator_name@entry=0x558f4172d9e0 <msg_optimize>, lock_type=lock_type@entry=TL_WRITE, org_open_for_modify=org_open_for_modify@entry=true, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=(int (handler::*)(class handler * const, class THD *, HA_CHECK_OPT *)) 0x558f4063546a <handler::ha_optimize(THD*, st_ha_check_opt*)>, view_operator_func=0x0, is_cmd_replicated=true) at /test/10.6_dbg/sql/sql_admin.cc:1147
|
#10 0x0000558f404cd26e in Sql_cmd_optimize_table::execute (this=<optimized out>, thd=0x15459c000db8) at /test/10.6_dbg/sql/sql_admin.cc:1531
|
#11 0x0000558f4035b22d in mysql_execute_command (thd=thd@entry=0x15459c000db8) at /test/10.6_dbg/sql/sql_parse.cc:5983
|
#12 0x0000558f40341adc in mysql_parse (thd=thd@entry=0x15459c000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1545e0f2e400) at /test/10.6_dbg/sql/sql_parse.cc:8016
|
#13 0x0000558f40350646 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x15459c000db8, packet=packet@entry=0x15459c00b769 "", packet_length=packet_length@entry=16, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1340
|
#14 0x0000558f40353a26 in do_command (thd=0x15459c000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
|
#15 0x0000558f404b7ec2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x558f44a36e98, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
|
#16 0x0000558f404b84c7 in handle_one_connection (arg=arg@entry=0x558f44a36e98) at /test/10.6_dbg/sql/sql_connect.cc:1312
|
#17 0x0000558f4096403a in pfs_spawn_thread (arg=0x558f4491f368) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
|
#18 0x00001545e3ffb609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#19 0x00001545e3bea293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
|
|
Interestingly a CHECK TABLE t [QUICK]; does not crash.
|
|
# mysqld options required for replay: --innodb_page_size=4k
|
CREATE TABLE wORklog5743 (c_1lt TEXT,c_2lt TEXT,PRIMARY KEY(c_1lt (3072))) ROW_FORMAT=DYNAMIC,ENGINE=InnoDB;
|
CREATE INDEX prefix_idx ON wORklog5743 (c_1lt (3072));
|
Leads to a slightly different stack (though may only lead sporadically to this):
|
10.6.2 06dd151bb86ad5b87d4d46011f36da1289c01074 (Debug)
|
mysqld: /test/10.6_dbg/storage/innobase/handler/handler0alter.cc:1491: bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*, bool): Assertion `!pk->has_virtual()' failed.
|
|
10.6.2 06dd151bb86ad5b87d4d46011f36da1289c01074 (Debug)
|
Core was generated by `/test/MD050621-mariadb-10.6.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
[Current thread is 1 (Thread 0x151044167700 (LWP 802037))]
|
(gdb) bt
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
#1 0x0000151046d25859 in __GI_abort () at abort.c:79
|
#2 0x0000151046d25729 in __assert_fail_base (fmt=0x151046ebb588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556b9dbbd19c "!pk->has_virtual()", file=0x556b9dbb8d08 "/test/10.6_dbg/storage/innobase/handler/handler0alter.cc", line=1491, function=<optimized out>) at assert.c:92
|
#3 0x0000151046d36f36 in __GI___assert_fail (assertion=assertion@entry=0x556b9dbbd19c "!pk->has_virtual()", file=file@entry=0x556b9dbb8d08 "/test/10.6_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=1491, function=function@entry=0x556b9dbb9260 "bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*, bool)") at assert.c:101
|
#4 0x0000556b9d3b347c in instant_alter_column_possible (ib_table=Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
|
Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
|
@0x150ff0020ec8: {id = 18, id_hash = 0x0, name = {m_name = 0x150ff001d2d8 "test/wORklog5743", static part_suffix = "#P#"}, name_hash = 0x0, heap = 0x150ff0020d38, data_dir_path = 0x0, space = 0x150ff0021b48, space_id = 5, flags = 33, flags2 = 80, skip_alter_undo = 0, file_unreadable = 0, cached = 1, to_be_dropped = 0, n_def = 5, n_cols = 5, n_t_cols = 6, n_t_def = 6, n_v_def = 1, n_v_cols = 1, persistent_autoinc = 0, can_be_evicted = 1, corrupted = 0, drop_aborted = 0, cols = 0x150ff00211f8, v_cols = 0x150ff0021298, s_cols = 0x0, instant = 0x0, col_names = 0x150ff0021348 "c_1lt", v_col_names = 0x150ff0021330 "DB_ROW_HASH_1", vers_start = 0, vers_end = 0, is_system_db = false, dict_frm_mismatch = DICT_FRM_CONSISTENT, fts_doc_id_index = 0x0, indexes = {count = 1, start = 0x150ff0023ad8, end = 0x150ff0023ad8, node = &dict_index_t::indexes, init = 51966}, freed_indexes = {count = 0, start = 0x0, end = 0x0, node = &dict_index_t::indexes, init = 51966}, foreign_list = {count = 0, start = 0x0, end = 0x0, node = &dict_foreign_t::heap, init = 0}, referenced_list = {count = 0, start = 0x0, end = 0x0, node = &dict_foreign_t::heap, init = 0}, table_LRU = {prev = 0x1510180153c8, next = 0x150ffc014b28}, fk_max_recusive_level = 0 '\000', n_foreign_key_checks_running = {m_counter = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, def_trx_id = 17, bulk_trx_id = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, foreign_set = std::set with 0 elements, referenced_set = std::set with 0 elements, stat_initialized = 1, stats_last_recalc = 0, stat_persistent = 0, stats_auto_recalc = 0, stats_sample_pages = 0, stat_n_rows = 0, stat_clustered_index_size = 1, stat_sum_of_other_index_sizes = 0, stat_modified_counter = 0, stats_bg_flag = 0 '\000', stats_error_printed = false, autoinc_lock = 0x150ff00212d8, autoinc_mutex = {lock = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}, static HOLDER = 2147483648}, lock_mutex = {lock = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}, static HOLDER = 2147483648}, lock_mutex_owner = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, autoinc = 0, autoinc_trx = {m = {_M_b = {_M_p = 0x0}}}, n_waiting_or_granted_auto_inc_locks = 0, n_lock_x_or_s = 0, fts = 0x0, quiesce = QUIESCE_NONE, n_rec_locks = {m_counter = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, n_ref_count = {m_counter = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 1}, <No data fields>}}, locks = {count = 0, start = 0x0, end = 0x0, node = &lock_table_t::locks, init = 51966}, update_time = {m = {<std::__atomic_base<long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, query_cache_inv_trx_id = {m = {<std::__atomic_base<unsigned long>> = {static _S_alignment = 8, _M_i = 0}, <No data fields>}}, magic_n = 76333786, vc_templ = 0x150ff0008358}, ha_alter_info=ha_alter_info@entry=0x151044163a10, table=0x150ff0020828, altered_table=altered_table@entry=0x151044163ad0, strict=<optimized out>) at /test/10.6_dbg/storage/innobase/include/dict0mem.h:1198
|
#5 0x0000556b9d3bb2d7 in ha_innobase::check_if_supported_inplace_alter (this=0x150ff00286e0, altered_table=0x151044163ad0, ha_alter_info=0x151044163a10) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.h:445
|
#6 0x0000556b9cda1b59 in mysql_alter_table (thd=thd@entry=0x150ff0000db8, new_db=new_db@entry=0x150ff00140f8, new_name=new_name@entry=0x150ff0014108, create_info=create_info@entry=0x151044165fc0, table_list=<optimized out>, table_list@entry=0x150ff00140e0, alter_info=alter_info@entry=0x151044165ed0, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>, if_exists=<optimized out>) at /test/10.6_dbg/sql/sql_table.cc:10158
|
#7 0x0000556b9ccc715c in mysql_execute_command (thd=thd@entry=0x150ff0000db8) at /test/10.6_dbg/sql/structs.h:567
|
#8 0x0000556b9ccb2adc in mysql_parse (thd=thd@entry=0x150ff0000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x151044166400) at /test/10.6_dbg/sql/sql_parse.cc:8016
|
#9 0x0000556b9ccc1646 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x150ff0000db8, packet=packet@entry=0x150ff000b769 "CREATE INDEX prefix_idx ON wORklog5743 (c_1lt (3072))", packet_length=packet_length@entry=53, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1340
|
#10 0x0000556b9ccc4a26 in do_command (thd=0x150ff0000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
|
#11 0x0000556b9ce28ec2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x556ba05bcdd8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
|
#12 0x0000556b9ce294c7 in handle_one_connection (arg=arg@entry=0x556ba05bcdd8) at /test/10.6_dbg/sql/sql_connect.cc:1312
|
#13 0x0000556b9d2d503a in pfs_spawn_thread (arg=0x556ba04a5368) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
|
#14 0x0000151047233609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#15 0x0000151046e22293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
|
|
I am surprised that there has been no progress on this. After I added the assertion that I had requested to be added, the following test fails for me for 4k and 8k page sizes:
--source include/innodb_page_size_small.inc
|
CREATE TABLE t1 (a TEXT, PRIMARY KEY(a(1871))) ENGINE=InnoDB;
|
DROP TABLE t1;
|
InnoDB never allowed the primary key to be defined on a virtual column. Implementing support for that would require significant effort.
|
|
Patch branch bb-10.4-20131
|
|
serg, your suggestion to ensure that ha_innobase::max_supported_key_part_length() would not return a longer value than ha_innobase::max_supported_key_length() would seem to break file format or replication compatibility with MySQL 5.6, 5.7, as well as MariaDB 10.0 or later, when using innodb_page_size=8k and possibly also when using innodb_page_size=4k.
Those two member functions fail to take into account the way how data is stored in InnoDB b-trees. InnoDB does not actually care so much about the key length, but the record size.
The maximum key part length depends on the ROW_FORMAT. For the default ROW_FORMAT=DYNAMIC it is 3072 bytes. For ROW_FORMAT=COMPACT and ROW_FORMAT=REDUNDANT it is 767 bytes.
Like I have tried to explain in MDEV-20400, the record size in each index page depends on the type of the index (secondary index records always include the keys of the clustered index or primary key index) and whether the index page is internal (pointing to a child page) or a leaf page (containing the key and data). For secondary index records, there is no additional data; the key columns always include the PK. For the clustered index, the data includes the system columns DB_TRX_ID,DB_ROLL_PTR and any non-PK columns.
I think that the simplest way to fix this bug would be to disable the MDEV-371 logic for the primary key (including possible UNIQUE NOT NULL key that InnoDB would internally choose as the primary key). Possibly that fix can be made conditional on HA_PRIMARY_KEY_IN_READ_INDEX or some other flag that identifies InnoDB.
|
|
New regression in 10.6:
# mysqld options required for replay: --innodb_page_size=4k
|
CREATE TABLE t (c TEXT,PRIMARY KEY(c(1300))) ENGINE=InnoDB;
|
Leads to:
|
10.6.2 6c39eaeb126328e7813b146ecf652d51e4508981 (Debug)
|
mysqld: /test/10.6_dbg/storage/innobase/dict/dict0dict.cc:2503: dict_index_t* dict_index_build_internal_clust(dict_index_t*): Assertion `!index->has_virtual()' failed.
|
|
10.6.2 6c39eaeb126328e7813b146ecf652d51e4508981 (Debug)
|
Core was generated by `/test/MD120621-mariadb-10.6.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
[Current thread is 1 (Thread 0x14c37488f700 (LWP 993997))]
|
(gdb) bt
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
#1 0x000014c37744d859 in __GI_abort () at abort.c:79
|
#2 0x000014c37744d729 in __assert_fail_base (fmt=0x14c3775e3588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5576ae438117 "!index->has_virtual()", file=0x5576ae438200 "/test/10.6_dbg/storage/innobase/dict/dict0dict.cc", line=2503, function=<optimized out>) at assert.c:92
|
#3 0x000014c37745ef36 in __GI___assert_fail (assertion=assertion@entry=0x5576ae438117 "!index->has_virtual()", file=file@entry=0x5576ae438200 "/test/10.6_dbg/storage/innobase/dict/dict0dict.cc", line=line@entry=2503, function=function@entry=0x5576ae439458 "dict_index_t* dict_index_build_internal_clust(dict_index_t*)") at assert.c:101
|
#4 0x00005576adebdae9 in dict_index_build_internal_clust (index=0x14c324021448) at /test/10.6_dbg/storage/innobase/include/dict0mem.h:1189
|
#5 dict_index_add_to_cache (index=@0x14c324021910: 0x14c324021448, page_no=page_no@entry=4294967295, add_v=0x0) at /test/10.6_dbg/storage/innobase/dict/dict0dict.cc:2050
|
#6 0x00005576adeac682 in dict_create_index_step (thr=thr@entry=0x14c324021fb0) at /test/10.6_dbg/storage/innobase/dict/dict0crea.cc:1226
|
#7 0x00005576adcbaf43 in que_thr_step (thr=0x14c324021fb0) at /test/10.6_dbg/storage/innobase/que/que0que.cc:663
|
#8 que_run_threads_low (thr=0x14c324021fb0) at /test/10.6_dbg/storage/innobase/que/que0que.cc:709
|
#9 que_run_threads (thr=thr@entry=0x14c324021fb0) at /test/10.6_dbg/storage/innobase/que/que0que.cc:729
|
#10 0x00005576add23f7b in row_create_index_for_mysql (index=<optimized out>, index@entry=0x14c324021448, trx=trx@entry=0x14c374b4a290, field_lengths=field_lengths@entry=0x14c3240085a8, mode=FIL_ENCRYPTION_DEFAULT, key_id=1) at /test/10.6_dbg/storage/innobase/row/row0mysql.cc:2401
|
#11 0x00005576adbb7f71 in create_index (trx=<optimized out>, form=<optimized out>, table=<optimized out>, key_num=key_num@entry=0) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:10833
|
#12 0x00005576adbb471f in create_table_info_t::create_table (this=this@entry=0x14c37488bc30, create_fk=create_fk@entry=true) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:12503
|
#13 0x00005576adbbee54 in ha_innobase::create (this=<optimized out>, name=0x14c37488d670 "./test/t", form=<optimized out>, create_info=0x14c37488dba0, file_per_table=<optimized out>, trx=0x14c374b4a290, trx@entry=0x0) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:13021
|
#14 0x00005576adbb5079 in ha_innobase::create (this=<optimized out>, name=<optimized out>, form=<optimized out>, create_info=<optimized out>) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:13056
|
#15 0x00005576ad7b5217 in handler::ha_create (this=0x14c32401fb50, name=0x14c37488d670 "./test/t", form=form@entry=0x14c37488c200, info_arg=info_arg@entry=0x14c37488dba0) at /test/10.6_dbg/sql/handler.cc:5391
|
#16 0x00005576ad7b5eb1 in ha_create_table (thd=thd@entry=0x14c324000db8, path=0x14c37488d670 "./test/t", db=0x14c324014928 "test", table_name=0x14c324014210 "t", create_info=create_info@entry=0x14c37488dba0, frm=frm@entry=0x14c37488d660, skip_frm_file=false) at /test/10.6_dbg/sql/handler.cc:5856
|
#17 0x00005576ad5a91c7 in create_table_impl (thd=thd@entry=0x14c324000db8, ddl_log_state_create=ddl_log_state_create@entry=0x14c37488d900, ddl_log_state_rm=<optimized out>, ddl_log_state_rm@entry=0x14c37488d920, orig_db=@0x14c324014260: {str = 0x14c324014928 "test", length = 4}, orig_table_name=@0x14c324014270: {str = 0x14c324014210 "t", length = 1}, db=@0x14c324014260: {str = 0x14c324014928 "test", length = 4}, table_name=@0x14c324014270: {str = 0x14c324014210 "t", length = 1}, path=@0x14c37488d650: {str = 0x14c37488d670 "./test/t", length = 8}, options=<optimized out>, create_info=0x14c37488dba0, alter_info=0x14c37488dab0, create_table_mode=0, is_trans=0x14c37488d8ff, key_info=0x14c37488d648, key_count=0x14c37488d644, frm=0x14c37488d660) at /test/10.6_dbg/sql/sql_table.cc:4449
|
#18 0x00005576ad5a9794 in mysql_create_table_no_lock (thd=thd@entry=0x14c324000db8, ddl_log_state_create=ddl_log_state_create@entry=0x14c37488d900, ddl_log_state_rm=ddl_log_state_rm@entry=0x14c37488d920, db=db@entry=0x14c324014260, table_name=table_name@entry=0x14c324014270, create_info=create_info@entry=0x14c37488dba0, alter_info=0x14c37488dab0, is_trans=0x14c37488d8ff, create_table_mode=0, table_list=0x14c324014248) at /test/10.6_dbg/sql/sql_table.cc:4548
|
#19 0x00005576ad5a9bb7 in mysql_create_table (thd=thd@entry=0x14c324000db8, create_table=create_table@entry=0x14c324014248, create_info=create_info@entry=0x14c37488dba0, alter_info=alter_info@entry=0x14c37488dab0) at /test/10.6_dbg/sql/sql_table.cc:4660
|
#20 0x00005576ad5aba61 in Sql_cmd_create_table_like::execute (this=<optimized out>, thd=0x14c324000db8) at /test/10.6_dbg/sql/sql_table.cc:11770
|
#21 0x00005576ad4d9fe1 in mysql_execute_command (thd=thd@entry=0x14c324000db8) at /test/10.6_dbg/sql/sql_parse.cc:5983
|
#22 0x00005576ad4c0890 in mysql_parse (thd=thd@entry=0x14c324000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c37488e400) at /test/10.6_dbg/sql/sql_parse.cc:8016
|
#23 0x00005576ad4cf3fa in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c324000db8, packet=packet@entry=0x14c32400b769 "CREATE TABLE t (c TEXT,PRIMARY KEY(c(1300))) ENGINE=InnoDB", packet_length=packet_length@entry=58, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1340
|
#24 0x00005576ad4d27da in do_command (thd=0x14c324000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
|
#25 0x00005576ad636c8e in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5576b167bb58, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
|
#26 0x00005576ad637293 in handle_one_connection (arg=arg@entry=0x5576b167bb58) at /test/10.6_dbg/sql/sql_connect.cc:1312
|
#27 0x00005576adae5166 in pfs_spawn_thread (arg=0x5576b1564388) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
|
#28 0x000014c37795b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#29 0x000014c37754a293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.6.2 (dbg)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (dbg), 10.3.29 (opt), 10.4.19 (dbg), 10.4.19 (opt), 10.5.10 (dbg), 10.5.10 (opt), 10.6.2 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)
|
|
Whilst the above testcase is a new regression by itself (as none of the older releases crash immediately on CREATE TABLE), the testcase can be made to crash previous releases by dropping the PK after creation:
# mysqld options required for replay: --innodb_page_size=4k
|
CREATE TABLE t (c TEXT,PRIMARY KEY(c(1300))) ENGINE=InnoDB;
|
ALTER TABLE t DROP PRIMARY KEY;
|
Leads to:
|
10.5.10 dd07cfcecd4aabb0aeae9c4f5087f82b4080c1bd (Debug)
|
mysqld: /test/10.5_dbg/storage/innobase/handler/handler0alter.cc:1486: bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*, bool): Assertion `!pk->has_virtual()' failed.
|
|
10.5.10 dd07cfcecd4aabb0aeae9c4f5087f82b4080c1bd (Debug)
|
Core was generated by `/test/MD270421-mariadb-10.5.10-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
[Current thread is 1 (Thread 0x14ac11bfe700 (LWP 2239143))]
|
(gdb) bt
|
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
#1 0x000014ac34ab5859 in __GI_abort () at abort.c:79
|
#2 0x000014ac34ab5729 in __assert_fail_base (fmt=0x14ac34c4b588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x561cd2c50925 "!pk->has_virtual()", file=0x561cd2c4bad8 "/test/10.5_dbg/storage/innobase/handler/handler0alter.cc", line=1486, function=<optimized out>) at assert.c:92
|
#3 0x000014ac34ac6f36 in __GI___assert_fail (assertion=assertion@entry=0x561cd2c50925 "!pk->has_virtual()", file=file@entry=0x561cd2c4bad8 "/test/10.5_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=1486, function=function@entry=0x561cd2c4bf08 "bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*, bool)") at assert.c:101
|
#4 0x0000561cd240d23a in instant_alter_column_possible (ib_table=Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
|
Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
|
@0x14abe401f898: {id = 20, id_hash = 0x0, name = {m_name = 0x14abe401fb68 "test/t", static part_suffix = "#P#"}, name_hash = 0x0, heap = 0x14abe401f708, data_dir_path = 0x0, space = 0x14abe4021578, space_id = 5, flags = 33, flags2 = 80, skip_alter_undo = 0, file_unreadable = 0, cached = 1, to_be_dropped = 0, n_def = 4, n_cols = 4, n_t_cols = 5, n_t_def = 5, n_v_def = 1, n_v_cols = 1, persistent_autoinc = 0, can_be_evicted = 1, corrupted = 0, drop_aborted = 0, cols = 0x14abe401fc18, v_cols = 0x14abe401fc98, s_cols = 0x0, instant = 0x0, col_names = 0x14abe401fd48 "c", v_col_names = 0x14abe401fd30 "DB_ROW_HASH_1", vers_start = 0, vers_end = 0, is_system_db = false, dict_frm_mismatch = DICT_FRM_CONSISTENT, fts_doc_id_index = 0x0, indexes = {count = 1, start = 0x14abe40234c8, end = 0x14abe40234c8, node = &dict_index_t::indexes, init = 51966}, freed_indexes = {count = 0, start = 0x0, end = 0x0, node = &dict_index_t::indexes, init = 51966}, foreign_list = {count = 0, start = 0x0, end = 0x0, node = &dict_foreign_t::heap, init = 0}, referenced_list = {count = 0, start = 0x0, end = 0x0, node = &dict_foreign_t::heap, init = 0}, table_LRU = {prev = 0x14abf4014558, next = 0x14abec014858}, fk_max_recusive_level = 0, n_foreign_key_checks_running = {m_counter = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = 0}, <No data fields>}}, query_cache_inv_trx_id = 0, def_trx_id = 21, foreign_set = std::set with 0 elements, referenced_set = std::set with 0 elements, stat_initialized = 1, stats_last_recalc = 0, stat_persistent = 0, stats_auto_recalc = 0, stats_sample_pages = 0, stat_n_rows = 0, stat_clustered_index_size = 1, stat_sum_of_other_index_sizes = 0, stat_modified_counter = 0, stats_bg_flag = 0 '\000', stats_error_printed = false, autoinc_lock = 0x14abe401fcd8, autoinc_mutex = {<std::__mutex_base> = {_M_mutex = pthread_mutex_t = {
|
Type = Normal,
|
Status = Not acquired,
|
Robust = No,
|
Shared = No,
|
Protocol = None
|
}}, <No data fields>}, autoinc = 0, n_waiting_or_granted_auto_inc_locks = 0, autoinc_trx = 0x0, fts = 0x0, quiesce = QUIESCE_NONE, n_rec_locks = 0, n_ref_count = {m_counter = {<std::__atomic_base<unsigned int>> = {static _S_alignment = 4, _M_i = 1}, <No data fields>}}, locks = {count = 0, start = 0x0, end = 0x0, node = &lock_table_t::locks, init = 51966}, update_time = 0, magic_n = 76333786, vc_templ = 0x14abe4008078}, ha_alter_info=ha_alter_info@entry=0x14ac11bfa770, table=0x14abe401db58, altered_table=altered_table@entry=0x14ac11bfa810, strict=<optimized out>) at /test/10.5_dbg/storage/innobase/include/dict0mem.h:1209
|
#5 0x0000561cd2414f89 in ha_innobase::check_if_supported_inplace_alter (this=0x14abe40252d0, altered_table=0x14ac11bfa810, ha_alter_info=0x14ac11bfa770) at /test/10.5_dbg/storage/innobase/handler/ha_innodb.h:442
|
#6 0x0000561cd1df4548 in mysql_alter_table (thd=thd@entry=0x14abe4000db8, new_db=new_db@entry=0x14abe4005810, new_name=new_name@entry=0x14abe4005c30, create_info=create_info@entry=0x14ac11bfc4c0, table_list=<optimized out>, table_list@entry=0x14abe4013dc0, alter_info=alter_info@entry=0x14ac11bfc3f0, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.5_dbg/sql/sql_table.cc:10688
|
#7 0x0000561cd1e7a165 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x14abe4000db8) at /test/10.5_dbg/sql/structs.h:559
|
#8 0x0000561cd1d1d66d in mysql_execute_command (thd=thd@entry=0x14abe4000db8) at /test/10.5_dbg/sql/sql_parse.cc:6055
|
#9 0x0000561cd1d0334f in mysql_parse (thd=thd@entry=0x14abe4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14ac11bfd3d0, 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:8099
|
#10 0x0000561cd1d12565 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14abe4000db8, packet=packet@entry=0x14abe400b499 "ALTER TABLE t DROP PRIMARY KEY", packet_length=packet_length@entry=30, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1270
|
#11 0x0000561cd1d15dea in do_command (thd=0x14abe4000db8) at /test/10.5_dbg/sql/sql_parse.cc:1370
|
#12 0x0000561cd1e72379 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561cd78e9018, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
|
#13 0x0000561cd1e72a7d in handle_one_connection (arg=arg@entry=0x561cd78e9018) at /test/10.5_dbg/sql/sql_connect.cc:1312
|
#14 0x0000561cd232b885 in pfs_spawn_thread (arg=0x561cd78125f8) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
|
#15 0x000014ac34fc3609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#16 0x000014ac34bb2293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
This crashes 10.4.19 (dbg), 10.5.10 (dbg), 10.5.10 (opt), 10.6.2 (dbg) (on first query), and 10.6.2 (opt) (on second query), and the latter with a different SIGSEGV:
|
10.6.2 6c39eaeb126328e7813b146ecf652d51e4508981 (Optimized)
|
Core was generated by `/test/MD120621-mariadb-10.6.2-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGSEGV, Segmentation fault.
|
#0 0x000055a822a5fba9 in innobase_copy_frm_flags_from_table_share (
|
innodb_table=0x0, table_share=0x14fae8cd72f0)
|
at /test/10.6_opt/storage/innobase/include/dict0mem.h:1821
|
1821 return flags2 & DICT_TF2_TEMPORARY;
|
[Current thread is 1 (Thread 0x14fae8cda700 (LWP 2651131))]
|
(gdb) bt
|
#0 0x000055a822a5fba9 in innobase_copy_frm_flags_from_table_share (innodb_table=0x0, table_share=0x14fae8cd72f0) at /test/10.6_opt/storage/innobase/include/dict0mem.h:1821
|
#1 0x000055a822a87d3c in ha_innobase::commit_inplace_alter_table (this=<optimized out>, altered_table=<optimized out>, ha_alter_info=<optimized out>, commit=<optimized out>) at /test/10.6_opt/storage/innobase/handler/handler0alter.cc:11145
|
#2 0x000055a8225c543e in mysql_inplace_alter_table (thd=0x14faac000c58, table_list=0x14faac010930, table=0x14faac017918, altered_table=0x14fae8cd63b0, ha_alter_info=0x14fae8cd62f0, ddl_log_state=0x14fae8cd62d0, trigger_param=0x14fae8cd6780, alter_ctx=0x14fae8cd7790, target_mdl_request=<optimized out>) at /test/10.6_opt/sql/sql_table.cc:7439
|
#3 0x000055a8225d3de7 in mysql_alter_table (thd=thd@entry=0x14faac000c58, new_db=new_db@entry=0x14faac0056a8, new_name=new_name@entry=0x14faac005ac0, create_info=create_info@entry=0x14fae8cd8590, table_list=<optimized out>, table_list@entry=0x14faac010930, alter_info=alter_info@entry=0x14fae8cd84a0, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.6_opt/sql/sql_table.cc:10202
|
#4 0x000055a82263bebd in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x14faac000c58) at /test/10.6_opt/sql/structs.h:567
|
#5 0x000055a82252afce in mysql_execute_command (thd=0x14faac000c58) at /test/10.6_opt/sql/sql_parse.cc:5983
|
#6 0x000055a82251b3f4 in mysql_parse (thd=0x14faac000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.6_opt/sql/sql_parse.cc:8016
|
#7 0x000055a822527295 in dispatch_command (command=COM_QUERY, thd=0x14faac000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/10.6_opt/sql/sql_class.h:1340
|
#8 0x000055a8225291f7 in do_command (thd=0x14faac000c58, blocking=blocking@entry=true) at /test/10.6_opt/sql/sql_parse.cc:1406
|
#9 0x000055a822637057 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /test/10.6_opt/sql/sql_connect.cc:1410
|
#10 0x000055a8226373bd in handle_one_connection (arg=arg@entry=0x55a8248c13d8) at /test/10.6_opt/sql/sql_connect.cc:1312
|
#11 0x000055a8229c08f8 in pfs_spawn_thread (arg=0x55a82483f948) at /test/10.6_opt/storage/perfschema/pfs.cc:2201
|
#12 0x000014fafe07b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#13 0x000014fafdc6a293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
|
|
One more stack on bit older 10.5 revision (build 27/4):
|
10.5.10 dd07cfcecd4aabb0aeae9c4f5087f82b4080c1bd (Optimized)
|
Core was generated by `/test/MD270421-mariadb-10.5.10-linux-x86_64-opt/bin/mysqld --no-defaults --core'.
|
Program terminated with signal SIGSEGV, Segmentation fault.
|
#0 0x0000565417239a8b in dict_stats_try_drop_table (name=..., table_name=...,
|
thd=<optimized out>)
|
at /test/10.5_opt/storage/innobase/handler/handler0alter.cc:10208
|
[Current thread is 1 (Thread 0x145dc00ee700 (LWP 2439505))]
|
(gdb) bt
|
#0 0x0000565417239a8b in dict_stats_try_drop_table (name=<optimized out>, table_name=<optimized out>, thd=<optimized out>) at /test/10.5_opt/storage/innobase/handler/handler0alter.cc:10208
|
#1 innobase_reload_table (ctx=@0x145d74011858: {<inplace_alter_handler_ctx> = {<Sql_alloc> = {<No data fields>}, _vptr.inplace_alter_handler_ctx = 0x565417c33bb8 <vtable for ha_innobase_inplace_ctx+16>}, thr = 0x145d7402f4f0, prebuilt = @0x145d7401edd0, add_index = 0x0, add_key_numbers = 0x0, num_to_add_index = 0, drop_index = 0x0, num_to_drop_index = 0, drop_fk = 0x0, num_to_drop_fk = 0, add_fk = 0x0, num_to_add_fk = 0, online = true, heap = 0x145d7402f3c8, trx = 0x0, old_table = 0x145d7401a1a0, new_table = 0x145d7401a1a0, instant_table = 0x0, col_map = 0x0, col_names = 0x0, add_autoinc = 18446744073709551615, defaults = 0x0, sequence = {m_max_value = 0, m_increment = 0, m_offset = 0, m_next_value = 0, m_eof = true}, tmp_name = 0x0, skip_pk_sort = false, num_to_add_vcol = 0, add_vcol = 0x0, add_vcol_name = 0x0, num_to_drop_vcol = 1, drop_vcol = 0x145d7402f598, drop_vcol_name = 0x145d7402f5d8, m_stage = 0x0, old_n_cols = 4, old_cols = 0x145d7401a4a0, old_col_names = 0x145d7401a5d0 "c", old_instant = 0x0, old_fields = 0x145d7401d9e8, old_n_fields = 5, old_n_core_fields = 5, old_n_v_cols = 1, old_v_cols = 0x145d7401a520, old_v_col_names = 0x145d7401a5b8 "DB_ROW_HASH_1", first_alter_pos = 0, allow_not_null = false, page_compression_level = 0}, table_name=@0x145d74018f50: {str = 0x145d74019165 "t", length = 1}, table=0x145d7401a1a0, thd=0x145d74000c58) at /test/10.5_opt/storage/innobase/handler/handler0alter.cc:10212
|
#2 ha_innobase::commit_inplace_alter_table (this=<optimized out>, altered_table=<optimized out>, ha_alter_info=<optimized out>, commit=<optimized out>) at /test/10.5_opt/storage/innobase/handler/handler0alter.cc:11346
|
#3 0x0000565416d75ff7 in mysql_inplace_alter_table (thd=0x145d74000c58, table_list=0x145d740104d0, table=0x145d740174b8, altered_table=0x145dc00ea9e0, ha_alter_info=0x145dc00ea940, alter_ctx=0x145dc00eb980, target_mdl_request=<optimized out>) at /test/10.5_opt/sql/sql_table.cc:8170
|
#4 0x0000565416d82d9f in mysql_alter_table (thd=thd@entry=0x145d74000c58, new_db=new_db@entry=0x145d740054f0, new_name=new_name@entry=0x145d74005910, create_info=create_info@entry=0x145dc00ec590, table_list=<optimized out>, table_list@entry=0x145d740104d0, alter_info=alter_info@entry=0x145dc00ec4c0, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.5_opt/sql/sql_table.cc:10731
|
#5 0x0000565416de3507 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x145d74000c58) at /test/10.5_opt/sql/structs.h:559
|
#6 0x0000565416cdac76 in mysql_execute_command (thd=0x145d74000c58) at /test/10.5_opt/sql/sql_parse.cc:6055
|
#7 0x0000565416cca3e3 in mysql_parse (thd=0x145d74000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_parse.cc:8099
|
#8 0x0000565416cd6b05 in dispatch_command (command=COM_QUERY, thd=0x145d74000c58, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_class.h:1270
|
#9 0x0000565416cd9122 in do_command (thd=0x145d74000c58) at /test/10.5_opt/sql/sql_parse.cc:1370
|
#10 0x0000565416dde841 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56541a678958, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1410
|
#11 0x0000565416ddecbd in handle_one_connection (arg=arg@entry=0x56541a678958) at /test/10.5_opt/sql/sql_connect.cc:1312
|
#12 0x000056541716d0f9 in pfs_spawn_thread (arg=0x56541a62df68) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
|
#13 0x0000145dc1825609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#14 0x0000145dc1414293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
|
|
List of uniqueID's for this bug;
!pk->has_virtual()|SIGABRT|instant_alter_column_possible|ha_innobase::check_if_supported_inplace_alter|mysql_alter_table|mysql_recreate_table
|
!pk->has_virtual()|SIGABRT|instant_alter_column_possible|ha_innobase::check_if_supported_inplace_alter|mysql_alter_table|Sql_cmd_alter_table::execute
|
!pk->has_virtual()|SIGABRT|instant_alter_column_possible|ha_innobase::check_if_supported_inplace_alter|mysql_alter_table|mysql_execute_command
|
!index->has_virtual()|SIGABRT|dict_index_build_internal_clust|dict_index_add_to_cache|dict_create_index_step|que_thr_step
|
SIGSEGV|dict_stats_try_drop_table|innobase_reload_table|ha_innobase::commit_inplace_alter_table|mysql_inplace_alter_table
|
SIGSEGV|innobase_copy_frm_flags_from_table_share|ha_innobase::commit_inplace_alter_table|mysql_inplace_alter_table|mysql_alter_table
|
|
|
Roel, I recently added the assertion to dict_index_build_internal_clust() in 10.4 (and merged to 10.5 and 10.6) so that this bug would be flagged already on the first DDL operation that would violate the design constraint. Previously, it was only flagged during certain types of subsequent ALTER TABLE.
serg and sachin.setiya.007, an alternative way of fixing this bug would be to refuse to create a NOT NULL virtual column. As you should know, PRIMARY KEY implies NOT NULL, and NOT NULL is not allowed for MariaDB virtual columns. (It is allowed in MySQL 5.7; compare its mysql-test/t/alter_table.test to the MariaDB mysql-test/suite/gcol/t/main_alter_table.test. The MariaDB test case is missing the NOT NULL; it is only mentioned in a comment.)
|
|
Please add the following test as well:
(implies --innodb_page_size=4k)
CREATE TABLE t (c TEXT,PRIMARY KEY(c (768))) ENGINE=InnoDB;
|
INSERT INTO t VALUES (100);
|
ALTER TABLE t CONVERT TO CHARACTER SET utf8mb3;
|
SELECT 1 FROM t GROUP BY @b :=@a,@b;
|
Together with SELECT, since it's important for referencing MDEV-18166.
If this case will remain unfixed, then MDEV-26020 should be unmarked as duplicate
|
|
marko it fortunately turned out that Long Unique algorithm removes HA_NOSAME flag from the index:
if (key_info->algorithm == HA_KEY_ALG_LONG_HASH)
|
{
|
key_part_end++;
|
key_info->flags&= ~HA_NOSAME;
|
}
|
This is not suitable for PRIMARY key, so better to leave it only for UNIQUE. Besides, the uniqueness of hash is not expected, since it's only 8 bytes (see HA_HASH_FIELD_LENGTH).
The uniqueness itself is guaranteed by check_duplicate_long_entries call from ha_write_row, and similar one from ha_update_row. Which is not suitable for PRIMARY key again
|
|
In mysql_prepare_create_table we have:
if (is_hash_field_needed ||
|
(key_info->algorithm == HA_KEY_ALG_HASH &&
|
key->type != Key::PRIMARY &&
|
key_info->flags & HA_NOSAME &&
|
!(file->ha_table_flags() & HA_CAN_HASH_KEYS ) &&
|
file->ha_table_flags() & HA_CAN_VIRTUAL_COLUMNS))
|
Suchwise, we have key->type Unable to render embedded object: File (:PRIMARY}} check, but it can be [wrongly) not found.] superseded by {{is_hash_field_needed, which, in turn, is set in a little cumbersome amount of ways.
I will prevent this flag set to true for PRIMARY keys and will prettify the flag setup a little.
|
|
Please review commit 518abf49f4d59
|
|
nikitamalyavin Thank you! Can you confirm that all testcases in this bug were tested against the patch and could you please include all (relevant) testcases into the patch if not covered in the main testcase already? Thanks!
|
|
Roel yes, this long PRIMARY KEY is not forbidden (again), and the table will not be created in all these cases.
The problem was that it accidentally considered PRIMARY key as long UNIQUE, which is meaningless. One can still create UNIQUE key with the same spec.
|