[MDEV-28413] Incorrect statistics and data for historical partitions for engine=Spider Created: 2022-04-26  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Partitioning, Storage Engine - Spider, Versioned Tables
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.11

Type: Bug Priority: Major
Reporter: Lena Startseva Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-29829 System versioning does not work with ... Open
relates to MDEV-17554 Auto-create history partitions for sy... Closed

 Description   

"information_schema.partitions" contains incorrect data about partitions for tables with engine=Spider (table_rows). Also request "select * from t_sp1 partition (p0)" returns data from current partition not from historical

Test:

--source include/have_innodb.inc
--source include/have_partition.inc
 
install soname 'ha_spider';
set spider_same_server_link= on;
 
eval create server s foreign data wrapper mysql options 
(host '127.0.0.1', database 'test', user 'root', port $MASTER_MYPORT);
 
CREATE TABLE t2(
   x INT,
   y INT,
   row_start TIMESTAMP(6),
   row_end TIMESTAMP(6)
);
 
create or replace table t_sp1 (x int,y int)
engine=Spider COMMENT='wrapper "mysql", srv "s", table "t2"' 
with system versioning partition by system_time (
    PARTITION p0 HISTORY,
    PARTITION pn CURRENT
); 
 
insert into t_sp1 values (1,1),(2,2),(3,3),(4,4),(5,5);
 
delete from t_sp1 where x=1;
 
select * from t_sp1;
select * from t_sp1 partition (p0);
 
select partition_name, table_rows from information_schema.partitions where table_name = 't_sp1';
 
drop tables t2, t_sp1;

Actual result:

select * from t_sp1;
x	y
2	2
3	3
4	4
5	5
select * from t_sp1 partition (p0);
x	y
2	2
3	3
4	4
5	5
select partition_name, table_rows from information_schema.partitions where table_name = 't_sp1';
partition_name	table_rows
p0	2
pn	2

Expected result:

select * from t_sp1;
x	y
2	2
3	3
4	4
5	5
select * from t_sp1 partition (p0);
x	y
1	1
select partition_name, table_rows from information_schema.partitions where table_name = 't_sp1';
partition_name	table_rows
p0	1
pn	4


Generated at Thu Feb 08 10:00:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.