mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-22753 Server crashes upon INSERT into versioned partitioned table with WITHOUT OVERLAPS
Add `append_system_key_parts` call inside `fast_alter_partition_table` during new partition creation.
This commit is contained in:
parent
35d327fddb
commit
8e6e5acef1
3 changed files with 46 additions and 0 deletions
|
@ -296,4 +296,28 @@ a s e
|
|||
foo 2012-01-01 00:00:00 2015-12-31 00:00:00
|
||||
bar 2012-01-01 00:00:00 2015-12-31 00:00:00
|
||||
baz 2013-01-01 00:00:00 2014-01-01 00:00:00
|
||||
# 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
|
||||
create or replace 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);
|
||||
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` (`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');
|
||||
drop table t, t1;
|
||||
|
|
|
@ -285,4 +285,19 @@ insert into t1 values ('bar', '2012-01-01', '2015-12-31'),
|
|||
('baz', '2013-01-01', '2014-01-01');
|
||||
select * from t1;
|
||||
|
||||
--echo # MDEV-22753 Server crashes in handler::ha_check_overlaps or error 190
|
||||
--echo # "Incompatible key or row definition" upon INSERT into versioned
|
||||
--echo # partitioned table with WITHOUT OVERLAPS
|
||||
create or replace 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);
|
||||
show create table t1;
|
||||
insert into t1 values (1,'2013-01-12','2015-11-04'),
|
||||
(2,'2016-03-15','2024-11-09');
|
||||
|
||||
|
||||
|
||||
drop table t, t1;
|
||||
|
|
|
@ -75,6 +75,9 @@ static int copy_data_between_tables(THD *, TABLE *,TABLE *,
|
|||
ha_rows *, ha_rows *,
|
||||
Alter_info::enum_enable_or_disable,
|
||||
Alter_table_ctx *);
|
||||
static bool append_system_key_parts(THD *thd, HA_CREATE_INFO *create_info,
|
||||
Alter_info *alter_info, KEY **key_info,
|
||||
uint key_count);
|
||||
static int mysql_prepare_create_table(THD *, HA_CREATE_INFO *, Alter_info *,
|
||||
uint *, handler *, KEY **, uint *, int);
|
||||
static uint blob_length_by_type(enum_field_types type);
|
||||
|
@ -1821,6 +1824,10 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
|||
strxmov(shadow_frm_name, shadow_path, reg_ext, NullS);
|
||||
if (flags & WFRM_WRITE_SHADOW)
|
||||
{
|
||||
if (append_system_key_parts(lpt->thd, lpt->create_info, lpt->alter_info,
|
||||
&lpt->key_info_buffer, 0))
|
||||
DBUG_RETURN(true);
|
||||
|
||||
if (mysql_prepare_create_table(lpt->thd, lpt->create_info, lpt->alter_info,
|
||||
&lpt->db_options, lpt->table->file,
|
||||
&lpt->key_info_buffer, &lpt->key_count,
|
||||
|
|
Loading…
Reference in a new issue