[MDEV-25532] Assertion `part_id == m_last_part' failed in ha_partition::delete_row Created: 2021-04-27  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Partitioning
Affects Version/s: 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Alexey Botchkov
Resolution: Unresolved Votes: 0
Labels: not-10.2, regression

Issue Links:
Relates
relates to MDEV-22667 Multi-delete on table with unique blo... Confirmed
relates to MDEV-23235 Assertion `part_id == m_last_part' fa... Closed

 Description   

Very similar to MDEV-23235, however the testcase and required features differ significantly, as do the affected versions. The testcase is deterministic.

SET sql_mode='';
CREATE TABLE t (a INT,b INT) ENGINE=InnoDB PARTITION BY KEY(a) (PARTITION p0,PARTITION p);
INSERT INTO t (b) VALUES (1);
ALTER TABLE t ADD PRIMARY KEY(a);
DELETE FROM t;

Leads to:

10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Debug)

mysqld: /test/10.6_dbg/sql/ha_partition.cc:4677: virtual int ha_partition::delete_row(const uchar*): Assertion `part_id == m_last_part' failed.

10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Debug)

Core was generated by `/test/MD150421-mariadb-10.6.0-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 0x14c170dee700 (LWP 2199076))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014c17b253859 in __GI_abort () at abort.c:79
#2  0x000014c17b253729 in __assert_fail_base (fmt=0x14c17b3e9588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x564760605591 "part_id == m_last_part", file=0x564760600be0 "/test/10.6_dbg/sql/ha_partition.cc", line=4677, function=<optimized out>) at assert.c:92
#3  0x000014c17b264f36 in __GI___assert_fail (assertion=assertion@entry=0x564760605591 "part_id == m_last_part", file=file@entry=0x564760600be0 "/test/10.6_dbg/sql/ha_partition.cc", line=line@entry=4677, function=function@entry=0x564760601de8 "virtual int ha_partition::delete_row(const uchar*)") at assert.c:101
#4  0x000056475fd51a9b in ha_partition::delete_row (this=0x14c120076d80, buf=0x14c1200bb5b0 <incomplete sequence \375>) at /test/10.6_dbg/sql/ha_partition.cc:4677
#5  0x000056475fa3e98c in handler::ha_delete_row (this=0x14c120076d80, buf=0x14c1200bb5b0 <incomplete sequence \375>) at /test/10.6_dbg/sql/handler.cc:7274
#6  0x000056475fc253d9 in TABLE::delete_row (this=0x14c1200e2a98) at /test/10.6_dbg/sql/sql_delete.cc:280
#7  0x000056475fc23596 in mysql_delete (thd=thd@entry=0x14c120000db8, table_list=0x14c120013c70, conds=<optimized out>, order_list=order_list@entry=0x14c120005a30, limit=18446744073709551615, options=<optimized out>, result=0x0) at /test/10.6_dbg/sql/sql_delete.cc:815
#8  0x000056475f76ad20 in mysql_execute_command (thd=thd@entry=0x14c120000db8) at /test/10.6_dbg/sql/sql_limit.h:67
#9  0x000056475f754a06 in mysql_parse (thd=thd@entry=0x14c120000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c170ded410) at /test/10.6_dbg/sql/sql_parse.cc:8017
#10 0x000056475f7637df in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c120000db8, packet=packet@entry=0x14c12000b369 "DELETE FROM t", packet_length=packet_length@entry=13, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1331
#11 0x000056475f766bd5 in do_command (thd=0x14c120000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#12 0x000056475f8c077c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x564761c4b518, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#13 0x000056475f8c0d81 in handle_one_connection (arg=arg@entry=0x564761c4b518) at /test/10.6_dbg/sql/sql_connect.cc:1312
#14 0x000056475fd6ea03 in pfs_spawn_thread (arg=0x564761b6fb28) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#15 0x000014c17b761609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#16 0x000014c17b350293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
10.3.29 (dbg), 10.4.19 (dbg), 10.5.10 (dbg), 10.6.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.33 (dbg), 5.7.33 (opt), 8.0.23 (dbg), 8.0.23 (opt)


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