summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-12-03 11:53:26 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-12-03 11:53:26 +0300
commit6f89946892b976458f38335e7699dad83c86b933 (patch)
treeab98a20589e0023b91c9ac023eb354bbcc36d3ef
parent9ed8d364cd25207fb3b8c0262982b3c34697ce66 (diff)
downloadmariadb-git-6f89946892b976458f38335e7699dad83c86b933.tar.gz
MDEV-17554 versioning partition tests reorganize
Moved partition_rotation, partition_innodb to partition.test
-rw-r--r--mysql-test/suite/versioning/r/partition.result350
-rw-r--r--mysql-test/suite/versioning/r/partition_innodb.result67
-rw-r--r--mysql-test/suite/versioning/r/partition_rotation.result280
-rw-r--r--mysql-test/suite/versioning/t/partition.test265
-rw-r--r--mysql-test/suite/versioning/t/partition_innodb.test80
-rw-r--r--mysql-test/suite/versioning/t/partition_rotation.test178
6 files changed, 613 insertions, 607 deletions
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index b028ea13fc5..583b42bf1ec 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -338,6 +338,284 @@ p2 2 SYSTEM_TIME 02:00:00.000000
pn 3 SYSTEM_TIME NULL
Warnings:
Warning 1292 Incorrect time value: 'CURRENT'
+set timestamp=unix_timestamp('2001-02-03 10:20:30');
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day
+subpartition by key (i) subpartitions 2
+(partition p1 history, partition pn current);
+set timestamp=unix_timestamp('2001-02-03 10:20:40');
+insert t1 values (1);
+delete from t1;
+set timestamp=unix_timestamp('2001-02-04 10:20:50');
+insert t1 values (2);
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
+delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
+select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+subpartition_name partition_description table_rows
+p1sp0 2001-02-04 00:00:00 1
+p1sp1 2001-02-04 00:00:00 1
+pnsp0 CURRENT 0
+pnsp1 CURRENT 0
+set timestamp=unix_timestamp('2001-02-04 10:20:55');
+alter table t1 add partition (partition p0 history, partition p2 history);
+set timestamp=unix_timestamp('2001-02-04 10:30:00');
+insert t1 values (4),(5);
+set timestamp=unix_timestamp('2001-02-04 10:30:10');
+update t1 set i=6 where i=5;
+select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+subpartition_name partition_description table_rows
+p1sp0 2001-02-04 00:00:00 1
+p1sp1 2001-02-04 00:00:00 0
+p0sp0 2001-02-05 00:00:00 1
+p0sp1 2001-02-05 00:00:00 1
+p2sp0 2001-02-06 00:00:00 0
+p2sp1 2001-02-06 00:00:00 0
+pnsp0 CURRENT 0
+pnsp1 CURRENT 2
+## pruning check
+set @ts=(select partition_description from information_schema.partitions
+where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
+select * from t1;
+i
+4
+6
+explain partitions select * from t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL # Using where
+explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p2_p2sp0,p2_p2sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL # Using where
+set @ts=(select row_end from t1 for system_time all where i=1);
+select * from t1 for system_time all where row_end = @ts;
+i
+1
+explain partitions select * from t1 for system_time all where row_end = @ts;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1_p1sp0,p1_p1sp1 # NULL NULL NULL NULL # #
+## INTERVAL ... STARTS
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts 'a';
+ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'STARTS'
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '00:00:00';
+ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'STARTS'
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-00-01 00:00:00';
+ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'STARTS'
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts 946684800;
+ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'STARTS'
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-01 00:00:00';
+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 INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00'
+PARTITIONS 2
+# Test STARTS warning
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day;
+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 INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00'
+PARTITIONS 2
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-01 00:00:01';
+Warnings:
+Warning 4164 `t1`: STARTS is later than query time, first history partition may exceed INTERVAL value
+# Test default STARTS rounding
+set timestamp= unix_timestamp('1999-12-15 13:33:33');
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 second;
+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 INTERVAL 1 SECOND STARTS TIMESTAMP'1999-12-15 13:33:33'
+PARTITIONS 2
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 minute;
+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 INTERVAL 1 MINUTE STARTS TIMESTAMP'1999-12-15 13:33:00'
+PARTITIONS 2
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 hour;
+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 INTERVAL 1 HOUR STARTS TIMESTAMP'1999-12-15 13:00:00'
+PARTITIONS 2
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day;
+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 INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-15 00:00:00'
+PARTITIONS 2
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 month;
+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 INTERVAL 1 MONTH STARTS TIMESTAMP'1999-12-15 00:00:00'
+PARTITIONS 2
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 year;
+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 INTERVAL 1 YEAR STARTS TIMESTAMP'1999-12-15 00:00:00'
+PARTITIONS 2
+# seconds equivalent of 1 day does not round:
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 86400 second;
+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 INTERVAL 86400 SECOND STARTS TIMESTAMP'1999-12-15 13:33:33'
+PARTITIONS 2
+# STARTS value is in local time_zone:
+set time_zone="+03:00";
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-01 00:00:00';
+Warnings:
+Warning 4164 `t1`: STARTS is later than query time, first history partition may exceed INTERVAL value
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t2 (i int) with system versioning
+partition by system_time interval 1 day;
+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 INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00'
+PARTITIONS 2
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00'
+PARTITIONS 2
+set time_zone="+00:00";
+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 INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-31 21:00:00'
+PARTITIONS 2
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-31 21:00:00'
+PARTITIONS 2
+# Test rotation
+set timestamp= unix_timestamp('2001-01-01 00:00:00');
+# it's ok to add partitions for past:
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-01 00:00:00'
+partitions 3;
+# we are warned when we push to present:
+insert into t1 values (0);
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
+set timestamp= unix_timestamp('2001-01-01 00:00:01');
+update t1 set i= i + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
+set timestamp= unix_timestamp('2001-01-01 00:00:02');
+update t1 set i= i + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
+select *, row_end from t1 partition (p0);
+i row_end
+select *, row_end from t1 partition (p1);
+i row_end
+0 2001-01-01 00:00:01.000000
+1 2001-01-01 00:00:02.000000
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+# now we "overflow" first partition a bit:
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-03 00:00:00'
+partitions 3;
+Warnings:
+Warning 4164 `t1`: STARTS is later than query time, first history partition may exceed INTERVAL value
+insert into t1 values (0);
+set timestamp= unix_timestamp('2000-01-01 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-02 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-03 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-04 00:00:01');
+update t1 set i= i + 1;
+select *, row_end from t1 partition (p0);
+i row_end
+0 2000-01-01 00:00:01.000000
+1 2000-01-02 00:00:01.000000
+2 2000-01-03 00:00:01.000000
+select *, row_end from t1 partition (p1);
+i row_end
+3 2000-01-04 00:00:01.000000
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+# and this is how it usually goes:
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day
+partitions 3;
+insert into t1 values (0);
+set timestamp= unix_timestamp('2000-01-01 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-02 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-03 00:00:01');
+update t1 set i= i + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
+set timestamp= unix_timestamp('2000-01-04 00:00:01');
+update t1 set i= i + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
+alter table t1 add partition (partition p2 history, partition p3 history);
+select *, row_end from t1 partition (p0);
+i row_end
+0 2000-01-01 00:00:01.000000
+select *, row_end from t1 partition (p1);
+i row_end
+1 2000-01-02 00:00:01.000000
+select *, row_end from t1 partition (p2);
+i row_end
+2 2000-01-03 00:00:01.000000
+select *, row_end from t1 partition (p3);
+i row_end
+3 2000-01-04 00:00:01.000000
+drop tables t1, t2;
## Subpartitions
create or replace table t1 (x int)
with system versioning
@@ -397,6 +675,76 @@ select * from t1 partition (part1);
f_int1
1
#
+# TRX_ID versioning (moved from partition_innodb.test)
+#
+# MDEV-15951 system versioning by trx id doesn't work with partitioning
+# currently trx_id does not support partitioning by system_time
+create or replace table t1(
+i int,
+row_start bigint unsigned generated always as row start,
+row_end bigint unsigned generated always as row end,
+period for system_time(row_start, row_end)
+) engine=InnoDB with system versioning partition by system_time (
+partition p0 history,
+partition pn current
+);
+ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
+create or replace table t1(
+i int,
+row_start bigint unsigned generated always as row start,
+row_end bigint unsigned generated always as row end,
+period for system_time(row_start, row_end)
+) engine=InnoDB with system versioning;
+alter table t1 partition by system_time (
+partition p0 history,
+partition pn current
+);
+ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
+drop table t1;
+create or replace table t (
+a int primary key,
+row_start bigint unsigned as row start invisible,
+row_end bigint unsigned as row end invisible,
+period for system_time(row_start, row_end)
+) engine=innodb with system versioning
+partition by key() (
+partition p1,
+partition p2
+);
+ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
+create or replace table t (
+a int primary key,
+row_start bigint unsigned as row start invisible,
+row_end bigint unsigned as row end invisible,
+period for system_time(row_start, row_end)
+) engine=innodb with system versioning
+partition by key(a, row_start) (
+partition p1,
+partition p2
+);
+ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
+create or replace table t (
+a int primary key,
+row_start bigint unsigned as row start invisible,
+row_end bigint unsigned as row end invisible,
+period for system_time(row_start, row_end)
+) engine=innodb with system versioning
+partition by hash(a + row_end * 2) (
+partition p1,
+partition p2
+);
+ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
+create or replace table t (
+a int primary key,
+row_start bigint unsigned as row start invisible,
+row_end bigint unsigned as row end invisible,
+period for system_time(row_start, row_end)
+) engine=innodb with system versioning
+partition by range columns (a, row_start) (
+partition p1 values less than (100, 100)
+);
+ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
+#
# Assertion in ALTER on warning from partitioning LIMIT [#446]
#
create or replace table t1 (x int) with system versioning;
@@ -466,8 +814,6 @@ partition p2 history,
partition pn current);
delete from t1 where x = 1;
delete from t1 where x = 2;
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
#
# MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
#
diff --git a/mysql-test/suite/versioning/r/partition_innodb.result b/mysql-test/suite/versioning/r/partition_innodb.result
deleted file mode 100644
index afed90ffe05..00000000000
--- a/mysql-test/suite/versioning/r/partition_innodb.result
+++ /dev/null
@@ -1,67 +0,0 @@
-# MDEV-15951 system versioning by trx id doesn't work with partitioning
-# currently trx_id does not support partitioning by system_time
-create or replace table t1(
-i int,
-row_start bigint unsigned generated always as row start,
-row_end bigint unsigned generated always as row end,
-period for system_time(row_start, row_end)
-) engine=InnoDB with system versioning partition by system_time (
-partition p0 history,
-partition pn current
-);
-ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
-create or replace table t1(
-i int,
-row_start bigint unsigned generated always as row start,
-row_end bigint unsigned generated always as row end,
-period for system_time(row_start, row_end)
-) engine=InnoDB with system versioning;
-alter table t1 partition by system_time (
-partition p0 history,
-partition pn current
-);
-ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
-drop table t1;
-create or replace table t (
-a int primary key,
-row_start bigint unsigned as row start invisible,
-row_end bigint unsigned as row end invisible,
-period for system_time(row_start, row_end)
-) engine=innodb with system versioning
-partition by key() (
-partition p1,
-partition p2
-);
-ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
-create or replace table t (
-a int primary key,
-row_start bigint unsigned as row start invisible,
-row_end bigint unsigned as row end invisible,
-period for system_time(row_start, row_end)
-) engine=innodb with system versioning
-partition by key(a, row_start) (
-partition p1,
-partition p2
-);
-ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
-create or replace table t (
-a int primary key,
-row_start bigint unsigned as row start invisible,
-row_end bigint unsigned as row end invisible,
-period for system_time(row_start, row_end)
-) engine=innodb with system versioning
-partition by hash(a + row_end * 2) (
-partition p1,
-partition p2
-);
-ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
-create or replace table t (
-a int primary key,
-row_start bigint unsigned as row start invisible,
-row_end bigint unsigned as row end invisible,
-period for system_time(row_start, row_end)
-) engine=innodb with system versioning
-partition by range columns (a, row_start) (
-partition p1 values less than (100, 100)
-);
-ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
diff --git a/mysql-test/suite/versioning/r/partition_rotation.result b/mysql-test/suite/versioning/r/partition_rotation.result
deleted file mode 100644
index 2a9f313b00a..00000000000
--- a/mysql-test/suite/versioning/r/partition_rotation.result
+++ /dev/null
@@ -1,280 +0,0 @@
-set time_zone= "+00:00";
-call mtr.add_suppression("need more HISTORY partitions");
-set timestamp=unix_timestamp('2001-02-03 10:20:30');
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day
-subpartition by key (i) subpartitions 2
-(partition p1 history, partition pn current);
-set timestamp=unix_timestamp('2001-02-03 10:20:40');
-insert t1 values (1);
-delete from t1;
-set timestamp=unix_timestamp('2001-02-04 10:20:50');
-insert t1 values (2);
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
-delete from t1;
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
-select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
-subpartition_name partition_description table_rows
-p1sp0 2001-02-04 00:00:00 1
-p1sp1 2001-02-04 00:00:00 1
-pnsp0 CURRENT 0
-pnsp1 CURRENT 0
-set timestamp=unix_timestamp('2001-02-04 10:20:55');
-alter table t1 add partition (partition p0 history, partition p2 history);
-set timestamp=unix_timestamp('2001-02-04 10:30:00');
-insert t1 values (4),(5);
-set timestamp=unix_timestamp('2001-02-04 10:30:10');
-update t1 set i=6 where i=5;
-select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
-subpartition_name partition_description table_rows
-p1sp0 2001-02-04 00:00:00 1
-p1sp1 2001-02-04 00:00:00 0
-p0sp0 2001-02-05 00:00:00 1
-p0sp1 2001-02-05 00:00:00 1
-p2sp0 2001-02-06 00:00:00 0
-p2sp1 2001-02-06 00:00:00 0
-pnsp0 CURRENT 0
-pnsp1 CURRENT 2
-## pruning check
-set @ts=(select partition_description from information_schema.partitions
-where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
-select * from t1;
-i
-4
-6
-explain partitions select * from t1;
-id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 2 Using where
-explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30';
-id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p2_p2sp0,p2_p2sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL # Using where
-set @ts=(select row_end from t1 for system_time all where i=1);
-select * from t1 for system_time all where row_end = @ts;
-i
-1
-explain partitions select * from t1 for system_time all where row_end = @ts;
-id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p1_p1sp0,p1_p1sp1 # NULL NULL NULL NULL # #
-## INTERVAL ... STARTS
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts 'a';
-ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'STARTS'
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '00:00:00';
-ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'STARTS'
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-00-01 00:00:00';
-ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'STARTS'
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts 946684800;
-ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'STARTS'
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-01 00:00:00';
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00'
-PARTITIONS 2
-# Test STARTS warning
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00'
-PARTITIONS 2
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-01 00:00:01';
-Warnings:
-Warning 4164 `t1`: STARTS is later than query time, first history partition may exceed INTERVAL value
-# Test default STARTS rounding
-set timestamp= unix_timestamp('1999-12-15 13:33:33');
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 second;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 SECOND STARTS TIMESTAMP'1999-12-15 13:33:33'
-PARTITIONS 2
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 minute;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 MINUTE STARTS TIMESTAMP'1999-12-15 13:33:00'
-PARTITIONS 2
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 hour;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'1999-12-15 13:00:00'
-PARTITIONS 2
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-15 00:00:00'
-PARTITIONS 2
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 month;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 MONTH STARTS TIMESTAMP'1999-12-15 00:00:00'
-PARTITIONS 2
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 year;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 YEAR STARTS TIMESTAMP'1999-12-15 00:00:00'
-PARTITIONS 2
-# seconds equivalent of 1 day does not round:
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 86400 second;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 86400 SECOND STARTS TIMESTAMP'1999-12-15 13:33:33'
-PARTITIONS 2
-# STARTS value is in local time_zone:
-set time_zone="+03:00";
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-01 00:00:00';
-Warnings:
-Warning 4164 `t1`: STARTS is later than query time, first history partition may exceed INTERVAL value
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
-create or replace table t2 (i int) with system versioning
-partition by system_time interval 1 day;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00'
-PARTITIONS 2
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00'
-PARTITIONS 2
-set time_zone="+00:00";
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-31 21:00:00'
-PARTITIONS 2
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `i` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
- PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-31 21:00:00'
-PARTITIONS 2
-# Test rotation
-set timestamp= unix_timestamp('2001-01-01 00:00:00');
-# it's ok to add partitions for past:
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-01 00:00:00'
-partitions 3;
-# we are warned when we push to present:
-insert into t1 values (0);
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
-set timestamp= unix_timestamp('2001-01-01 00:00:01');
-update t1 set i= i + 1;
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
-set timestamp= unix_timestamp('2001-01-01 00:00:02');
-update t1 set i= i + 1;
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
-select *, row_end from t1 partition (p0);
-i row_end
-select *, row_end from t1 partition (p1);
-i row_end
-0 2001-01-01 00:00:01.000000
-1 2001-01-01 00:00:02.000000
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
-# now we "overflow" first partition a bit:
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-03 00:00:00'
-partitions 3;
-Warnings:
-Warning 4164 `t1`: STARTS is later than query time, first history partition may exceed INTERVAL value
-insert into t1 values (0);
-set timestamp= unix_timestamp('2000-01-01 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-02 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-03 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-04 00:00:01');
-update t1 set i= i + 1;
-select *, row_end from t1 partition (p0);
-i row_end
-0 2000-01-01 00:00:01.000000
-1 2000-01-02 00:00:01.000000
-2 2000-01-03 00:00:01.000000
-select *, row_end from t1 partition (p1);
-i row_end
-3 2000-01-04 00:00:01.000000
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
-# and this is how it usually goes:
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day
-partitions 3;
-insert into t1 values (0);
-set timestamp= unix_timestamp('2000-01-01 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-02 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-03 00:00:01');
-update t1 set i= i + 1;
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
-set timestamp= unix_timestamp('2000-01-04 00:00:01');
-update t1 set i= i + 1;
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
-alter table t1 add partition (partition p2 history, partition p3 history);
-select *, row_end from t1 partition (p0);
-i row_end
-0 2000-01-01 00:00:01.000000
-select *, row_end from t1 partition (p1);
-i row_end
-1 2000-01-02 00:00:01.000000
-select *, row_end from t1 partition (p2);
-i row_end
-2 2000-01-03 00:00:01.000000
-select *, row_end from t1 partition (p3);
-i row_end
-3 2000-01-04 00:00:01.000000
-drop tables t1, t2;
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index 3d8598537d0..49a209f920e 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -273,6 +273,193 @@ select partition_name,partition_ordinal_position,partition_method,timediff(parti
alter table t1 drop partition p2;
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
+#
+# partition rotation (moved from partition_rotation.test)
+#
+set timestamp=unix_timestamp('2001-02-03 10:20:30');
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day
+ subpartition by key (i) subpartitions 2
+ (partition p1 history, partition pn current);
+set timestamp=unix_timestamp('2001-02-03 10:20:40');
+insert t1 values (1); delete from t1;
+set timestamp=unix_timestamp('2001-02-04 10:20:50');
+insert t1 values (2); delete from t1;
+
+select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+
+set timestamp=unix_timestamp('2001-02-04 10:20:55');
+alter table t1 add partition (partition p0 history, partition p2 history);
+set timestamp=unix_timestamp('2001-02-04 10:30:00');
+insert t1 values (4),(5);
+set timestamp=unix_timestamp('2001-02-04 10:30:10');
+update t1 set i=6 where i=5;
+
+select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+
+--echo ## pruning check
+set @ts=(select partition_description from information_schema.partitions
+ where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
+--sorted_result
+select * from t1;
+--replace_column 10 #
+explain partitions select * from t1;
+--replace_column 10 #
+explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30';
+set @ts=(select row_end from t1 for system_time all where i=1);
+select * from t1 for system_time all where row_end = @ts;
+--replace_column 5 # 10 # 11 #
+explain partitions select * from t1 for system_time all where row_end = @ts;
+
+--echo ## INTERVAL ... STARTS
+--error ER_PART_WRONG_VALUE
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts 'a';
+
+--error ER_PART_WRONG_VALUE
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '00:00:00';
+
+--error ER_PART_WRONG_VALUE
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-00-01 00:00:00';
+
+--error ER_PART_WRONG_VALUE
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts 946684800;
+
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-01 00:00:00';
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+--echo # Test STARTS warning
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-01 00:00:01';
+
+--echo # Test default STARTS rounding
+set timestamp= unix_timestamp('1999-12-15 13:33:33');
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 second;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 minute;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 hour;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 month;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 year;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+--echo # seconds equivalent of 1 day does not round:
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 86400 second;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+--echo # STARTS value is in local time_zone:
+set time_zone="+03:00";
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-01 00:00:00';
+
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t2 (i int) with system versioning
+partition by system_time interval 1 day;
+
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t2;
+set time_zone="+00:00";
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t2;
+
+--echo # Test rotation
+set timestamp= unix_timestamp('2001-01-01 00:00:00');
+--echo # it's ok to add partitions for past:
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-01 00:00:00'
+partitions 3;
+
+--echo # we are warned when we push to present:
+insert into t1 values (0);
+set timestamp= unix_timestamp('2001-01-01 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2001-01-01 00:00:02');
+update t1 set i= i + 1;
+
+select *, row_end from t1 partition (p0);
+select *, row_end from t1 partition (p1);
+
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+--echo # now we "overflow" first partition a bit:
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2000-01-03 00:00:00'
+partitions 3;
+
+insert into t1 values (0);
+set timestamp= unix_timestamp('2000-01-01 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-02 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-03 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-04 00:00:01');
+update t1 set i= i + 1;
+
+select *, row_end from t1 partition (p0);
+select *, row_end from t1 partition (p1);
+
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+--echo # and this is how it usually goes:
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day
+partitions 3;
+
+insert into t1 values (0);
+set timestamp= unix_timestamp('2000-01-01 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-02 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-03 00:00:01');
+update t1 set i= i + 1;
+set timestamp= unix_timestamp('2000-01-04 00:00:01');
+update t1 set i= i + 1;
+
+alter table t1 add partition (partition p2 history, partition p3 history);
+
+select *, row_end from t1 partition (p0);
+select *, row_end from t1 partition (p1);
+select *, row_end from t1 partition (p2);
+select *, row_end from t1 partition (p3);
+
+drop tables t1, t2;
--echo ## Subpartitions
create or replace table t1 (x int)
@@ -316,6 +503,84 @@ insert into t1 values (1);
select * from t1 partition (part1);
--echo #
+--echo # TRX_ID versioning (moved from partition_innodb.test)
+--echo #
+--echo # MDEV-15951 system versioning by trx id doesn't work with partitioning
+--echo # currently trx_id does not support partitioning by system_time
+--error ER_VERS_FIELD_WRONG_TYPE
+create or replace table t1(
+ i int,
+ row_start bigint unsigned generated always as row start,
+ row_end bigint unsigned generated always as row end,
+ period for system_time(row_start, row_end)
+) engine=InnoDB with system versioning partition by system_time (
+ partition p0 history,
+ partition pn current
+);
+
+create or replace table t1(
+ i int,
+ row_start bigint unsigned generated always as row start,
+ row_end bigint unsigned generated always as row end,
+ period for system_time(row_start, row_end)
+) engine=InnoDB with system versioning;
+
+--error ER_VERS_FIELD_WRONG_TYPE
+alter table t1 partition by system_time (
+ partition p0 history,
+ partition pn current
+);
+
+drop table t1;
+
+--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
+create or replace table t (
+ a int primary key,
+ row_start bigint unsigned as row start invisible,
+ row_end bigint unsigned as row end invisible,
+ period for system_time(row_start, row_end)
+) engine=innodb with system versioning
+partition by key() (
+ partition p1,
+ partition p2
+);
+
+--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
+create or replace table t (
+ a int primary key,
+ row_start bigint unsigned as row start invisible,
+ row_end bigint unsigned as row end invisible,
+ period for system_time(row_start, row_end)
+) engine=innodb with system versioning
+partition by key(a, row_start) (
+ partition p1,
+ partition p2
+);
+
+--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
+create or replace table t (
+ a int primary key,
+ row_start bigint unsigned as row start invisible,
+ row_end bigint unsigned as row end invisible,
+ period for system_time(row_start, row_end)
+) engine=innodb with system versioning
+partition by hash(a + row_end * 2) (
+ partition p1,
+ partition p2
+);
+
+--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
+create or replace table t (
+ a int primary key,
+ row_start bigint unsigned as row start invisible,
+ row_end bigint unsigned as row end invisible,
+ period for system_time(row_start, row_end)
+) engine=innodb with system versioning
+partition by range columns (a, row_start) (
+ partition p1 values less than (100, 100)
+);
+
+--echo #
--echo # Assertion in ALTER on warning from partitioning LIMIT [#446]
--echo #
create or replace table t1 (x int) with system versioning;
diff --git a/mysql-test/suite/versioning/t/partition_innodb.test b/mysql-test/suite/versioning/t/partition_innodb.test
deleted file mode 100644
index 088a4b81252..00000000000
--- a/mysql-test/suite/versioning/t/partition_innodb.test
+++ /dev/null
@@ -1,80 +0,0 @@
---source include/have_innodb.inc
---source include/have_partition.inc
---source suite/versioning/common.inc
-
---echo # MDEV-15951 system versioning by trx id doesn't work with partitioning
---echo # currently trx_id does not support partitioning by system_time
---error ER_VERS_FIELD_WRONG_TYPE
-create or replace table t1(
- i int,
- row_start bigint unsigned generated always as row start,
- row_end bigint unsigned generated always as row end,
- period for system_time(row_start, row_end)
-) engine=InnoDB with system versioning partition by system_time (
- partition p0 history,
- partition pn current
-);
-
-create or replace table t1(
- i int,
- row_start bigint unsigned generated always as row start,
- row_end bigint unsigned generated always as row end,
- period for system_time(row_start, row_end)
-) engine=InnoDB with system versioning;
-
---error ER_VERS_FIELD_WRONG_TYPE
-alter table t1 partition by system_time (
- partition p0 history,
- partition pn current
-);
-
-drop table t1;
-
---error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
-create or replace table t (
- a int primary key,
- row_start bigint unsigned as row start invisible,
- row_end bigint unsigned as row end invisible,
- period for system_time(row_start, row_end)
-) engine=innodb with system versioning
-partition by key() (
- partition p1,
- partition p2
-);
-
---error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
-create or replace table t (
- a int primary key,
- row_start bigint unsigned as row start invisible,
- row_end bigint unsigned as row end invisible,
- period for system_time(row_start, row_end)
-) engine=innodb with system versioning
-partition by key(a, row_start) (
- partition p1,
- partition p2
-);
-
---error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
-create or replace table t (
- a int primary key,
- row_start bigint unsigned as row start invisible,
- row_end bigint unsigned as row end invisible,
- period for system_time(row_start, row_end)
-) engine=innodb with system versioning
-partition by hash(a + row_end * 2) (
- partition p1,
- partition p2
-);
-
---error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
-create or replace table t (
- a int primary key,
- row_start bigint unsigned as row start invisible,
- row_end bigint unsigned as row end invisible,
- period for system_time(row_start, row_end)
-) engine=innodb with system versioning
-partition by range columns (a, row_start) (
- partition p1 values less than (100, 100)
-);
-
---source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/versioning/t/partition_rotation.test b/mysql-test/suite/versioning/t/partition_rotation.test
deleted file mode 100644
index 60b2e6c61fe..00000000000
--- a/mysql-test/suite/versioning/t/partition_rotation.test
+++ /dev/null
@@ -1,178 +0,0 @@
---source include/have_partition.inc
-
-set time_zone= "+00:00";
-call mtr.add_suppression("need more HISTORY partitions");
-
-#
-# partition rotation
-#
-set timestamp=unix_timestamp('2001-02-03 10:20:30');
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day
- subpartition by key (i) subpartitions 2
- (partition p1 history, partition pn current);
-set timestamp=unix_timestamp('2001-02-03 10:20:40');
-insert t1 values (1); delete from t1;
-set timestamp=unix_timestamp('2001-02-04 10:20:50');
-insert t1 values (2); delete from t1;
-
-select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
-
-set timestamp=unix_timestamp('2001-02-04 10:20:55');
-alter table t1 add partition (partition p0 history, partition p2 history);
-set timestamp=unix_timestamp('2001-02-04 10:30:00');
-insert t1 values (4),(5);
-set timestamp=unix_timestamp('2001-02-04 10:30:10');
-update t1 set i=6 where i=5;
-
-select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
-
---echo ## pruning check
-set @ts=(select partition_description from information_schema.partitions
- where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
---sorted_result
-select * from t1;
-explain partitions select * from t1;
---replace_column 10 #
-explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30';
-set @ts=(select row_end from t1 for system_time all where i=1);
-select * from t1 for system_time all where row_end = @ts;
---replace_column 5 # 10 # 11 #
-explain partitions select * from t1 for system_time all where row_end = @ts;
-
---echo ## INTERVAL ... STARTS
---error ER_PART_WRONG_VALUE
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts 'a';
-
---error ER_PART_WRONG_VALUE
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '00:00:00';
-
---error ER_PART_WRONG_VALUE
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-00-01 00:00:00';
-
---error ER_PART_WRONG_VALUE
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts 946684800;
-
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-01 00:00:00';
-show create table t1;
-
---echo # Test STARTS warning
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day;
-show create table t1;
-
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-01 00:00:01';
-
---echo # Test default STARTS rounding
-set timestamp= unix_timestamp('1999-12-15 13:33:33');
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 second;
-show create table t1;
-
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 minute;
-show create table t1;
-
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 hour;
-show create table t1;
-
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day;
-show create table t1;
-
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 month;
-show create table t1;
-
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 year;
-show create table t1;
-
---echo # seconds equivalent of 1 day does not round:
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 86400 second;
-show create table t1;
-
---echo # STARTS value is in local time_zone:
-set time_zone="+03:00";
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-01 00:00:00';
-
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
-create or replace table t2 (i int) with system versioning
-partition by system_time interval 1 day;
-
-show create table t1;
-show create table t2;
-set time_zone="+00:00";
-show create table t1;
-show create table t2;
-
---echo # Test rotation
-set timestamp= unix_timestamp('2001-01-01 00:00:00');
---echo # it's ok to add partitions for past:
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-01 00:00:00'
-partitions 3;
-
---echo # we are warned when we push to present:
-insert into t1 values (0);
-set timestamp= unix_timestamp('2001-01-01 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2001-01-01 00:00:02');
-update t1 set i= i + 1;
-
-select *, row_end from t1 partition (p0);
-select *, row_end from t1 partition (p1);
-
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
---echo # now we "overflow" first partition a bit:
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day starts '2000-01-03 00:00:00'
-partitions 3;
-
-insert into t1 values (0);
-set timestamp= unix_timestamp('2000-01-01 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-02 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-03 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-04 00:00:01');
-update t1 set i= i + 1;
-
-select *, row_end from t1 partition (p0);
-select *, row_end from t1 partition (p1);
-
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
---echo # and this is how it usually goes:
-create or replace table t1 (i int) with system versioning
-partition by system_time interval 1 day
-partitions 3;
-
-insert into t1 values (0);
-set timestamp= unix_timestamp('2000-01-01 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-02 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-03 00:00:01');
-update t1 set i= i + 1;
-set timestamp= unix_timestamp('2000-01-04 00:00:01');
-update t1 set i= i + 1;
-
-alter table t1 add partition (partition p2 history, partition p3 history);
-
-select *, row_end from t1 partition (p0);
-select *, row_end from t1 partition (p1);
-select *, row_end from t1 partition (p2);
-select *, row_end from t1 partition (p3);
-
-drop tables t1, t2;