[MDEV-25390] Pruning boundary for history partitions is wrong by 1 second Created: 2021-04-12  Updated: 2022-07-16  Resolved: 2021-05-02

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Versioned Tables
Affects Version/s: 10.3, 10.4, 10.5
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Aleksey Midenkov Assignee: Aleksey Midenkov
Resolution: Not a Bug Votes: 0
Labels: partition-pruning

Issue Links:
Relates
relates to MDEV-17554 Auto-create history partitions for sy... Closed
relates to MDEV-25529 Auto-create: Pre-existing historical ... Stalled
relates to MDEV-29114 Pruning depends on current timestamp ... Stalled

 Description   

Reproduce

-- source include/have_partition.inc
 
set timestamp= unix_timestamp('2000-01-01 00:00:00');
create or replace table t1 (x int) with system versioning
partition by system_time interval 1 hour
(partition p0 history, partition pn current);
 
insert into t1 values (330);
set timestamp= unix_timestamp('2000-01-01 00:10:00');
update t1 set x= x + 1;
 
--echo # Check how pruning boundaries work
explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58';
explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59';
 
drop tables t1;

Result

Only pn selected.

explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59';
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
1       SIMPLE  t1      pn      system  NULL    NULL    NULL    NULL    1

Expected

p0, pn selected.

explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59';
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
1       SIMPLE  t1      p0, pn      system  NULL    NULL    NULL    NULL    1



 Comments   
Comment by Aleksey Midenkov [ 2021-05-02 ]

Not a bug

Table is partitioned by row_end . AS OF '2000-01-01 00:59:59' means select records with row_end > '2000-01-01 00:59:59' and that is partition in next hour interval.

Generated at Thu Feb 08 09:37:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.