[MDEV-22753] Server crashes in handler::ha_check_overlaps or error 190 "Incompatible key or row definition" upon INSERT into versioned partitioned table with WITHOUT OVERLAPS Created: 2020-05-29  Updated: 2020-06-05  Resolved: 2020-06-05

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Versioned Tables
Affects Version/s: 10.5
Fix Version/s: 10.5.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates

 Description   

--source include/have_innodb.inc
--source include/have_partition.inc
 
CREATE TABLE t1 (f INT, s DATE, e DATE, PERIOD FOR p(s,e), UNIQUE(f, p WITHOUT OVERLAPS)) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY system_time LIMIT 1000 (PARTITION p1 HISTORY, PARTITION pn CURRENT);
ALTER TABLE t1 ADD PARTITION (PARTITION p2 HISTORY);
INSERT INTO t1 VALUES (1,'2013-01-12','2015-11-04'), (2,'2016-03-15','2024-11-09');
 
# Cleanup
DROP TABLE t1;

10.5 c2a92918

#3  <signal handler called>
#4  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:299
#5  0x0000556ba7a691a5 in handler::ha_check_overlaps (this=0x7f15941b4290, old_data=0x0, new_data=0x7f1594220ad8 "\375\001") at /data/src/10.5/sql/handler.cc:6834
#6  0x0000556ba7a698ef in handler::ha_write_row (this=0x7f15941b4290, buf=0x7f1594220ad8 "\375\001") at /data/src/10.5/sql/handler.cc:6973
#7  0x0000556ba76b4d83 in write_record (thd=0x7f1594000b18, table=0x7f15941b3418, info=0x7f15c4d54bf0, sink=0x0) at /data/src/10.5/sql/sql_insert.cc:2091
#8  0x0000556ba76b1c2c in mysql_insert (thd=0x7f1594000b18, table_list=0x7f1594013aa8, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at /data/src/10.5/sql/sql_insert.cc:1088
#9  0x0000556ba7703568 in mysql_execute_command (thd=0x7f1594000b18) at /data/src/10.5/sql/sql_parse.cc:4553
#10 0x0000556ba770efb9 in mysql_parse (thd=0x7f1594000b18, rawbuf=0x7f1594013950 "INSERT INTO t1 VALUES (1,'2013-01-12','2015-11-04'), (2,'2016-03-15','2024-11-09')", length=82, parser_state=0x7f15c4d55520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7991
#11 0x0000556ba76fb365 in dispatch_command (command=COM_QUERY, thd=0x7f1594000b18, packet=0x7f15940086a9 "INSERT INTO t1 VALUES (1,'2013-01-12','2015-11-04'), (2,'2016-03-15','2024-11-09')", packet_length=82, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1875
#12 0x0000556ba76f9a9d in do_command (thd=0x7f1594000b18) at /data/src/10.5/sql/sql_parse.cc:1356
#13 0x0000556ba789d561 in do_handle_one_connection (connect=0x556babef4388, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1411
#14 0x0000556ba789d2c9 in handle_one_connection (arg=0x556babec09f8) at /data/src/10.5/sql/sql_connect.cc:1313
#15 0x0000556ba7dd3fd8 in pfs_spawn_thread (arg=0x556babed0b88) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#16 0x00007f15cd7574a4 in start_thread (arg=0x7f15c4d56700) at pthread_create.c:456
#17 0x00007f15cb88bd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Fails the same way on release-, debug-, and ASAN builds, with InnoDB and Aria.
With MyISAM, it instead produces the corruption-like error:

mysqltest: At line 6: query 'INSERT INTO t1 VALUES (1,'2013-01-12','2015-11-04'), (2,'2016-03-15','2024-11-09')' failed: 1030: Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You may have retry " from storage engine MyISAM



 Comments   
Comment by Nikita Malyavin [ 2020-06-04 ]

table metadata happens broken:

show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `f` int(11) DEFAULT NULL,
  `s` date NOT NULL,
  `e` date NOT NULL,
  PERIOD FOR `p` (`s`, `e`),
  UNIQUE KEY `f` (,`p` WITHOUT OVERLAPS)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
 PARTITION BY SYSTEM_TIME LIMIT 1000
(PARTITION `p1` HISTORY ENGINE = InnoDB,
 PARTITION `p2` HISTORY ENGINE = InnoDB,
 PARTITION `pn` CURRENT ENGINE = InnoDB)
INSERT INTO t1 VALUES (1,'2013-01-12','2015-11-04'),
(2,'2016-03-15','2024-11-09');

It seems that something is not completely initialized before a new partition is created

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