[MDEV-28271] Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME Created: 2022-04-08  Updated: 2022-04-29  Resolved: 2022-04-29

Status: Closed
Project: MariaDB Server
Component/s: Versioned Tables
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.3.35, 10.4.25, 10.6.8, 10.7.4, 10.8.3

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: not-10.2, regression

Issue Links:
Relates
relates to MDEV-20077 Warning on full history partition is ... Closed
relates to MDEV-27217 DELETE partition selection doesn't wo... Closed

 Description   

Assertion `bitmap_is_set(&read_partitions, next->id)' failed in partition_info::vers_set_hist_part

CREATE TABLE t (f INT) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1 (PARTITION p1 HISTORY,PARTITION p2 HISTORY,PARTITION p3 CURRENT);
ALTER TABLE t TRUNCATE PARTITION p2;

Leads to:

10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

mysqld: /test/10.9_dbg/sql/partition_info.cc:837: int partition_info::vers_set_hist_part(THD*): Assertion `bitmap_is_set(&read_partitions, next->id)' failed.

10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

Core was generated by `/test/MD160322-mariadb-10.9.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 0x14cd8c1dd700 (LWP 300078))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014cdada9c859 in __GI_abort () at abort.c:79
#2  0x000014cdada9c729 in __assert_fail_base (fmt=0x14cdadc32588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x561ffd165d60 "bitmap_is_set(&read_partitions, next->id)", file=0x561ffd165908 "/test/10.9_dbg/sql/partition_info.cc", line=837, function=<optimized out>) at assert.c:92
#3  0x000014cdadaae006 in __GI___assert_fail (assertion=assertion@entry=0x561ffd165d60 "bitmap_is_set(&read_partitions, next->id)", file=file@entry=0x561ffd165908 "/test/10.9_dbg/sql/partition_info.cc", line=line@entry=837, function=function@entry=0x561ffd165d90 "int partition_info::vers_set_hist_part(THD*)") at assert.c:101
#4  0x0000561ffc5bc824 in partition_info::vers_set_hist_part (this=0x14cd0c032680, thd=thd@entry=0x14cd0c000db8) at /test/10.9_dbg/sql/partition_info.cc:837
#5  0x0000561ffca47d25 in ha_partition::external_lock (this=0x14cd0c01d7c0, thd=0x14cd0c000db8, lock_type=1) at /test/10.9_dbg/sql/ha_partition.cc:4109
#6  0x0000561ffc77c982 in handler::ha_external_lock (this=0x14cd0c01d7c0, thd=thd@entry=0x14cd0c000db8, lock_type=lock_type@entry=1) at /test/10.9_dbg/sql/handler.cc:7053
#7  0x0000561ffc8ee3b1 in lock_external (count=1, tables=0x14cd0c0147f8, thd=0x14cd0c000db8) at /test/10.9_dbg/sql/lock.cc:393
#8  mysql_lock_tables (thd=thd@entry=0x14cd0c000db8, sql_lock=sql_lock@entry=0x14cd0c0147d8, flags=flags@entry=0) at /test/10.9_dbg/sql/lock.cc:338
#9  0x0000561ffc8ef543 in mysql_lock_tables (thd=thd@entry=0x14cd0c000db8, tables=tables@entry=0x14cd0c0147d0, count=count@entry=1, flags=flags@entry=0) at /test/10.9_dbg/sql/lock.cc:301
#10 0x0000561ffc3cc89a in lock_tables (thd=thd@entry=0x14cd0c000db8, tables=0x14cd0c013ed0, count=<optimized out>, flags=flags@entry=0) at /test/10.9_dbg/sql/sql_base.cc:5562
#11 0x0000561ffc5e18ac in Sql_cmd_alter_table_truncate_partition::execute (this=<optimized out>, thd=0x14cd0c000db8) at /test/10.9_dbg/sql/sql_partition_admin.cc:929
#12 0x0000561ffc46a930 in mysql_execute_command (thd=thd@entry=0x14cd0c000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:5988
#13 0x0000561ffc451437 in mysql_parse (thd=thd@entry=0x14cd0c000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14cd8c1dc400) at /test/10.9_dbg/sql/sql_parse.cc:8027
#14 0x0000561ffc4600d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14cd0c000db8, packet=packet@entry=0x14cd0c00b889 "ALTER TABLE t TRUNCATE PARTITION p2", packet_length=packet_length@entry=35, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
#15 0x0000561ffc46351a in do_command (thd=0x14cd0c000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
#16 0x0000561ffc5de228 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561fffdac1a8, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
#17 0x0000561ffc5de82d in handle_one_connection (arg=arg@entry=0x561fffdac1a8) at /test/10.9_dbg/sql/sql_connect.cc:1312
#18 0x0000561ffca64f23 in pfs_spawn_thread (arg=0x561fffcbf738) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
#19 0x000014cdadfad609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#20 0x000014cdadb99163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.3.35 (dbg), 10.4.25 (dbg), 10.5.16 (dbg), 10.6.8 (dbg), 10.7.4 (dbg), 10.8.3 (dbg), 10.9.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.44 (dbg), 10.2.44 (opt), 10.3.35 (opt), 10.4.25 (opt), 10.5.16 (opt), 10.6.8 (opt), 10.7.4 (opt), 10.8.3 (opt), 10.9.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.37 (dbg), 5.7.37 (opt), 8.0.28 (dbg), 8.0.28 (opt)



 Comments   
Comment by Aleksey Midenkov [ 2022-04-23 ]

Please review bb-10.3-midenok

Comment by Nikita Malyavin [ 2022-04-28 ]

ok to push

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