[MDEV-28459] LIMIT partition switching is not correct in parallel threads Created: 2022-05-03  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 10.11

Type: Bug Priority: Minor
Reporter: Aleksey Midenkov Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When switching occurs in multiple threads simultaneously, several threads decide to switch to same partition breaking LIMIT value.

Reproduce

-- source include/have_partition.inc
 
create or replace table t1 (x int) with system versioning
partition by system_time limit 1 partitions 4;
insert into t1 values (1);
 
update t1 set x= x + 1;
update t1 set x= x + 2;
update t1 set x= x + 3;
 
select partition_name, table_rows from information_schema.partitions
where table_name = 't1';
 
create or replace table t1 (x int) with system versioning
partition by system_time limit 1 partitions 4;
insert into t1 values (1);
 
--connect con3, localhost, root
--connect con2, localhost, root
--connect con1, localhost, root
 
--connection con1
send update t1 set x= x + 10;
--connection con2
send update t1 set x= x + 20;
--connection con3
send update t1 set x= x + 30;
--connection con1
reap;
--connection con2
reap;
--connection con3
reap;
 
--disconnect con1
--disconnect con2
--disconnect con3
 
--connection default
select partition_name, table_rows from information_schema.partitions
where table_name = 't1';
 
drop tables t1;

Result

select partition_name, table_rows from information_schema.partitions
where table_name = 't1';
partition_name  table_rows
p0      1
p1      2
p2      0
pn      1

Expected

select partition_name, table_rows from information_schema.partitions
where table_name = 't1';
partition_name  table_rows
p0      1
p1      1
p2      1
pn      1


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