1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

MDEV-22155 ALTER add default history partitions name clash on non-default partitions

If any of default names clashes with existing names find next large
enough name gap for the requested number of partitions.
This commit is contained in:
Aleksey Midenkov
2020-04-27 16:36:03 +03:00
parent e174fa9d79
commit 73aa78ea9d
5 changed files with 109 additions and 10 deletions

View File

@@ -1107,3 +1107,45 @@ t1 CREATE TABLE `t1` (
PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop tables t1;
#
# MDEV-22155 ALTER add default history partitions name clash on non-default partitions
#
create or replace table t1 (x int) with system versioning
partition by system_time limit 1
(partition p2 history, partition p8 history, partition pn current);
alter table t1 add partition partitions 1;
alter table t1 add partition partitions 2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME LIMIT 1
(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p8` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p4` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p5` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
alter table t1 add partition partitions 8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME LIMIT 1
(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p8` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p4` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p5` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p9` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p10` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p11` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p12` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p13` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p14` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p15` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p16` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop tables t1;

View File

@@ -904,4 +904,20 @@ show create table t1;
drop tables t1;
--echo #
--echo # MDEV-22155 ALTER add default history partitions name clash on non-default partitions
--echo #
create or replace table t1 (x int) with system versioning
partition by system_time limit 1
(partition p2 history, partition p8 history, partition pn current);
alter table t1 add partition partitions 1;
alter table t1 add partition partitions 2;
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
alter table t1 add partition partitions 8;
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
drop tables t1;
--source suite/versioning/common_finish.inc