|
Reproducible on 10.4-10.6
-- source include/have_innodb.inc
|
|
CREATE TABLE t1 (a varchar(32), KEY (a(4))) engine=innodb DEFAULT charset=utf8;
|
insert into t1 values ('a1'),('a1'),('a1'),('a1'),('a1'),('a1'),('a1');
|
|
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
|
|
10.4 09b03ff31b8fd71aee265c224
|
mysqld: /10.4/src/storage/innobase/dict/dict0dict.cc:1910: dberr_t dict_index_add_to_cache(dict_index_t*&, ulint, const dict_add_v_col_t*): Assertion `field->col->is_binary() || field->prefix_len % field->col->mbmaxlen == 0' failed.
|
210628 15:04:24 [ERROR] mysqld got signal 6 ;
|
|
Server version: 10.4.21-MariaDB-debug-log
|
|
linux/raise.c:51(__GI_raise)[0x7effcc88d18b]
|
stdlib/abort.c:81(__GI_abort)[0x7effcc86c859]
|
intl/loadmsgcat.c:509(get_sysdep_segment_value)[0x7effcc86c729]
|
:0(__GI___assert_fail)[0x7effcc87df36]
|
dict/dict0dict.cc:1912(dict_index_add_to_cache(dict_index_t*&, unsigned long, dict_add_v_col_t const*))[0x559f1a86e71e]
|
dict/dict0crea.cc:1249(dict_create_index_step(que_thr_t*))[0x559f1a8531d1]
|
que/que0que.cc:1048(que_thr_step(que_thr_t*))[0x559f1a4505c0]
|
que/que0que.cc:1100(que_run_threads_low(que_thr_t*))[0x559f1a4509a9]
|
que/que0que.cc:1142(que_run_threads(que_thr_t*))[0x559f1a450e08]
|
handler/handler0alter.cc:6191(create_index_dict(trx_t*, dict_index_t*, dict_add_v_col_t const*))[0x559f1a24d3e5]
|
handler/handler0alter.cc:7048(prepare_inplace_alter_table_dict(Alter_inplace_info*, TABLE const*, TABLE const*, char const*, unsigned long, unsigned long, unsigned long, bool, bool))[0x559f1a256ff6]
|
handler/handler0alter.cc:8343(ha_innobase::prepare_inplace_alter_table(TABLE*, Alter_inplace_info*))[0x559f1a263424]
|
sql/handler.cc:4609(handler::ha_prepare_inplace_alter_table(TABLE*, Alter_inplace_info*))[0x559f19bf8ba0]
|
sql/sql_table.cc:7785(mysql_inplace_alter_table(THD*, TABLE_LIST*, TABLE*, TABLE*, Alter_inplace_info*, MDL_request*, Alter_table_ctx*))[0x559f19637ef1]
|
sql/sql_table.cc:10248(mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool))[0x559f19649d0e]
|
sql/sql_alter.cc:520(Sql_cmd_alter_table::execute(THD*))[0x559f197cd346]
|
sql/sql_parse.cc:6189(mysql_execute_command(THD*))[0x559f193de226]
|
sql/sql_parse.cc:7992(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x559f193e9d73]
|
sql/sql_parse.cc:1860(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x559f193c0523]
|
sql/sql_parse.cc:1373(do_command(THD*))[0x559f193bcfa0]
|
sql/sql_connect.cc:1412(do_handle_one_connection(CONNECT*))[0x559f197b490a]
|
sql/sql_connect.cc:1317(handle_one_connection)[0x559f197b41ae]
|
perfschema/pfs.cc:1871(pfs_spawn_thread)[0x559f1ae8a71b]
|
nptl/pthread_create.c:478(start_thread)[0x7effccd94609]
|
x86_64/clone.S:97(__GI___clone)[0x7effcc969293]
|
|
Query (0x62b0000a1290): ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci
|
|
10.5.11
|
Version: '10.5.11-MariaDB'
|
2021-06-28 13:17:53 0x7fc428310700 InnoDB: Assertion failure in file /home/buildbot/buildbot/build/storage/innobase/data/data0type.cc line 67
|
InnoDB: Failing assertion: !(prefix_len % mbmaxlen)
|
InnoDB: We intentionally generate a memory trap.
|
InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
|
InnoDB: If you get repeated assertion failures or crashes, even
|
InnoDB: immediately after the mysqld startup, there may be
|
InnoDB: corruption in the InnoDB tablespace. Please refer to
|
InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/
|
InnoDB: about forcing recovery.
|
210628 13:17:53 [ERROR] mysqld got signal 6 ;
|
|
Server version: 10.5.11-MariaDB
|
|
linux/raise.c:51(__GI_raise)[0x7fc4295d17bb]
|
stdlib/abort.c:81(__GI_abort)[0x7fc4295bc535]
|
:0(ut_dbg_assertion_failed(char const*, char const*, unsigned int))[0x55c7bc0a92df]
|
data/data0type.cc:67(dtype_get_at_most_n_mbchars(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, char const*))[0x55c7bc8ab39c]
|
include/data0data.ic:54(dfield_set_len)[0x55c7bc7aecd7]
|
row/row0merge.cc:2340(row_merge_read_clustered_index(trx_t*, TABLE*, dict_table_t const*, dict_table_t*, bool, dict_index_t**, dict_index_t*, fts_psort_t*, merge_file_t*, unsigned long const*, unsigned long, dtuple_t const*, dict_add_v_col_t const*, unsigned long const*, unsigned long, ib_sequence_t&, unsigned char*, bool, pfs_os_file_t*, ut_stage_alter_t*, double, unsigned char*, TABLE*, bool))[0x55c7bc7b4d92]
|
row/row0merge.cc:4539(row_merge_build_indexes(trx_t*, dict_table_t*, dict_table_t*, bool, dict_index_t**, unsigned long const*, unsigned long, TABLE*, dtuple_t const*, unsigned long const*, unsigned long, ib_sequence_t&, bool, ut_stage_alter_t*, dict_add_v_col_t const*, TABLE*, bool))[0x55c7bc7b74b4]
|
handler/handler0alter.cc:8491(ha_innobase::inplace_alter_table(TABLE*, Alter_inplace_info*))[0x55c7bc706cdc]
|
sql/sql_table.cc:8116(mysql_inplace_alter_table)[0x55c7bc26ad51]
|
sql/sql_alter.cc:545(Sql_cmd_alter_table::execute(THD*))[0x55c7bc2c8b4e]
|
sql/sql_parse.cc:6052(mysql_execute_command(THD*))[0x55c7bc1d0300]
|
sql/sql_parse.cc:8096(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55c7bc1d3ba9]
|
sql/sql_audit.h:169(mysql_audit_general)[0x55c7bc1d64fd]
|
sql/sql_parse.cc:1375(do_command(THD*))[0x55c7bc1d7edf]
|
sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x55c7bc2c3e52]
|
sql/sql_connect.cc:1318(handle_one_connection)[0x55c7bc2c4114]
|
perfschema/pfs.cc:2204(pfs_spawn_thread)[0x55c7bc64a13d]
|
nptl/pthread_create.c:487(start_thread)[0x7fc429a70fa3]
|
x86_64/clone.S:97(clone)[0x7fc4296934cf]
|
|
Query (0x7fc3bc011e20): ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci
|
|
|
I got this as well, trying to upgrade Drupal 6's node table to enable emoji support.
I was converting from utf8_general_ci to utf8mb4_general_nopad_ci.
I first reduced the size of the `title` field (from 255, I think).
This resolved failures on other tables due to index prefix length, but when I tried with `node`, it crashed.
I deleted the node_type and node_title_type indexes and it worked. They could be recreated afterwards.
Below shows the table structure after recreation.
CREATE TABLE `node` (
|
`nid` int(10) UNSIGNED NOT NULL,
|
`vid` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
`type` varchar(32) COLLATE utf8mb4_general_nopad_ci NOT NULL DEFAULT '',
|
`language` varchar(12) COLLATE utf8mb4_general_nopad_ci NOT NULL DEFAULT '',
|
`title` varchar(129) COLLATE utf8mb4_general_nopad_ci NOT NULL DEFAULT '',
|
`uid` int(11) NOT NULL DEFAULT 0,
|
`status` int(11) NOT NULL DEFAULT 1,
|
`created` int(11) NOT NULL DEFAULT 0,
|
`changed` int(11) NOT NULL DEFAULT 0,
|
`comment` int(11) NOT NULL DEFAULT 0,
|
`promote` int(11) NOT NULL DEFAULT 0,
|
`moderate` int(11) NOT NULL DEFAULT 0,
|
`sticky` int(11) NOT NULL DEFAULT 0,
|
`tnid` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
`translate` int(11) NOT NULL DEFAULT 0
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_nopad_ci;
|
|
ALTER TABLE `node`
|
ADD PRIMARY KEY (`nid`),
|
ADD UNIQUE KEY `vid` (`vid`),
|
ADD KEY `node_changed` (`changed`),
|
ADD KEY `node_created` (`created`),
|
ADD KEY `node_moderate` (`moderate`),
|
ADD KEY `node_promote_status` (`promote`,`status`),
|
ADD KEY `node_status_type` (`status`,`type`,`nid`),
|
ADD KEY `uid` (`uid`),
|
ADD KEY `tnid` (`tnid`),
|
ADD KEY `translate` (`translate`),
|
ADD KEY `node_type` (`type`(4)),
|
ADD KEY `node_title_type` (`title`,`type`(4));
|
|
ALTER TABLE `node`
|
MODIFY `nid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
COMMIT;
|
The error output:
2021-07-18 16:20:03 0x83c010f00 InnoDB: Assertion failure in file storage/innobase/data/data0type.cc line 67
|
InnoDB: Failing assertion: !(prefix_len % mbmaxlen)
|
[..memory trap..]
|
Server version: 10.5.11-MariaDB
|
key_buffer_size=157286400
|
read_buffer_size=1048576
|
max_used_connections=11
|
max_threads=152
|
thread_count=11
|
It is possible that mysqld could use up to
|
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 935403 K bytes of memory
|
Hope that's ok; if not, decrease some variables in the equation.
|
|
Thread pointer: 0x83d878b58
|
Attempting backtrace. You can use the following information to find out
|
where mysqld died. If you see no messages after this, something went
|
terribly wrong...
|
stack_bottom = 0x7fffde05af38 thread_stack 0x49000
|
0x12c666c <my_print_stacktrace+0x3c> at /usr/local/libexec/mariadbd
|
0xc41eae <handle_fatal_signal+0x28e> at /usr/local/libexec/mariadbd
|
0x802e18c80 <pthread_sigmask+0x530> at /lib/libthr.so.3
|
|
Trying to get some variables.
|
Some pointers may be invalid and cause the dump to abort.
|
Query (0x83d89c428): ALTER TABLE `node` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_nopad_ci
|
|
Connection ID (thread ID): 1331
|
Status: NOT_KILLED
|
|
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
|
|
|
We also had a similar crash with following test case on MariaDB 10.4.21:
{{DROP TABLE IF EXISTS `mfa_usermeta`;
CREATE TABLE `mfa_usermeta` (
`umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`meta_key` varchar(255) DEFAULT NULL,
`meta_value` longtext DEFAULT NULL,
PRIMARY KEY (`umeta_id`),
KEY `user_id` (`user_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8;
INSERT INTO mfa_usermeta VALUES (1,1,'','');
ALTER TABLE mfa_usermeta CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;}}
Excerpt from the log file:
{{We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
Server version: 10.4.21-MariaDB-log
key_buffer_size=134217728
read_buffer_size=4194304
max_used_connections=9
max_threads=502
thread_count=15
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 4255875 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x7ff18681e008
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7ff198fbfe30 thread_stack 0x40000
mysys/stacktrace.c:175(my_print_stacktrace)[0x5595fad7ecce]
sql/signal_handler.cc:222(handle_fatal_signal)[0x5595fa7639df]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x110e0)[0x7ff19b6ce0e0]
linux/raise.c:51(__GI_raise)[0x7ff19aac6fff]
stdlib/abort.c:91(__GI_abort)[0x7ff19aac842a]
ut/ut0rbt.cc:218(rbt_tree_add_child(ib_rbt_t const*, ib_rbt_bound_t*, ib_rbt_node_t*) [clone .isra.4] [clone .part.5])[0x5595fa454888]
data/data0type.cc:67(dtype_get_at_most_n_mbchars(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, char const*))[0x5595faac4acc]
include/data0data.ic:54(dfield_set_len)[0x5595fa9d15ef]
row/row0merge.cc:2355(row_merge_read_clustered_index(trx_t*, TABLE*, dict_table_t const*, dict_table_t*, bool, dict_index_t*, dict_index_t, fts_psort_t*, merge_file_t*, unsigned long const*, unsigned long, dtuple_t const*, dict_add_v_col_t const*, unsigned long cons
t*, unsigned long, ib_sequence_t&, unsigned char*, bool, pfs_os_file_t*, ut_stage_alter_t*, double, unsigned char*, TABLE*, bool))[0x5595fa9d7acf]
include/ut0stage.h:434(ut_stage_alter_t::reestimate())[0x5595fa9da07f]
handler/handler0alter.cc:8559(ha_innobase::inplace_alter_table(TABLE*, Alter_inplace_info*))[0x5595fa92f9c0]
sql/sql_table.cc:7822(mysql_inplace_alter_table(THD*, TABLE_LIST*, TABLE*, TABLE*, Alter_inplace_info*, MDL_request*, Alter_table_ctx*) [clone .isra.337] [clone .constprop.411])[0x5595fa443060]
sql/sql_table.cc:10254(mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool))[0x5595fa5e9677]
sql/sql_alter.cc:526(Sql_cmd_alter_table::execute(THD*))[0x5595fa6401f5]
sql/sql_parse.cc:6192(mysql_execute_command(THD*))[0x5595fa550772]
sql/sql_parse.cc:7995(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x5595fa556d52]
sql/sql_parse.cc:1919(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x5595fa5596ec]
sql/sql_parse.cc:1374(do_command(THD*))[0x5595fa55ac8b]
sql/sql_connect.cc:1420(do_handle_one_connection(CONNECT*))[0x5595fa63bc62]
sql/sql_connect.cc:1318(handle_one_connection)[0x5595fa63bd4d]
nptl/pthread_create.c:456(start_thread)[0x7ff19b6c44a4]
x86_64/clone.S:99(clone)[0x7ff19ab7cd0f]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7ff18685d020): ALTER TABLE mfa_usermeta CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
Connection ID (thread ID): 19
Status: NOT_KILLED
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,mat
erialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cach
e_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on}}
Thanks in advance.
|
|
The bug happens when a partially indexes CHAR or VARCHAR field in converted from utf8mb3 to utf8mb4.
3 0x00007faa31be8662 in __GI___assert_fail (assertion=0x5e13e6 "field->col->is_binary() || field->prefix_len % field->col->mbmaxlen == 0", file=0x5d46d7 "../storage/innobase/dict/dict0dict.cc", line=1919, function=0x4e30bc "dberr_t dict_index_add_to_cache(dict_index_t *&, ulint, const dict_add_v_col_t *)") at assert.c:101
|
#4 0x00000000012ca9ce in dict_index_add_to_cache (index=@0x7faa200424f8: 0x7faa20119a70, page_no=4294967295, add_v=0x0) at dict0dict.cc:1918
|
#5 0x00000000014648f4 in dict_create_index_step (thr=0x7faa2005ca68) at dict0crea.cc:1249
|
#6 0x00000000015bc1d6 in que_thr_step (thr=0x7faa2005ca68) at que0que.cc:1048
|
#7 0x00000000015bb2a0 in que_run_threads_low (thr=0x7faa2005ca68) at que0que.cc:1100
|
#8 0x00000000015bafd7 in que_run_threads (thr=0x7faa2005ca68) at que0que.cc:1140
|
#9 0x00000000014a7ba6 in create_index_dict (trx=0x7faa30991208, index=0x7faa20119a70, add_v=0x0) at handler0alter.cc:6189
|
#10 0x000000000149762a in prepare_inplace_alter_table_dict (ha_alter_info=0x7faa080a8f10, altered_table=0x7faa080a7bb8, old_table=0x7faa20092408, table_name=0x7faa2003fafd "t1", flags=33, flags2=80, fts_doc_id_col=18446744073709551615, add_fts_doc_id=false, add_fts_doc_id_idx=false) at handler0alter.cc:7048
|
#11 0x000000000148fafd in ha_innobase::prepare_inplace_alter_table (this=0x7faa20093200, altered_table=0x7faa080a7bb8, ha_alter_info=0x7faa080a8f10) at handler0alter.cc:8356
|
#12 0x0000000000c2ecf1 in handler::ha_prepare_inplace_alter_table (this=0x7faa20093200, altered_table=0x7faa080a7bb8, ha_alter_info=0x7faa080a8f10) at handler.cc:4622
|
#13 0x0000000000fbc32b in mysql_inplace_alter_table (thd=0x7faa2000ada8, table_list=0x7faa2001d7b0, table=0x7faa20092408, altered_table=0x7faa080a7bb8, ha_alter_info=0x7faa080a8f10, target_mdl_request=0x7faa080a9838, alter_ctx=0x7faa080a99e8) at sql_table.cc:7785
|
#14 0x0000000000fb6a81 in mysql_alter_table (thd=0x7faa2000ada8, new_db=0x7faa2000f3e8, new_name=0x7faa2000f810, create_info=0x7faa080aad68, table_list=0x7faa2001d7b0, alter_info=0x7faa080aacb0, order_num=0, order=0x0, ignore=false) at sql_table.cc:10251
|
#15 0x0000000001065cad in Sql_cmd_alter_table::execute (this=0x7faa2001dea0, thd=0x7faa2000ada8) at sql_alter.cc:520
|
#16 0x0000000000ebb97e in mysql_execute_command (thd=0x7faa2000ada8) at sql_parse.cc:6192
|
#17 0x0000000000ea8dda in mysql_parse (thd=0x7faa2000ada8, rawbuf=0x7faa2001d670 "ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci", length=78, parser_state=0x7faa080ad6c8, is_com_multi=false, is_next_command=false) at sql_parse.cc:7995
|
1918 ut_ad(field->col->is_binary()
|
1919 || field->prefix_len % field->col->mbmaxlen == 0);
|
(rr) p *field
|
$3 = {
|
col = 0x7faa20040b00,
|
name = 0x7faa20040bdb "a",
|
prefix_len = 28,
|
fixed_len = 0
|
}
|
(rr) p *field->col
|
$4 = {
|
prtype = 2162703,
|
mtype = 12,
|
len = 96,
|
mbminlen = 1,
|
mbmaxlen = 3,
|
ind = 1,
|
ord_part = 1,
|
max_prefix = 21,
|
def_val = {
|
data = 0x0,
|
len = 4294967294
|
}
|
}
|
Here fields points for an old col which is still mbmaxlen=3. And this is incorrect. The new index should point to a new column definition. But there is no now column definition and no new dict_table_t object. New dict_table_t is created in a new_clustered=true code path in prepare_inplace_alter_table_dict() which involves creating the whole dict_table_t and call to a row_create_table_for_mysql() which doesn't happen and should not happen for an instant column change. A possible fix is to disallow ALGORITHM=NOCOPY for this very case.
|