[MDEV-29580] Assertion failures and change in behavior upon using full-text search on a sequence Created: 2022-09-20  Updated: 2024-01-17

Status: Confirmed
Project: MariaDB Server
Component/s: Full-text Search, Sequences
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3, 11.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: regression

Issue Links:
Duplicate
is duplicated by MDEV-33257 Assertion `!return_error || thd->is_... Closed

 Description   

Set to "major" only because it's a recent regression, otherwise it is hardly of any importance, being such a meaningless query.

CREATE SEQUENCE s ENGINE=MyISAM;
--error 0,ER_ILLEGAL_HA
DELETE FROM s WHERE MATCH (next_not_cached_value) AGAINST ('1' IN BOOLEAN MODE);
 
# Cleanup
DROP SEQUENCE s;

10.3 65b4a2af

mysqld: /data/src/10.3/sql/sql_delete.cc:887: bool mysql_delete(THD*, TABLE_LIST*, COND*, SQL_I_List<st_order>*, ha_rows, ulonglong, select_result*): Assertion `!return_error || thd->is_error() || thd->killed' failed.
220920 18:18:36 [ERROR] mysqld got signal 6 ;
 
#7  0x00007ff558aee662 in __GI___assert_fail (assertion=0x55aec42d2ea0 "!return_error || thd->is_error() || thd->killed", file=0x55aec42d2940 "/data/src/10.3/sql/sql_delete.cc", line=887, function=0x55aec42d2c80 "bool mysql_delete(THD*, TABLE_LIST*, COND*, SQL_I_List<st_order>*, ha_rows, ulonglong, select_result*)") at assert.c:101
#8  0x000055aec2e64c51 in mysql_delete (thd=0x62a000060270, table_list=0x62b000000408, conds=0x62b000000cb8, order_list=0x62a000064b30, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.3/sql/sql_delete.cc:887
#9  0x000055aec22d365c in mysql_execute_command (thd=0x62a000060270) at /data/src/10.3/sql/sql_parse.cc:4708
#10 0x000055aec22e95fc in mysql_parse (thd=0x62a000060270, rawbuf=0x62b000000290 "DELETE FROM s WHERE MATCH (next_not_cached_value) AGAINST ('1' IN BOOLEAN MODE)", length=80, parser_state=0x7ff54e15aa00, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7871
#11 0x000055aec22c0ba2 in dispatch_command (command=COM_QUERY, thd=0x62a000060270, packet=0x6290000eb271 "DELETE FROM s WHERE MATCH (next_not_cached_value) AGAINST ('1' IN BOOLEAN MODE)", packet_length=80, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
#12 0x000055aec22bd77e in do_command (thd=0x62a000060270) at /data/src/10.3/sql/sql_parse.cc:1398
#13 0x000055aec267eeb6 in do_handle_one_connection (connect=0x611000006230) at /data/src/10.3/sql/sql_connect.cc:1403
#14 0x000055aec267e7b2 in handle_one_connection (arg=0x611000006230) at /data/src/10.3/sql/sql_connect.cc:1308
#15 0x000055aec3c297d1 in pfs_spawn_thread (arg=0x616000009ff0) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#16 0x00007ff558c87ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007ff558bb7def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

CREATE SEQUENCE s ENGINE=MyISAM;
SELECT * FROM s WHERE MATCH (next_not_cached_value) AGAINST ('1' IN BOOLEAN MODE);
 
# Cleanup
DROP SEQUENCE s;

10.3 65b4a2af

