[MDEV-30067] Assertion `!error' failed in ha_partition::delete_row on DELETE Created: 2022-11-22  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Partitioning, Storage Engine - Spider
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Yuchen Pei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates

 Description   

INSTALL PLUGIN Spider SONAME 'ha_spider.so';
CREATE USER Spider@localhost IDENTIFIED BY '';
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD '');
CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
INSERT INTO t VALUES (0,1,0),(1,0,0),(2,0,0);
CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2));
DELETE FROM a2,a1 USING t1 AS a1 JOIN t1 AS a2,t1 AS a3;

Leads to:

10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

mysqld: /test/10.11_dbg/sql/ha_partition.cc:4782: virtual int ha_partition::delete_row(const uchar*): Assertion `!error' failed.

10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

Core was generated by `/test/MD171122-mariadb-10.11.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x14d2316c0700 (LWP 2750433))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014d24a822859 in __GI_abort () at abort.c:79
#2  0x000014d24a822729 in __assert_fail_base (fmt=0x14d24a9b8588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555d6fc34ee7 "!error", file=0x555d6fc9b9d8 "/test/10.11_dbg/sql/ha_partition.cc", line=4782, function=<optimized out>) at assert.c:92
#3  0x000014d24a833fd6 in __GI___assert_fail (assertion=assertion@entry=0x555d6fc34ee7 "!error", file=file@entry=0x555d6fc9b9d8 "/test/10.11_dbg/sql/ha_partition.cc", line=line@entry=4782, function=function@entry=0x555d6fc9c2c8 "virtual int ha_partition::delete_row(const uchar*)") at assert.c:101
#4  0x0000555d6f45e9e3 in ha_partition::delete_row (this=0x14d1ec0e70e0, buf=0x14d1ec0d9d78 "\377") at /test/10.11_dbg/sql/ha_partition.cc:4782
#5  0x0000555d6f1d3785 in handler::ha_delete_row (this=0x14d1ec0e70e0, buf=0x14d1ec0d9d78 "\377") at /test/10.11_dbg/sql/handler.cc:7700
#6  0x0000555d6ee96021 in TABLE::delete_row (this=0x14d1ec0cf708) at /test/10.11_dbg/sql/sql_delete.cc:281
#7  multi_delete::do_table_deletes (this=this@entry=0x14d1ec016128, table=table@entry=0x14d1ec0cf708, sort_info=<optimized out>, ignore=false) at /test/10.11_dbg/sql/sql_delete.cc:1557
#8  0x0000555d6ee96305 in multi_delete::do_deletes (this=this@entry=0x14d1ec016128) at /test/10.11_dbg/sql/sql_delete.cc:1503
#9  0x0000555d6ee9638c in multi_delete::send_eof (this=0x14d1ec016128) at /test/10.11_dbg/sql/sql_delete.cc:1611
#10 0x0000555d6ef72c6d in do_select (procedure=<optimized out>, join=0x14d1ec016198) at /test/10.11_dbg/sql/sql_select.cc:21414
#11 JOIN::exec_inner (this=this@entry=0x14d1ec016198) at /test/10.11_dbg/sql/sql_select.cc:4823
#12 0x0000555d6ef72fd4 in JOIN::exec (this=this@entry=0x14d1ec016198) at /test/10.11_dbg/sql/sql_select.cc:4601
#13 0x0000555d6ef70f88 in mysql_select (thd=thd@entry=0x14d1ec000d48, tables=0x14d1ec0140f0, fields=@0x14d1ec005a58: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d1ec015f40, last = 0x14d1ec015f40, elements = 1}, <No data fields>}, conds=conds@entry=0x0, og_num=og_num@entry=0, order=order@entry=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=37385559870336, result=0x14d1ec016128, unit=0x14d1ec004f88, select_lex=0x14d1ec0057b8) at /test/10.11_dbg/sql/sql_select.cc:5081
#14 0x0000555d6eeedb55 in mysql_execute_command (thd=thd@entry=0x14d1ec000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:4864
#15 0x0000555d6eed9606 in mysql_parse (thd=thd@entry=0x14d1ec000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d2316bf300) at /test/10.11_dbg/sql/sql_parse.cc:7998
#16 0x0000555d6eee6b41 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d1ec000d48, packet=packet@entry=0x14d1ec00adf9 "DELETE FROM a2,a1 USING t1 AS a1 JOIN t1 AS a2,t1 AS a3", packet_length=packet_length@entry=55, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346
#17 0x0000555d6eee8f7f in do_command (thd=0x14d1ec000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#18 0x0000555d6f043763 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x555d7296a678, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
#19 0x0000555d6f043c32 in handle_one_connection (arg=0x555d7296a678) at /test/10.11_dbg/sql/sql_connect.cc:1318
#20 0x000014d24ad33609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x000014d24a91f133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.27 (dbg), 10.5.18 (dbg), 10.6.10 (dbg), 10.7.6 (dbg), 10.8.5 (dbg), 10.9.3 (dbg), 10.10.2 (dbg), 10.11.2 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.4.27 (opt), 10.5.18 (opt), 10.6.10 (opt), 10.7.6 (opt), 10.8.5 (opt), 10.9.3 (opt), 10.10.2 (opt), 10.11.2 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)



 Comments   
Comment by Roel Van de Paar [ 2022-11-22 ]

Secondary testcase, leading to similar but not indentical stack

INSTALL PLUGIN Spider SONAME 'ha_spider.so';
CREATE USER Spider@localhost IDENTIFIED BY '';
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD '');
CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
INSERT INTO t VALUES (1,1,''),(11,'',''),(12,0,'');
ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2));
DELETE FROM t1 WHERE (SELECT 1 FROM t1 b WHERE b.c1=t1.c1)>0;

Leads to:

10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

mysqld: /test/10.11_dbg/sql/ha_partition.cc:4782: virtual int ha_partition::delete_row(const uchar*): Assertion `!error' failed.

