Skip to content

Commit 41983fd

Browse files
committed
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.
1 parent 09eb313 commit 41983fd

File tree

4 files changed

+114
-145
lines changed

4 files changed

+114
-145
lines changed

mysql-test/suite/versioning/r/partition.result

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -286,50 +286,6 @@ partition by system_time interval 6 day limit 98
286286
(partition p0 history, partition ver_pn current);
287287
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
288288
(partition p0 history, partition ver_pn current)' at line 2
289-
### ha_partition::update_row() check
290-
create or replace table t1 (x int)
291-
with system versioning
292-
partition by system_time interval 1 second (
293-
partition p0 history,
294-
partition p1 history,
295-
partition pn current);
296-
insert into t1 values (1), (2), (3), (4);
297-
select * from t1 partition (pn);
298-
x
299-
1
300-
2
301-
3
302-
4
303-
delete from t1 where x < 3;
304-
delete from t1;
305-
Warnings:
306-
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
307-
select * from t1 partition (p0) order by x;
308-
x
309-
1
310-
2
311-
select * from t1 partition (p1) order by x;
312-
x
313-
3
314-
4
315-
### ha_partition::write_row() check
316-
create or replace table t1 (x int)
317-
with system versioning
318-
partition by system_time interval 1 second (
319-
partition p0 history,
320-
partition p1 history,
321-
partition pn current);
322-
insert into t1 values (1);
323-
update t1 set x= 2;
324-
update t1 set x= 3;
325-
Warnings:
326-
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
327-
select * from t1 partition (p0);
328-
x
329-
1
330-
select * from t1 partition (p1);
331-
x
332-
2
333289
## Subpartitions
334290
create or replace table t1 (x int)
335291
with system versioning
@@ -490,50 +446,6 @@ p2 2 SYSTEM_TIME 02:00:00.000000
490446
pn 3 SYSTEM_TIME NULL
491447
Warnings:
492448
Warning 1292 Truncated incorrect time value: 'CURRENT'
493-
create or replace table t1 (i int) with system versioning
494-
partition by system_time interval 1 second
495-
subpartition by key (i) subpartitions 2
496-
(partition p1 history, partition pn current);
497-
insert t1 values (1);
498-
delete from t1;
499-
insert t1 values (2);
500-
Warnings:
501-
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
502-
delete from t1;
503-
Warnings:
504-
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
505-
alter table t1 add partition (partition p0 history, partition p2 history);
506-
select subpartition_name,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
507-
subpartition_name table_rows
508-
p1sp0 1
509-
p1sp1 0
510-
p0sp0 0
511-
p0sp1 1
512-
p2sp0 0
513-
p2sp1 0
514-
pnsp0 0
515-
pnsp1 0
516-
## pruning check
517-
set @ts=(select partition_description from information_schema.partitions
518-
where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
519-
insert into t1 values (4),(5);
520-
select * from t1;
521-
i
522-
4
523-
5
524-
explain partitions select * from t1;
525-
id select_type table partitions type possible_keys key key_len ref rows Extra
526-
1 SIMPLE t1 pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 2 Using where
527-
explain partitions select * from t1 for system_time as of from_unixtime(@ts);
528-
id select_type table partitions type possible_keys key key_len ref rows Extra
529-
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
530-
set @ts=(select row_end from t1 for system_time all where i=1);
531-
select * from t1 for system_time all where row_end = @ts;
532-
i
533-
1
534-
explain partitions select * from t1 for system_time all where row_end = @ts;
535-
id select_type table partitions type possible_keys key key_len ref rows Extra
536-
1 SIMPLE t1 p1_p1sp0,p1_p1sp1 # NULL NULL NULL NULL # #
537449
#
538450
# MDEV-15103 Assertion in ha_partition::part_records() for updating VIEW
539451
#
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
include/master-slave.inc
2+
[connection master]
3+
set timestamp=unix_timestamp('2001-02-03 10:20:30');
4+
create or replace table t1 (i int) with system versioning
5+
partition by system_time interval 1 day
6+
subpartition by key (i) subpartitions 2
7+
(partition p1 history, partition pn current);
8+
set timestamp=unix_timestamp('2001-02-03 10:20:40');
9+
insert t1 values (1);
10+
delete from t1;
11+
set timestamp=unix_timestamp('2001-02-04 10:20:50');
12+
insert t1 values (2);
13+
delete from t1;
14+
connection slave;
15+
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
16+
subpartition_name partition_description table_rows
17+
p1sp0 2001-02-04 10:20:30 1
18+
p1sp1 2001-02-04 10:20:30 1
19+
pnsp0 CURRENT 0
20+
pnsp1 CURRENT 0
21+
connection master;
22+
set timestamp=unix_timestamp('2001-02-04 10:20:55');
23+
alter table t1 add partition (partition p0 history, partition p2 history);
24+
set timestamp=unix_timestamp('2001-02-04 10:30:00');
25+
insert t1 values (4),(5);
26+
set timestamp=unix_timestamp('2001-02-04 10:30:10');
27+
update t1 set i=6 where i=5;
28+
connection slave;
29+
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
30+
subpartition_name partition_description table_rows
31+
p1sp0 2001-02-04 10:20:30 1
32+
p1sp1 2001-02-04 10:20:30 0
33+
p0sp0 2001-02-05 10:20:30 1
34+
p0sp1 2001-02-05 10:20:30 1
35+
p2sp0 2001-02-06 10:20:30 0
36+
p2sp1 2001-02-06 10:20:30 0
37+
pnsp0 CURRENT 0
38+
pnsp1 CURRENT 2
39+
## pruning check
40+
set @ts=(select partition_description from information_schema.partitions
41+
where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
42+
select * from t1;
43+
i
44+
4
45+
6
46+
explain partitions select * from t1;
47+
id select_type table partitions type possible_keys key key_len ref rows Extra
48+
1 SIMPLE t1 pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 2 Using where
49+
explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30';
50+
id select_type table partitions type possible_keys key key_len ref rows Extra
51+
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
52+
set @ts=(select row_end from t1 for system_time all where i=1);
53+
select * from t1 for system_time all where row_end = @ts;
54+
i
55+
1
56+
explain partitions select * from t1 for system_time all where row_end = @ts;
57+
id select_type table partitions type possible_keys key key_len ref rows Extra
58+
1 SIMPLE t1 p1_p1sp0,p1_p1sp1 # NULL NULL NULL NULL # #
59+
connection master;
60+
drop table t1;
61+
include/rpl_end.inc

mysql-test/suite/versioning/t/partition.test

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -250,39 +250,6 @@ create table t1 (i int) with system versioning
250250
partition by system_time interval 6 day limit 98
251251
(partition p0 history, partition ver_pn current);
252252

253-
--echo ### ha_partition::update_row() check
254-
create or replace table t1 (x int)
255-
with system versioning
256-
partition by system_time interval 1 second (
257-
partition p0 history,
258-
partition p1 history,
259-
partition pn current);
260-
261-
insert into t1 values (1), (2), (3), (4);
262-
select * from t1 partition (pn);
263-
delete from t1 where x < 3;
264-
265-
--sleep 2
266-
delete from t1;
267-
268-
select * from t1 partition (p0) order by x;
269-
select * from t1 partition (p1) order by x;
270-
271-
--echo ### ha_partition::write_row() check
272-
create or replace table t1 (x int)
273-
with system versioning
274-
partition by system_time interval 1 second (
275-
partition p0 history,
276-
partition p1 history,
277-
partition pn current);
278-
279-
insert into t1 values (1);
280-
update t1 set x= 2;
281-
sleep 2;
282-
update t1 set x= 3;
283-
select * from t1 partition (p0);
284-
select * from t1 partition (p1);
285-
286253
--echo ## Subpartitions
287254
create or replace table t1 (x int)
288255
with system versioning
@@ -421,30 +388,6 @@ select partition_name,partition_ordinal_position,partition_method,timediff(parti
421388
alter table t1 drop partition p2;
422389
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
423390

424-
create or replace table t1 (i int) with system versioning
425-
partition by system_time interval 1 second
426-
subpartition by key (i) subpartitions 2
427-
(partition p1 history, partition pn current);
428-
insert t1 values (1); delete from t1;
429-
sleep 1;
430-
insert t1 values (2); delete from t1;
431-
alter table t1 add partition (partition p0 history, partition p2 history);
432-
select subpartition_name,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
433-
434-
--echo ## pruning check
435-
set @ts=(select partition_description from information_schema.partitions
436-
where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
437-
insert into t1 values (4),(5);
438-
--sorted_result
439-
select * from t1;
440-
explain partitions select * from t1;
441-
--replace_column 10 #
442-
explain partitions select * from t1 for system_time as of from_unixtime(@ts);
443-
set @ts=(select row_end from t1 for system_time all where i=1);
444-
select * from t1 for system_time all where row_end = @ts;
445-
--replace_column 5 # 10 # 11 #
446-
explain partitions select * from t1 for system_time all where row_end = @ts;
447-
448391
--echo #
449392
--echo # MDEV-15103 Assertion in ha_partition::part_records() for updating VIEW
450393
--echo #
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--source include/have_partition.inc
2+
--source include/have_binlog_format_statement.inc
3+
--source include/master-slave.inc
4+
5+
#
6+
# The test below isn't a replication test as such,
7+
# but it uses replication to get custom timestamps and repeatable
8+
# behavior into versioning.
9+
#
10+
11+
#
12+
# partition rotation
13+
#
14+
disable_warnings;
15+
set timestamp=unix_timestamp('2001-02-03 10:20:30');
16+
create or replace table t1 (i int) with system versioning
17+
partition by system_time interval 1 day
18+
subpartition by key (i) subpartitions 2
19+
(partition p1 history, partition pn current);
20+
set timestamp=unix_timestamp('2001-02-03 10:20:40');
21+
insert t1 values (1); delete from t1;
22+
set timestamp=unix_timestamp('2001-02-04 10:20:50');
23+
insert t1 values (2); delete from t1;
24+
enable_warnings;
25+
sync_slave_with_master;
26+
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
27+
connection master;
28+
set timestamp=unix_timestamp('2001-02-04 10:20:55');
29+
alter table t1 add partition (partition p0 history, partition p2 history);
30+
set timestamp=unix_timestamp('2001-02-04 10:30:00');
31+
insert t1 values (4),(5);
32+
set timestamp=unix_timestamp('2001-02-04 10:30:10');
33+
update t1 set i=6 where i=5;
34+
sync_slave_with_master;
35+
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
36+
37+
--echo ## pruning check
38+
set @ts=(select partition_description from information_schema.partitions
39+
where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
40+
--sorted_result
41+
select * from t1;
42+
explain partitions select * from t1;
43+
--replace_column 10 #
44+
explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30';
45+
set @ts=(select row_end from t1 for system_time all where i=1);
46+
select * from t1 for system_time all where row_end = @ts;
47+
--replace_column 5 # 10 # 11 #
48+
explain partitions select * from t1 for system_time all where row_end = @ts;
49+
50+
connection master;
51+
drop table t1;
52+
53+
--source include/rpl_end.inc

0 commit comments

Comments
 (0)