Commit e174fa9d authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-22207 Drop default history partitions renders table inaccessible

This is continuation of MDEV-22153 bug when contiguity of history
partitions is broken. ha_partition::open_read_partitions() can not
handle non-contiguous list of default partitions.

Fix: when default partition is dropped convert list of partitions to
non-default.
parent fbe27127
......@@ -1021,7 +1021,7 @@ insert into t2 values (0), (2);
update t1 left join t2 on a > b set b= 2 order by b;
drop table t1, t2;
#
# MDEV-22153 ALTER add default history partitions breaks table
# MDEV-22153 ALTER add default history partitions makes table inaccessible
#
create or replace table t1 (x int) with system versioning partition by system_time;
alter table t1 add partition partitions 1;
......@@ -1080,7 +1080,30 @@ pk f
update t1 set f=pk;
delete from t1;
drop table t1;
# End of 10.5 tests
# Test cleanup
drop database test;
create database test;
#
# MDEV-22207 Drop default history partitions renders table inaccessible
#
create or replace table t1 (i int) with system versioning
partition by system_time limit 1 partitions 5;
alter table t1 drop partition p0, p2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME LIMIT 1
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
alter table t1 add partition partitions 1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME LIMIT 1
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop tables t1;
......@@ -854,7 +854,7 @@ update t1 left join t2 on a > b set b= 2 order by b;
drop table t1, t2;
--echo #
--echo # MDEV-22153 ALTER add default history partitions breaks table
--echo # MDEV-22153 ALTER add default history partitions makes table inaccessible
--echo #
create or replace table t1 (x int) with system versioning partition by system_time;
alter table t1 add partition partitions 1;
......@@ -868,7 +868,6 @@ alter table t1 add partition partitions 3;
show create table t1;
drop tables t1;
--source suite/versioning/common_finish.inc
--echo #
--echo # MDEV-17091 Assertion `old_part_id == m_last_part' failed in
--echo # ha_partition::update_row or `part_id == m_last_part' in
......@@ -890,8 +889,19 @@ update t1 set f=pk;
delete from t1;
drop table t1;
--echo # End of 10.5 tests
--echo #
--echo # MDEV-22207 Drop default history partitions renders table inaccessible
--echo #
create or replace table t1 (i int) with system versioning
partition by system_time limit 1 partitions 5;
--echo # Test cleanup
drop database test;
create database test;
alter table t1 drop partition p0, p2;
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
alter table t1 add partition partitions 1;
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
drop tables t1;
--source suite/versioning/common_finish.inc
......@@ -5379,6 +5379,7 @@ that are reorganised.
my_error(ER_VERS_WRONG_PARTS, MYF(0), table->s->table_name.str);
goto err;
}
tab_part_info->use_default_partitions= false;
}
else
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment