summaryrefslogtreecommitdiff
path: root/mysql-test/suite/versioning/r/partition.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/versioning/r/partition.result')
-rw-r--r--mysql-test/suite/versioning/r/partition.result350
1 files changed, 344 insertions, 6 deletions
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index d25227a4ce7..1fc3e785272 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -1,5 +1,5 @@
-SET @save_persistent=@@GLOBAL.innodb_stats_persistent;
-SET GLOBAL innodb_stats_persistent=0;
+set @save_persistent=@@global.innodb_stats_persistent;
+set global innodb_stats_persistent= 0;
call mtr.add_suppression("need more HISTORY partitions");
set system_versioning_alter_history=keep;
# Check conventional partitioning on temporal tables
@@ -265,6 +265,9 @@ x
6
delete from t1 where x < 4;
delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
select * from t1 partition (p0);
x
1
@@ -276,12 +279,11 @@ x
5
6
insert into t1 values (7), (8);
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
### warn about full partition
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
select * from t1 partition (p1) order by x;
x
4
@@ -637,9 +639,13 @@ x
### warn about full partition
delete from t1 where x < 3;
delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^ (no matter if nothing was deleted)
select * from t1 partition (p0sp0);
x
1
@@ -815,7 +821,11 @@ partition p1 history,
partition p2 history,
partition pn current);
delete from t1 where x = 1;
+# You see warning above ^
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
+# You see warning above ^
#
# MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
#
@@ -938,9 +948,13 @@ create or replace table t1 (x int) with system versioning partition by system_ti
lock tables t1 write;
insert into t1 values (0), (1), (2), (3);
delete from t1 where x < 3;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
unlock tables;
#
# MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table
@@ -1064,6 +1078,7 @@ create or replace table t1 (f char(6)) engine innodb with system versioning;
insert into t1 values (null);
update t1 set f= 'foo';
update t1 set f= 'bar';
+# You see warning above ^
create or replace view v1 as select * from t1 for system_time all;
update v1 set f = '';
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -1073,6 +1088,8 @@ partition by system_time limit 1
insert into t1 values (null);
update t1 set f= 'foo';
update t1 set f= 'bar';
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
create or replace view v1 as select * from t1 for system_time all;
update v1 set f= '';
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -1194,8 +1211,323 @@ delete from t1 partition (p0, p1, pn);
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
drop table t1;
set timestamp= default;
+#
+# MDEV-25546 LIMIT partitioning does not respect ROLLBACK
+#
+create or replace table t1 (pk int primary key)
+with system versioning engine innodb
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_1_to_90;
+start transaction;
+replace into t1 select seq from seq_1_to_80;
+replace into t1 select seq from seq_1_to_70;
+replace into t1 select seq from seq_1_to_60;
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+partition_name table_rows
+p0 150
+p1 60
+pn 90
+rollback;
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+partition_name table_rows
+p0 0
+p1 0
+pn 90
+replace into t1 select seq from seq_1_to_10;
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+partition_name table_rows
+p0 10
+p1 0
+pn 90
+drop table t1;
+#
+# MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME
+#
+create table t1 (x int) with system versioning
+partition by system_time limit 1 (
+partition p0 history,
+partition p1 history,
+partition p2 history, # p2 just disables warning about p1 partition full
+partition pn current);
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+select * from t1 partition (p0);
+x
+0
+select * from t1 partition (p1);
+x
+1
+select * from t1 partition (pn);
+x
+2
+delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
+delete history from t1;
+select * from t1 partition (p0);
+x
+select * from t1 partition (p1);
+x
+select * from t1 partition (pn);
+x
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+# TRUNCATE PARTITION ALL does the same
+alter table t1 truncate partition all;
+select * from t1 partition (p0);
+x
+select * from t1 partition (p1);
+x
+select * from t1 partition (pn);
+x
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+# TRUNCATE PARTITION deletes data from HISTORY partition
+alter table t1 truncate partition p1;
+select * from t1 partition (p0);
+x
+0
+select * from t1 partition (p1);
+x
+select * from t1 partition (pn);
+x
+2
+# or from CURRENT partition
+alter table t1 truncate partition pn;
+select * from t1 partition (p0);
+x
+0
+select * from t1 partition (p1);
+x
+select * from t1 partition (pn);
+x
+drop table t1;
+#
+# MDEV-20077 Warning on full history partition is delayed until next DML statement
+#
+# DELETE
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_200;
+# p0 is filled with 100 records (no warnings):
+delete from t1 where x <= 99;
+# p1 is filled with 1 + 100 records (warning is printed):
+delete from t1 where x <= 100;
+delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+101
+drop table t1;
+# DELETE under LOCK TABLES
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_200;
+lock tables t1 write;
+# (LOCK TABLES) p0 is filled with 100 records (no warnings):
+delete from t1 where x <= 99;
+# (LOCK TABLES) p1 is filled with 1 + 100 records (warning is printed):
+delete from t1 where x <= 100;
+delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
+unlock tables;
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+101
+drop table t1;
+# DELETE multitable
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+create table t2 (y int);
+insert into t1 select seq from seq_0_to_200;
+insert into t2 select seq from seq_0_to_3;
+delete t1, t2 from t1 join t2 where x < 50 and y = 0;
+delete t1, t2 from t1 join t2 where x < 100 and y = 1;
+delete t1, t2 from t1 join t2 where x < 150 and y = 2;
+delete t1, t2 from t1 join t2;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+101
+drop table t1;
+# UDPATE
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_49;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+100
+drop tables t1, t2;
+# UPDATE multitable
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+create table t2 (y int);
+insert into t1 select seq from seq_0_to_49;
+insert into t2 values (5);
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+100
+drop tables t1, t2;
+# INSERT .. ON DUPLICATE KEY UPDATE (ODKU)
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_100;
+delete from t1 where x <= 99;
+insert into t1 values (100) on duplicate key update x= 400;
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+1
+drop table t1;
+# INSERT .. SELECT .. ON DUPLICATE KEY UPDATE (ODKU)
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+create table t2 (y int);
+insert into t2 values (100);
+insert into t1 select seq from seq_0_to_100;
+delete from t1 where x <= 99;
+insert into t1 select * from t2 on duplicate key update x= 500;
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+1
+drop tables t1, t2;
+# REPLACE
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_100;
+delete from t1 where x < 99;
+replace t1 values (100);
+replace t1 values (100);
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+1
+drop table t1;
+# LOAD DATA .. REPLACE
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_49;
+select x into outfile 'MDEV-20077.data' from t1;
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+100
+drop table t1;
+# REPLACE .. SELECT
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_49;
+replace t1 select * from t1;
+replace t1 select * from t1;
+replace t1 select * from t1;
+replace t1 select * from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+100
+drop table t1;
+#
# End of 10.3 tests
#
+#
# MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine
#
create table t1 (a int primary key) engine=aria page_checksum=0
@@ -1227,8 +1559,10 @@ select * from t1 where i > 0 or pk = 1000 limit 1;
pk i c
1 1 a
drop table t1;
+#
# End of 10.4 tests
#
+#
# MDEV-22153 ALTER add default history partitions makes table inaccessible
#
create or replace table t1 (x int) with system versioning partition by system_time;
@@ -1336,8 +1670,6 @@ drop tables t1;
#
# End of 10.5 tests
#
-SET GLOBAL innodb_stats_persistent=@save_persistent;
-# End of 10.6 tests
#
# MDEV-22166 MIGRATE PARTITION: move out partition into a table
#
@@ -1481,6 +1813,8 @@ insert into t1 values (2), (12), (22);
update t1 set x= x + 1 where x = 2;
update t1 set x= x + 1 where x = 12;
update t1 set x= x + 1 where x = 22;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
select * from t1 partition (p1);
x
12
@@ -1702,3 +2036,7 @@ t1 CREATE TABLE `t1` (
(PARTITION `p0` VALUES LESS THAN (10) ENGINE = X,
PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
drop tables t1, tp1;
+#
+# End of 10.7 tests
+#
+set global innodb_stats_persistent= @save_persistent;