10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

Core was generated by `/test/MD171122-mariadb-10.11.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x150cbc12d700 (LWP 91772))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000150ce1eed859 in __GI_abort () at abort.c:79
#2  0x0000150ce1eed729 in __assert_fail_base (fmt=0x150ce2083588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556aefd11ee7 "!error", file=0x556aefd789d8 "/test/10.11_dbg/sql/ha_partition.cc", line=4782, function=<optimized out>) at assert.c:92
#3  0x0000150ce1efefd6 in __GI___assert_fail (assertion=assertion@entry=0x556aefd11ee7 "!error", file=file@entry=0x556aefd789d8 "/test/10.11_dbg/sql/ha_partition.cc", line=line@entry=4782, function=function@entry=0x556aefd792c8 "virtual int ha_partition::delete_row(const uchar*)") at assert.c:101
#4  0x0000556aef53b9e3 in ha_partition::delete_row (this=0x150c3c0a9090, buf=0x150c3c097918 "\376\v") at /test/10.11_dbg/sql/ha_partition.cc:4782
#5  0x0000556aef2b0785 in handler::ha_delete_row (this=0x150c3c0a9090, buf=0x150c3c097918 "\376\v") at /test/10.11_dbg/sql/handler.cc:7700
#6  0x0000556aeef738eb in TABLE::delete_row (this=0x150c3c091f08) at /test/10.11_dbg/sql/sql_delete.cc:281
#7  0x0000556aeef71e30 in mysql_delete (thd=thd@entry=0x150c3c000d48, table_list=0x150c3c013240, conds=<optimized out>, order_list=order_list@entry=0x150c3c005aa0, limit=18446744073709551614, options=<optimized out>, result=<optimized out>) at /test/10.11_dbg/sql/sql_delete.cc:842
#8  0x0000556aeefca719 in mysql_execute_command (thd=thd@entry=0x150c3c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_limit.h:85
#9  0x0000556aeefb6606 in mysql_parse (thd=thd@entry=0x150c3c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x150cbc12c300) at /test/10.11_dbg/sql/sql_parse.cc:7998
#10 0x0000556aeefc3b41 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x150c3c000d48, packet=packet@entry=0x150c3c00adf9 "DELETE FROM t1 WHERE (SELECT 1 FROM t1 b WHERE b.c1=t1.c1)>0", packet_length=packet_length@entry=60, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346
#11 0x0000556aeefc5f7f in do_command (thd=0x150c3c000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#12 0x0000556aef120763 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x556af2b7aad8, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
#13 0x0000556aef120c32 in handle_one_connection (arg=0x556af2b7aad8) at /test/10.11_dbg/sql/sql_connect.cc:1318
#14 0x0000150ce23fe609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x0000150ce1fea133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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