mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
When there are E empty partitions left, auto-create N new empty partitions for SYSTEM_TIME partitioning rotated by INTERVAL/LIMIT and marked by AUTO_INCREMENT keyword. Syntax change: AUTO_INCREMENT keyword (or shorter AUTO may be used instead) after LIMIT/INTERVAL clause. CREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 100000 AUTO_INCREMENT; CREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 WEEK AUTO_INCREMENT; The current revision implements hard-coded values of 1 for E and N. As well as auto-creation threshold MinInterval = 1 hour, MinLimit = 1000. The name for newly added partition will be first chosen as "pX", where X is partition number and "p" is hard-coded name prefix. If this name is already occupied, the X will be incremented until the resulting name will be free to use. ALTER TABLE ADD PARTITION is now always fast. If there some history partition overflow occurs manual ALTER TABLE REBUILD PARTITION is needed.
This commit is contained in:
@@ -164,4 +164,23 @@ update t1 set i = 0;
|
||||
connection slave;
|
||||
connection master;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
|
||||
#
|
||||
create or replace table t1 (x int) with system versioning
|
||||
partition by system_time limit 1000 auto_increment;
|
||||
lock tables t1 write;
|
||||
insert t1 values ();
|
||||
delete from t1;
|
||||
unlock tables;
|
||||
select count(*) - 1 as hist_partitions from information_schema.partitions where table_name = 't1' and table_schema = 'test';
|
||||
hist_partitions
|
||||
2
|
||||
connection slave;
|
||||
select count(*) - 1 as hist_partitions from information_schema.partitions where table_name = 't1' and table_schema = 'test';
|
||||
hist_partitions
|
||||
2
|
||||
connection master;
|
||||
drop database test;
|
||||
create database test;
|
||||
include/rpl_end.inc
|
||||
|
Reference in New Issue
Block a user