[MDEV-23639] Auto-create does not work under LOCK TABLES or inside triggers Created: 2020-04-01  Updated: 2022-05-06  Resolved: 2022-02-07

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

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Duplicate Votes: 0
Labels: None
Environment:

bb-10.6-midenok-MDEV-17554


Issue Links:
Blocks
is blocked by MDEV-17554 Auto-create history partitions for sy... Closed
is blocked by MDEV-22292 Auto-repair doesn't work under LOCK T... Open
Duplicate
duplicates MDEV-17554 Auto-create history partitions for sy... Closed
duplicates MDEV-22292 Auto-repair doesn't work under LOCK T... Open
Relates

 Description   

Note: If you run the test below with InnoDB for the table engine, run ANALYZE TABLE to get correct row numbers.

--source include/have_partition.inc
--source include/have_sequence.inc
 
create table t1 (a int) with system versioning partition by system_time limit 1000 auto;
insert into t1 select seq from seq_1_to_3000;
 
create table t2 (b int);
create trigger tr after insert on t2 for each row delete from t1 limit 1000;
 
insert into t2 values (1);
select partition_name, table_rows from information_schema.partitions where table_name = 't1';
 
insert into t2 values (2);
select partition_name, table_rows from information_schema.partitions where table_name = 't1';
 
# cleanup
drop tables t1, t2;

bb-10.5-midenok-MENT-654 256d3c1be

insert into t2 values (1);
select partition_name, table_rows from information_schema.partitions where table_name = 't1';
partition_name	table_rows
p0	1000
pn	2000
insert into t2 values (2);
Warnings:
Warning	4114	Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions
select partition_name, table_rows from information_schema.partitions where table_name = 't1';
partition_name	table_rows
p0	2000
pn	1000



 Comments   
Comment by Aleksey Midenkov [ 2020-04-18 ]

Trigger is executed in LTM_PRELOCKED environment. TABLE may be opened by the parent statement or it may be taken from cache (first INSERT statement in test case). Early comment says: "we can't open not pre-opened tables in pre-locked/LOCK TABLES mode", some of consequences are in this preliminary analysis.

Related to 3104af4, d9227f1 (WL#3726).

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