[MDEV-20077] Warning on full history partition is delayed until next DML statement Created: 2019-07-16  Updated: 2022-04-29  Resolved: 2022-04-29

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Versioned Tables
Affects Version/s: 10.3, 10.4
Fix Version/s: 10.3.35, 10.4.25, 10.5.16, 10.6.8, 10.7.4, 10.8.3

Type: Bug Priority: Major
Reporter: Aleksey Midenkov Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-20345 Warning of full history partition is ... Closed
Relates
relates to MDEV-28271 Assertion on TRUNCATE PARTITION for P... Closed
relates to MDEV-20068 History partition rotation is not don... Closed
relates to MDEV-25476 Auto-create: DML exceeding LIMIT size... Closed
relates to MDEV-28337 Update documentation for SYSTEM_TIME ... Stalled

 Description   

Reproduce

create or replace table t1 (x int) with system versioning partition by system_time limit 1;
insert into t1 values (0), (1), (2), (3);
delete from t1;

Result

No warning printed.

Expected

+---------+------+----------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                  |
+---------+------+----------------------------------------------------------------------------------------------------------+
| Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
+---------+------+----------------------------------------------------------------------------------------------------------+

Variation

This variation displays warning on second DELETE:

create or replace table t1 (x int) with system versioning partition by system_time limit 1;
insert into t1 values (0), (1), (2), (3);
delete from t1 where x < 3;
delete from t1;

Additional problem: LIMIT allows on more extra record unexpectedly

Reproduce

-- source include/have_partition.inc
-- source include/have_sequence.inc
 
create table t1 (x int) engine=myisam  with system versioning
partition by system_time limit 100 (
  partition p0 history,
  partition p1 history,
  partition pn current);
 
insert into t1 select seq from seq_0_to_200;
 
delete from t1 where x <= 99;
show warnings;
delete from t1 where x <= 100;
show warnings;
delete from t1;
show warnings;
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;

Result

Partition p0 is filled with 101 records. No warning printed.

delete from t1 where x <= 99;
show warnings;
Level   Code    Message
delete from t1 where x <= 100;
show warnings;
Level   Code    Message
delete from t1;
show warnings;
Level   Code    Message
select count(*) from t1 partition (p0);
count(*)
101
select count(*) from t1 partition (p1);
count(*)
100

Expected

Partition p0 is filled is filled with 100 records. Warning is printed when p1 is filled with 101 records.

delete from t1 where x <= 99;
show warnings;
Level   Code    Message
delete from t1 where x <= 100;
show warnings;
Level   Code    Message
delete from t1;
show warnings;
Level   Code    Message
Warning 4114    Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
101



 Comments   
Comment by Aleksey Midenkov [ 2022-04-25 ]

Please review bb-10.3-midenok

Comment by Nikita Malyavin [ 2022-04-27 ]

ok to push

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