[MDEV-21798] Assertion `0' failed in row_sel_convert_mysql_key_to_innobase upon SELECT using index Created: 2020-02-21  Updated: 2023-12-14  Resolved: 2023-12-14

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.4.33, 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3, 11.3.2

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-21245 Assertion `0' failed in row_sel_conve... Closed
Relates
relates to MDEV-23258 InnoDB: Failing assertion: 0 in row_s... Closed
relates to MDEV-24902 Assertion `0' failed in row_sel_conve... Closed
relates to MDEV-16240 Assertion `0' failed in row_sel_conv... Closed
relates to MDEV-18793 Assertion `0' failed in row_sel_conve... Closed
relates to MDEV-19634 Assertion `0' failed in row_sel_conve... Closed
relates to MDEV-19677 Assertion `0' failed in row_sel_conv... Closed

 Description   

It might be related to MDEV-21245, which is about the same assertion failure, but otherwise different stack trace. Other numerous JIRA reports about this assertion failure are closed at this moment.

--source include/have_innodb.inc
 
CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('foo'),('bar');
 
CREATE TABLE t2 (b VARCHAR(256), KEY(b)) ENGINE=InnoDB;
INSERT INTO t2 VALUES ('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'),('10');
SET SQL_MODE= '';
ALTER TABLE t2 MODIFY b VARCHAR(3073);
 
SELECT * FROM t1 JOIN t2 FORCE INDEX(b) ON a = b;
 
# Cleanup
DROP TABLE t1, t2;

Note: Originally the problem was observed without FORCE INDEX, but then it required innodb_stats_persistent (which is default in the server, but not in MTR) and, on some reason, table encryption. FORCE INDEX allowed to get rid of both.

10.2 3ce49a0a

2020-02-21 15:18:45 140132916807424 [Warning] InnoDB: Using a partial-field key prefix in search, index `b` of table `test`.`t2`. Last data field length 3076 bytes, key ptr now exceeds key end by 1 bytes. Key value in the MySQL format:
 len 3075; hex <...>; asc    foo                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ;
mysqld: /data/src/10.2/storage/innobase/row/row0sel.cc:2738: void row_sel_convert_mysql_key_to_innobase(dtuple_t*, byte*, ulint, dict_index_t*, const byte*, ulint, trx_t*): Assertion `0' failed.
200221 15:18:45 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f7342556f12 in __GI___assert_fail (assertion=0x55e0ebe26f33 "0", file=0x55e0ebe26bc0 "/data/src/10.2/storage/innobase/row/row0sel.cc", line=2738, function=0x55e0ebe2a720 <row_sel_convert_mysql_key_to_innobase(dtuple_t*, unsigned char*, unsigned long, dict_index_t*, unsigned char const*, unsigned long, trx_t*)::__PRETTY_FUNCTION__> "void row_sel_convert_mysql_key_to_innobase(dtuple_t*, byte*, ulint, dict_index_t*, const byte*, ulint, trx_t*)") at assert.c:101
#8  0x000055e0eb7e8441 in row_sel_convert_mysql_key_to_innobase (tuple=0x7f72f0035fc0, buf=0x0, buf_len=0, index=0x7f72f0085930, key_ptr=0x7f72f00176f4 "", key_len=3075, trx=0x7f733d769140) at /data/src/10.2/storage/innobase/row/row0sel.cc:2738
#9  0x000055e0eb67b6e6 in ha_innobase::index_read (this=0x7f72f0086b88, buf=0x7f72f0034368 "\377", key_ptr=0x7f72f0016af0 "", key_len=3075, find_flag=HA_READ_KEY_EXACT) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9427
#10 0x000055e0eb487f08 in handler::index_read_map (this=0x7f72f0086b88, buf=0x7f72f0034368 "\377", key=0x7f72f0016af0 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.2/sql/handler.h:3136
#11 0x000055e0eb47e0e5 in handler::ha_index_read_map (this=0x7f72f0086b88, buf=0x7f72f0034368 "\377", key=0x7f72f0016af0 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.2/sql/handler.cc:2711
#12 0x000055e0eb26a7be in join_read_always_key (tab=0x7f72f0016370) at /data/src/10.2/sql/sql_select.cc:19614
#13 0x000055e0eb268d49 in sub_select (join=0x7f72f0013ec0, join_tab=0x7f72f0016370, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18860
#14 0x000055e0eb2694bf in evaluate_join_record (join=0x7f72f0013ec0, join_tab=0x7f72f0015fc0, error=0) at /data/src/10.2/sql/sql_select.cc:19083
#15 0x000055e0eb268dab in sub_select (join=0x7f72f0013ec0, join_tab=0x7f72f0015fc0, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18863
#16 0x000055e0eb268332 in do_select (join=0x7f72f0013ec0, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18407
#17 0x000055e0eb241e19 in JOIN::exec_inner (this=0x7f72f0013ec0) at /data/src/10.2/sql/sql_select.cc:3629
#18 0x000055e0eb2412d4 in JOIN::exec (this=0x7f72f0013ec0) at /data/src/10.2/sql/sql_select.cc:3424
#19 0x000055e0eb24248a in mysql_select (thd=0x7f72f0000af0, tables=0x7f72f0012668, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f72f0013ea0, unit=0x7f72f00046e8, select_lex=0x7f72f0004e28) at /data/src/10.2/sql/sql_select.cc:3824
#20 0x000055e0eb236694 in handle_select (thd=0x7f72f0000af0, lex=0x7f72f0004628, result=0x7f72f0013ea0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
#21 0x000055e0eb201e18 in execute_sqlcom_select (thd=0x7f72f0000af0, all_tables=0x7f72f0012668) at /data/src/10.2/sql/sql_parse.cc:6224
#22 0x000055e0eb1f8821 in mysql_execute_command (thd=0x7f72f0000af0) at /data/src/10.2/sql/sql_parse.cc:3531
#23 0x000055e0eb205cba in mysql_parse (thd=0x7f72f0000af0, rawbuf=0x7f72f0012448 "SELECT * FROM t1 JOIN t2 FORCE INDEX(b) ON a = b", length=48, parser_state=0x7f733cba3200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7739
#24 0x000055e0eb1f4013 in dispatch_command (command=COM_QUERY, thd=0x7f72f0000af0, packet=0x7f72f0095441 "", packet_length=48, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1831
#25 0x000055e0eb1f2967 in do_command (thd=0x7f72f0000af0) at /data/src/10.2/sql/sql_parse.cc:1384
#26 0x000055e0eb3479a3 in do_handle_one_connection (connect=0x55e0ed9a8a10) at /data/src/10.2/sql/sql_connect.cc:1336
#27 0x000055e0eb34770e in handle_one_connection (arg=0x55e0ed9a8a10) at /data/src/10.2/sql/sql_connect.cc:1241
#28 0x000055e0ebb637ae in pfs_spawn_thread (arg=0x55e0ed9b3800) at /data/src/10.2/storage/perfschema/pfs.cc:1869
#29 0x00007f73444df4a4 in start_thread (arg=0x7f733cba4700) at pthread_create.c:456
#30 0x00007f7342613d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.2-10.5.
Non-debug build doesn't crash, but the warnings InnoDB: Using a partial-field key prefix in search are still there.



 Comments   
Comment by Elena Stepanova [ 2020-02-21 ]

Same comment as in MDEV-21245: Some of the linked items have a preliminary analysis from InnoDB, and all ended up being fixed and closed by other teams. So this time I'm jumping over InnoDB and assigning directly to the server. Please reassign if needed.

Comment by Marko Mäkelä [ 2023-12-13 ]

This shares a root cause with MDEV-21245.

Generated at Thu Feb 08 09:09:53 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.