mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -1021,7 +1021,7 @@ insert into t2 values (0), (2);
|
|||||||
update t1 left join t2 on a > b set b= 2 order by b;
|
update t1 left join t2 on a > b set b= 2 order by b;
|
||||||
drop table t1, t2;
|
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;
|
create or replace table t1 (x int) with system versioning partition by system_time;
|
||||||
alter table t1 add partition partitions 1;
|
alter table t1 add partition partitions 1;
|
||||||
@ -1080,7 +1080,30 @@ pk f
|
|||||||
update t1 set f=pk;
|
update t1 set f=pk;
|
||||||
delete from t1;
|
delete from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
# End of 10.5 tests
|
#
|
||||||
# Test cleanup
|
# MDEV-22207 Drop default history partitions renders table inaccessible
|
||||||
drop database test;
|
#
|
||||||
create database test;
|
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;
|
drop table t1, t2;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-22153 ALTER add default history partitions breaks table
|
--echo # MDEV-22153 ALTER add default history partitions makes table inaccessible
|
||||||
--echo #
|
--echo #
|
||||||
create or replace table t1 (x int) with system versioning partition by system_time;
|
create or replace table t1 (x int) with system versioning partition by system_time;
|
||||||
alter table t1 add partition partitions 1;
|
alter table t1 add partition partitions 1;
|
||||||
@ -868,7 +868,6 @@ alter table t1 add partition partitions 3;
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
drop tables t1;
|
drop tables t1;
|
||||||
|
|
||||||
--source suite/versioning/common_finish.inc
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-17091 Assertion `old_part_id == m_last_part' failed in
|
--echo # MDEV-17091 Assertion `old_part_id == m_last_part' failed in
|
||||||
--echo # ha_partition::update_row or `part_id == m_last_part' 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;
|
delete from t1;
|
||||||
drop table 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
|
alter table t1 drop partition p0, p2;
|
||||||
drop database test;
|
--replace_result $default_engine DEFAULT_ENGINE
|
||||||
create database test;
|
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);
|
my_error(ER_VERS_WRONG_PARTS, MYF(0), table->s->table_name.str);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
tab_part_info->use_default_partitions= false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user