mysqld: /data/src/10.3/sql/protocol.cc:601: void Protocol::end_statement(): Assertion `0' failed.
220920 18:19:39 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fa66dcca662 in __GI___assert_fail (assertion=0x5571b513f380 "0", file=0x5571b513e8c0 "/data/src/10.3/sql/protocol.cc", line=601, function=0x5571b513f2c0 "void Protocol::end_statement()") at assert.c:101
#8  0x00005571b32f457a in Protocol::end_statement (this=0x62a000060848) at /data/src/10.3/sql/protocol.cc:601
#9  0x00005571b357e0b1 in dispatch_command (command=COM_QUERY, thd=0x62a000060270, packet=0x6290000eb271 "SELECT * FROM s WHERE MATCH (next_not_cached_value) AGAINST ('1' IN BOOLEAN MODE)", packet_length=82, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:2410
#10 0x00005571b357777e in do_command (thd=0x62a000060270) at /data/src/10.3/sql/sql_parse.cc:1398
#11 0x00005571b3938eb6 in do_handle_one_connection (connect=0x611000006230) at /data/src/10.3/sql/sql_connect.cc:1403
#12 0x00005571b39387b2 in handle_one_connection (arg=0x611000006230) at /data/src/10.3/sql/sql_connect.cc:1308
#13 0x00005571b4ee37d1 in pfs_spawn_thread (arg=0x616000009ff0) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#14 0x00007fa66de63ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x00007fa66dd93def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

On non-debug builds the behavior also changed for both test cases.

For the first one, with DELETE, it used to be

mysqltest: At line 2: query 'DELETE FROM s WHERE MATCH (next_not_cached_value) AGAINST ('1' IN BOOLEAN MODE)' failed: 1031: Storage engine SEQUENCE of the table `test`.`s` doesn't have this option

and now the query succeeds quietly, not removing anything.

For the 2nd one, with SELECT, it used to return the sequence row, and now it returns an empty result set.

Reproducible with MyISAM and Aria, but not InnoDB.

The changes occurred after this commit in 10.3.36:

commit f9ec9b6abbce8c88b0cfd1888135b9701415162a
Author: Thirunarayanan Balathandayuthapani
Date:   Wed Jul 20 14:14:43 2022 +0530
 
    MDEV-27282      InnoDB: Failing assertion: !query->intersection



 Comments   
Comment by Alice Sherepa [ 2023-07-05 ]

/11/sql/sql_delete.cc:982: bool Sql_cmd_delete::delete_from_single_table(THD*): Assertion `!return_error || thd->is_error() || thd->killed' failed.
230705 16:40:10 [ERROR] mysqld got signal 6 ;
 
Server version: 11.2.0-MariaDB-debug-log source revision: 7c7de020b576a42bd381a9060c3076f85da0d9d4
sql/signal_handler.cc:241(handle_fatal_signal)[0x55cecb15c5e6]
sigaction.c:0(__restore_rt)[0x7f5d737e5420]
sql/sql_delete.cc:983(Sql_cmd_delete::delete_from_single_table(THD*))[0x55ceca70c5e1]
sql/sql_delete.cc:1789(Sql_cmd_delete::execute_inner(THD*))[0x55ceca7148cc]
sql/sql_select.cc:33338(Sql_cmd_dml::execute(THD*))[0x55ceca9ee18f]
sql/sql_parse.cc:4393(mysql_execute_command(THD*, bool))[0x55ceca807f1f]
sql/sql_parse.cc:7769(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55ceca81f80f]
sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55ceca7f7cef]
sql/sql_parse.cc:1405(do_command(THD*, bool))[0x55ceca7f4a39]
sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x55cecaccfd17]
sql/sql_connect.cc:1320(handle_one_connection)[0x55cecaccf674]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55cecb94ca46]
nptl/pthread_create.c:478(start_thread)[0x7f5d737d9609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43)[0x7f5d733aa133]

Comment by Elena Stepanova [ 2023-07-20 ]

Another test case, with blackhole (slightly less innatural than sequence, although not by much). Started failing from the same commit.

INSTALL SONAME 'ha_blackhole';
 
CREATE TABLE t (a varchar(64), fulltext key (a)) ENGINE=BLACKHOLE;
DELETE FROM t WHERE MATCH (a) AGAINST ('guitar');
 
# Cleanup
DROP TABLE t;
UNINSTALL SONAME 'ha_blackhole';

10.4 30f3db3c

mysqld: /data/src/10.4/sql/sql_delete.cc:988: bool mysql_delete(THD*, TABLE_LIST*, COND*, SQL_I_List<st_order>*, ha_rows, ulonglong, select_result*): Assertion `!return_error || thd->is_error() || thd->killed' failed.
230720 14:21:43 [ERROR] mysqld got signal 6 ;
 
#9  0x00007f3278d74df2 in __GI___assert_fail (assertion=0x5617926a2180 "!return_error || thd->is_error() || thd->killed", file=0x5617926a1980 "/data/src/10.4/sql/sql_delete.cc", line=988, function=0x5617926a1d00 "bool mysql_delete(THD*, TABLE_LIST*, COND*, SQL_I_List<st_order>*, ha_rows, ulonglong, select_result*)") at ./assert/assert.c:101
#10 0x0000561790e0a2e6 in mysql_delete (thd=0x62b00005b208, table_list=0x62b000062360, conds=0x62b000062ca0, order_list=0x62b00005fc20, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:988
#11 0x00005617901ea4b0 in mysql_execute_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:4815
#12 0x00005617902005b1 in mysql_parse (thd=0x62b00005b208, rawbuf=0x62b000062228 "DELETE FROM t WHERE MATCH (a) AGAINST ('guitar')", length=48, parser_state=0x7f327100f860, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8010
#13 0x00005617901d687c in dispatch_command (command=COM_QUERY, thd=0x62b00005b208, packet=0x629000230209 "DELETE FROM t WHERE MATCH (a) AGAINST ('guitar')", packet_length=48, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
#14 0x00005617901d33eb in do_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:1378
#15 0x00005617905d207a in do_handle_one_connection (connect=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1420
#16 0x00005617905d1991 in handle_one_connection (arg=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1324
#17 0x0000561791240d5a in pfs_spawn_thread (arg=0x615000003508) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#18 0x00007f3278dc8fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#19 0x00007f3278e495bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

11.1 3883eb63

mariadbd: /data/src/11.1/sql/sql_delete.cc:982: bool Sql_cmd_delete::delete_from_single_table(THD*): Assertion `!return_error || thd->is_error() || thd->killed' failed.
230720 14:23:25 [ERROR] mysqld got signal 6 ;
 
#9  0x00007f6cf3453df2 in __GI___assert_fail (assertion=0x55dd59c2a4e0 "!return_error || thd->is_error() || thd->killed", file=0x55dd59c29d20 "/data/src/11.1/sql/sql_delete.cc", line=982, function=0x55dd59c2a040 "bool Sql_cmd_delete::delete_from_single_table(THD*)") at ./assert/assert.c:101
#10 0x000055dd57b0edfd in Sql_cmd_delete::delete_from_single_table (this=0x6290000e7558, thd=0x62b00007e218) at /data/src/11.1/sql/sql_delete.cc:982
#11 0x000055dd57b16f81 in Sql_cmd_delete::execute_inner (this=0x6290000e7558, thd=0x62b00007e218) at /data/src/11.1/sql/sql_delete.cc:1789
#12 0x000055dd57de4142 in Sql_cmd_dml::execute (this=0x6290000e7558, thd=0x62b00007e218) at /data/src/11.1/sql/sql_select.cc:33338
#13 0x000055dd57c05b4b in mysql_execute_command (thd=0x62b00007e218, is_called_from_prepared_stmt=false) at /data/src/11.1/sql/sql_parse.cc:4393
#14 0x000055dd57c1d1f5 in mysql_parse (thd=0x62b00007e218, rawbuf=0x6290000e6238 "DELETE FROM t WHERE MATCH (a) AGAINST ('guitar')", length=48, parser_state=0x7f6cebcbea30) at /data/src/11.1/sql/sql_parse.cc:7769
#15 0x000055dd57bf56fc in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000258219 "DELETE FROM t WHERE MATCH (a) AGAINST ('guitar')", packet_length=48, blocking=true) at /data/src/11.1/sql/sql_parse.cc:1892
#16 0x000055dd57bf2439 in do_command (thd=0x62b00007e218, blocking=true) at /data/src/11.1/sql/sql_parse.cc:1405
#17 0x000055dd580b9602 in do_handle_one_connection (connect=0x608000002eb8, put_in_cache=true) at /data/src/11.1/sql/sql_connect.cc:1416
#18 0x000055dd580b8fc3 in handle_one_connection (arg=0x608000002e38) at /data/src/11.1/sql/sql_connect.cc:1318
#19 0x000055dd58cd4ed2 in pfs_spawn_thread (arg=0x617000005b98) at /data/src/11.1/storage/perfschema/pfs.cc:2201
#20 0x00007f6cf34a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#21 0x00007f6cf35285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

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