Bug #97272 Assertion "direction .= 0"
Submitted: 17 Oct 2019 13:21 Modified: 18 Oct 2019 5:33
Reporter: Hrvoje Matijakovic Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:8.0.18 OS:Linux
Assigned to: CPU Architecture:x86
Tags: regression

[17 Oct 2019 13:21] Hrvoje Matijakovic
Description:
Running the queries results in the assertion on 8.0.18 (debug):

gdb from the debug build:
Core was generated by `/sdc/MS151019-mysql-8.0.18-linux-x86_64-debug/bin/mysqld --no-defaults --basedi'.
Program terminated with signal 6, Aborted.
#0  0x00007f04bd168a61 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:59
59        val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
+bt
#0  0x00007f04bd168a61 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:59
#1  0x00000000048f003d in my_write_core (sig=6) at /sdc/MS-8.0.18_dbg/mysys/stacktrace.cc:305
#2  0x00000000035e030e in handle_fatal_signal (sig=6) at /sdc/MS-8.0.18_dbg/sql/signal_handler.cc:169
#3  <signal handler called>
#4  0x00007f04bafb0337 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55
#5  0x00007f04bafb1a28 in __GI_abort () at abort.c:90
#6  0x0000000004d0e9eb in ut_dbg_assertion_failed (expr=0x6836b4e "direction != 0", file=0x68356c8 "/sdc/MS-8.0.18_dbg/storage/innobase/row/row0sel.cc", line=4378) at /sdc/MS-8.0.18_dbg/storage/innobase/ut/ut0dbg.cc:98
#7  0x0000000004c46d67 in row_compare_row_to_range (set_also_gap_locks=true, trx=0x7f04a3800c80, unique_search=0, index=0x7f04618dca38, clust_index=0x7f04618dca38, rec=0x7f049a7a00ea "\200", comp=1, mode=PAGE_CUR_GE, direction=0, search_tuple=0x7f046191e570, offsets=0x7f04b994ea40, moves_up=1, prebuilt=0x7f046191e0b8) at /sdc/MS-8.0.18_dbg/storage/innobase/row/row0sel.cc:4378
#8  0x0000000004c49519 in row_search_mvcc (buf=0x7f046189fb28 "\377", mode=PAGE_CUR_GE, prebuilt=0x7f046191e0b8, match_mode=0, direction=0) at /sdc/MS-8.0.18_dbg/storage/innobase/row/row0sel.cc:5191
#9  0x00000000049f002c in ha_innobase::index_read (this=0x7f0461910028, buf=0x7f046189fb28 "\377", key_ptr=0x7f0461920058 "\003", key_len=4, find_flag=HA_READ_KEY_OR_NEXT) at /sdc/MS-8.0.18_dbg/storage/innobase/handler/ha_innodb.cc:9748
#10 0x0000000003795f86 in handler::index_read_map (this=0x7f0461910028, buf=0x7f046189fb28 "\377", key=0x7f0461920058 "\003", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /sdc/MS-8.0.18_dbg/sql/handler.h:4921
#11 0x0000000003783b45 in handler::ha_index_read_map (this=0x7f0461910028, buf=0x7f046189fb28 "\377", key=0x7f0461920058 "\003", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /sdc/MS-8.0.18_dbg/sql/handler.cc:3127
#12 0x000000000378e7e8 in handler::read_range_first (this=0x7f0461910028, start_key=0x7f0461910110, end_key=0x7f0461910130, eq_range_arg=false, sorted=true) at /sdc/MS-8.0.18_dbg/sql/handler.cc:7137
#13 0x00000000049f11cd in ha_innobase::read_range_first (this=0x7f0461910028, start_key=0x7f0461910110, end_key=0x7f0461910130, eq_range_arg=false, sorted=true) at /sdc/MS-8.0.18_dbg/storage/innobase/handler/ha_innodb.cc:10120
#14 0x000000000378c6ec in handler::multi_range_read_next (this=0x7f0461910028, range_info=0x7f04b994ffe0) at /sdc/MS-8.0.18_dbg/sql/handler.cc:6296
#15 0x000000000378d646 in DsMrr_impl::dsmrr_next (this=0x7f0461911638, range_info=0x7f04b994ffe0) at /sdc/MS-8.0.18_dbg/sql/handler.cc:6640
#16 0x0000000004a0a944 in ha_innobase::multi_range_read_next (this=0x7f0461910028, range_info=0x7f04b994ffe0) at /sdc/MS-8.0.18_dbg/storage/innobase/handler/ha_innodb.cc:22510
#17 0x000000000378c458 in handler::ha_multi_range_read_next (this=0x7f0461910028, range_info=0x7f04b994ffe0) at /sdc/MS-8.0.18_dbg/sql/handler.cc:6234
#18 0x00000000032951b6 in QUICK_RANGE_SELECT::get_next (this=0x7f04618e61c0) at /sdc/MS-8.0.18_dbg/sql/opt_range.cc:10948
#19 0x00000000032d4c69 in IndexRangeScanIterator::Read (this=0x7f0461900c80) at /sdc/MS-8.0.18_dbg/sql/records.cc:358
#20 0x0000000003370974 in Sql_cmd_delete::delete_from_single_table (this=0x7f0461900c30, thd=0x7f0461820000) at /sdc/MS-8.0.18_dbg/sql/sql_delete.cc:501
#21 0x0000000003371c8e in Sql_cmd_delete::execute_inner (this=0x7f0461900c30, thd=0x7f0461820000) at /sdc/MS-8.0.18_dbg/sql/sql_delete.cc:816
#22 0x0000000003475ec3 in Sql_cmd_dml::execute (this=0x7f0461900c30, thd=0x7f0461820000) at /sdc/MS-8.0.18_dbg/sql/sql_select.cc:704
#23 0x000000000340fca5 in mysql_execute_command (thd=0x7f0461820000, first_level=true) at /sdc/MS-8.0.18_dbg/sql/sql_parse.cc:3450
#24 0x0000000003415bb6 in mysql_parse (thd=0x7f0461820000, parser_state=0x7f04b9951ae0) at /sdc/MS-8.0.18_dbg/sql/sql_parse.cc:5257
#25 0x000000000340b046 in dispatch_command (thd=0x7f0461820000, com_data=0x7f04b9952b90, command=COM_QUERY) at /sdc/MS-8.0.18_dbg/sql/sql_parse.cc:1765
#26 0x000000000340958b in do_command (thd=0x7f0461820000) at /sdc/MS-8.0.18_dbg/sql/sql_parse.cc:1273
#27 0x00000000035caf99 in handle_connection (arg=0x7f046c87a3e0) at /sdc/MS-8.0.18_dbg/sql/conn_handler/connection_handler_per_thread.cc:302
#28 0x00000000050ac3c0 in pfs_spawn_thread (arg=0x7f04b906a6e0) at /sdc/MS-8.0.18_dbg/storage/perfschema/pfs.cc:2854
#29 0x00007f04bd163e65 in start_thread (arg=0x7f04b9953700) at pthread_create.c:307
#30 0x00007f04bb07888d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Couldn't reproduce on the release build.

How to repeat:
#1
CREATE DATABASE test;
USE test;
create temporary TABLE t1(a int key,b int,key(b));
INSERT INTO t1 VALUES(1,10),(2,20),(3,30),(4,40);
INSERT INTO t1 VALUES(5,10);
delete FROM t1 where a>=3 and a<=4;
delete FROM t1 where a>=3 and a<=4;

#2
CREATE DATABASE test;
USE test;
CREATE TABLE t1(a int key,b int,unique (b));
INSERT INTO t1 VALUES(11,11);
INSERT INTO t1 VALUES(5,6);
DELETE FROM t1;
update t1 set b=repeat(left(b,1),255) where a between 1 and 5;

#3
CREATE DATABASE test;
USE test;
create temporary TABLE t1(i int,f float,primary key pk(i),unique index fk(f));
insert INTO t1 values(666,51.3);
INSERT INTO t1 VALUES(3,2);
delete FROM t1 where i<=3;
delete FROM t1 where i<=3;
[18 Oct 2019 5:33] MySQL Verification Team
Hello Hrvoje Matijakovic,

Thank you for the bug report and test case.
Verified as described.

regards,
Umesh
[21 Oct 2019 8:40] Jon Olav Hauglid
Posted by developer:
 
Duplicate of Bug #30112238 - [INNODB] ASSERTION FAILURE: ROW0SEL.CC.*DIRECTION != 0

Verified by git bisect.