MDEV-15788 versioning.partition, versioning.rpl fail on most windows builds in buildbot

fix versioning.partition failures:
* Make the test stable by setting timestamp to fixed values.
This commit is contained in:
Sergei Golubchik 2018-04-10 21:15:46 +02:00
parent 09eb313375
commit 41983fd3b1
4 changed files with 114 additions and 145 deletions

View file

@ -286,50 +286,6 @@ partition by system_time interval 6 day limit 98
(partition p0 history, partition ver_pn current);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'limit 98
(partition p0 history, partition ver_pn current)' at line 2
### ha_partition::update_row() check
create or replace table t1 (x int)
with system versioning
partition by system_time interval 1 second (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 values (1), (2), (3), (4);
select * from t1 partition (pn);
x
1
2
3
4
delete from t1 where x < 3;
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
select * from t1 partition (p0) order by x;
x
1
2
select * from t1 partition (p1) order by x;
x
3
4
### ha_partition::write_row() check
create or replace table t1 (x int)
with system versioning
partition by system_time interval 1 second (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 values (1);
update t1 set x= 2;
update t1 set x= 3;
Warnings:
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
select * from t1 partition (p0);
x
1
select * from t1 partition (p1);
x
2
## Subpartitions
create or replace table t1 (x int)
with system versioning
@ -490,50 +446,6 @@ p2 2 SYSTEM_TIME 02:00:00.000000
pn 3 SYSTEM_TIME NULL
Warnings:
Warning 1292 Truncated incorrect time value: 'CURRENT'
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 second
subpartition by key (i) subpartitions 2
(partition p1 history, partition pn current);
insert t1 values (1);
delete from t1;
insert t1 values (2);
Warnings:
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
alter table t1 add partition (partition p0 history, partition p2 history);
select subpartition_name,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
subpartition_name table_rows
p1sp0 1
p1sp1 0
p0sp0 0
p0sp1 1
p2sp0 0
p2sp1 0
pnsp0 0
pnsp1 0
## 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);
insert into t1 values (4),(5);
select * from t1;
i
4
5
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 from_unixtime(@ts);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1_p1sp0,p1_p1sp1,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 # #
#
# MDEV-15103 Assertion in ha_partition::part_records() for updating VIEW
#

View file

@ -0,0 +1,61 @@
include/master-slave.inc
[connection master]
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;
connection slave;
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 10:20:30 1
p1sp1 2001-02-04 10:20:30 1
pnsp0 CURRENT 0
pnsp1 CURRENT 0
connection master;
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;
connection slave;
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 10:20:30 1
p1sp1 2001-02-04 10:20:30 0
p0sp0 2001-02-05 10:20:30 1
p0sp1 2001-02-05 10:20:30 1
p2sp0 2001-02-06 10:20:30 0
p2sp1 2001-02-06 10:20:30 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 p1_p1sp0,p1_p1sp1,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 # #
connection master;
drop table t1;
include/rpl_end.inc

View file

@ -250,39 +250,6 @@ create table t1 (i int) with system versioning
partition by system_time interval 6 day limit 98
(partition p0 history, partition ver_pn current);
--echo ### ha_partition::update_row() check
create or replace table t1 (x int)
with system versioning
partition by system_time interval 1 second (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 values (1), (2), (3), (4);
select * from t1 partition (pn);
delete from t1 where x < 3;
--sleep 2
delete from t1;
select * from t1 partition (p0) order by x;
select * from t1 partition (p1) order by x;
--echo ### ha_partition::write_row() check
create or replace table t1 (x int)
with system versioning
partition by system_time interval 1 second (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 values (1);
update t1 set x= 2;
sleep 2;
update t1 set x= 3;
select * from t1 partition (p0);
select * from t1 partition (p1);
--echo ## Subpartitions
create or replace table t1 (x int)
with system versioning
@ -421,30 +388,6 @@ 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';
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 second
subpartition by key (i) subpartitions 2
(partition p1 history, partition pn current);
insert t1 values (1); delete from t1;
sleep 1;
insert t1 values (2); delete from t1;
alter table t1 add partition (partition p0 history, partition p2 history);
select subpartition_name,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);
insert into t1 values (4),(5);
--sorted_result
select * from t1;
explain partitions select * from t1;
--replace_column 10 #
explain partitions select * from t1 for system_time as of from_unixtime(@ts);
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 #
--echo # MDEV-15103 Assertion in ha_partition::part_records() for updating VIEW
--echo #

View file

@ -0,0 +1,53 @@
--source include/have_partition.inc
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
#
# The test below isn't a replication test as such,
# but it uses replication to get custom timestamps and repeatable
# behavior into versioning.
#
#
# partition rotation
#
disable_warnings;
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;
enable_warnings;
sync_slave_with_master;
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
connection master;
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;
sync_slave_with_master;
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;
connection master;
drop table t1;
--source include/rpl_end.inc