[MDEV-20422] InnoDB: Failing assertion: field->prefix_len > 0 with innodb_prefix_index_cluster_optimization=ON Created: 2019-08-26  Updated: 2020-10-06  Resolved: 2020-09-01

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Virtual Columns
Affects Version/s: 10.2, 10.3, 10.4
Fix Version/s: 10.2.35, 10.3.26, 10.4.16, 10.5.7

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

Issue Links:
Relates
relates to MDEV-20464 Signal 8 in row_search_with_covering_... Closed
relates to MDEV-23600 SIGFPE in row_search_with_covering_pr... Closed

 Description   

Note: It currently fails pretty much every time for me, but it's still a non-deterministic concurrent test case, run with --repeat=N.

--source include/have_innodb.inc
 
SET @prefix_index_cluster_optimization.save= @@global.innodb_prefix_index_cluster_optimization;
SET GLOBAL innodb_prefix_index_cluster_optimization= ON;
 
CREATE TABLE t1 ( 
    a VARBINARY(1024),
    b BIT(10),
    c BIT(10) AS (b) VIRTUAL,
    UNIQUE(c,a(64))
) ENGINE=InnoDB;
 
INSERT INTO t1 (a,b) VALUES ('foo',b'0'),('bar',b'1');
 
--connect (con1,localhost,root,,test)
SELECT * FROM information_schema.collations LIMIT 1;
--connection default
--send
    SELECT * FROM t1;
--connection con1
SELECT c FROM t1;
 
# CLeanup
--disconnect con1
--connection default
--reap
DROP TABLE t1;
SET GLOBAL innodb_prefix_index_cluster_optimization= @prefix_index_cluster_optimization.save;

10.2 9de2e60d

2019-08-26 13:26:28 0x7f25c05ee700  InnoDB: Assertion failure in file /data/src/10.2/storage/innobase/row/row0sel.cc line 4194
InnoDB: Failing assertion: field->prefix_len > 0
 
#6  0x0000563d9e68dd3a in ut_dbg_assertion_failed (expr=0x563d9ec1bc03 "field->prefix_len > 0", file=0x563d9ec1b470 "/data/src/10.2/storage/innobase/row/row0sel.cc", line=4194) at /data/src/10.2/storage/innobase/ut/ut0dbg.cc:60
#7  0x0000563d9e5f4fdf in row_search_with_covering_prefix (prebuilt=0x7f257001af08, rec=0x7f25c0e0807f "", offsets=0x7f25c05eacc0) at /data/src/10.2/storage/innobase/row/row0sel.cc:4194
#8  0x0000563d9e5f7a2a in row_search_mvcc (buf=0x7f25700199c8 "\377", mode=PAGE_CUR_G, prebuilt=0x7f257001af08, match_mode=0, direction=0) at /data/src/10.2/storage/innobase/row/row0sel.cc:5355
#9  0x0000563d9e485a5b in ha_innobase::index_read (this=0x7f2570019238, buf=0x7f25700199c8 "\377", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9471
#10 0x0000563d9e4869a6 in ha_innobase::index_first (this=0x7f2570019238, buf=0x7f25700199c8 "\377") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9847
#11 0x0000563d9e279c9d in handler::ha_index_first (this=0x7f2570019238, buf=0x7f25700199c8 "\377") at /data/src/10.2/sql/handler.cc:2802
#12 0x0000563d9e0678f5 in join_read_first (tab=0x7f2570012ae0) at /data/src/10.2/sql/sql_select.cc:19820
#13 0x0000563d9e06532a in sub_select (join=0x7f2570011998, join_tab=0x7f2570012ae0, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18828
#14 0x0000563d9e064913 in do_select (join=0x7f2570011998, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18375
#15 0x0000563d9e03e45f in JOIN::exec_inner (this=0x7f2570011998) at /data/src/10.2/sql/sql_select.cc:3627
#16 0x0000563d9e03d91a in JOIN::exec (this=0x7f2570011998) at /data/src/10.2/sql/sql_select.cc:3422
#17 0x0000563d9e03ead0 in mysql_select (thd=0x7f2570000b00, tables=0x7f2570011290, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2570011978, unit=0x7f2570004700, select_lex=0x7f2570004e40) at /data/src/10.2/sql/sql_select.cc:3822
#18 0x0000563d9e032d3c in handle_select (thd=0x7f2570000b00, lex=0x7f2570004638, result=0x7f2570011978, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:365
#19 0x0000563d9dffdf05 in execute_sqlcom_select (thd=0x7f2570000b00, all_tables=0x7f2570011290) at /data/src/10.2/sql/sql_parse.cc:6226
#20 0x0000563d9dff48e6 in mysql_execute_command (thd=0x7f2570000b00) at /data/src/10.2/sql/sql_parse.cc:3533
#21 0x0000563d9e001db8 in mysql_parse (thd=0x7f2570000b00, rawbuf=0x7f25700110a8 "SELECT c FROM t1", length=16, parser_state=0x7f25c05ed200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7760
#22 0x0000563d9dff00c1 in dispatch_command (command=COM_QUERY, thd=0x7f2570000b00, packet=0x7f25700088c1 "", packet_length=16, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1832
#23 0x0000563d9dfeea15 in do_command (thd=0x7f2570000b00) at /data/src/10.2/sql/sql_parse.cc:1385
#24 0x0000563d9e14351d in do_handle_one_connection (connect=0x563da16fcfd0) at /data/src/10.2/sql/sql_connect.cc:1336
#25 0x0000563d9e143288 in handle_one_connection (arg=0x563da16fcfd0) at /data/src/10.2/sql/sql_connect.cc:1241
#26 0x0000563d9e972900 in pfs_spawn_thread (arg=0x563da1720620) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#27 0x00007f25c7b604a4 in start_thread (arg=0x7f25c05ee700) at pthread_create.c:456
#28 0x00007f25c60a8d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Both debug and non-debug fail.
Also reproducible on 10.5.
Not applicable to 10.1.



 Comments   
Comment by Marko Mäkelä [ 2020-08-27 ]

Thank you, this is even more proof of the suspicion that I expressed in MDEV-23600: we should avoid unnecessary operation on characters.

Comment by Marko Mäkelä [ 2020-09-01 ]

The same assertion can be triggered with the MDEV-20464 test case and the initial MDEV-23600 fix on 10.2. I will not add this test case, because it is more complex. With my current work-in-progress fix of MDEV-23600 on 10.2, the test passed 15,000 times.

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