1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-25546 LIMIT partitioning does not respect ROLLBACK

vers_info->hist_part retained stale value after ROLLBACK. The
algorithm in vers_set_hist_part() continued iteration from that value.

The simplest solution is to process partitions each time from start
for LIMIT in vers_set_hist_part().
This commit is contained in:
Aleksey Midenkov
2022-04-22 15:49:37 +03:00
parent 4d11290065
commit 88a9f13a90
3 changed files with 86 additions and 5 deletions

View File

@ -1,3 +1,5 @@
set @save_persistent=@@global.innodb_stats_persistent;
set global innodb_stats_persistent= 0;
set system_versioning_alter_history=keep;
# Check conventional partitioning on temporal tables
create or replace table t1 (
@ -799,4 +801,43 @@ delete from t1 partition (p0, p1, pn);
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
drop table t1;
set timestamp= default;
#
# MDEV-25546 LIMIT partitioning does not respect ROLLBACK
#
create or replace table t1 (pk int primary key)
with system versioning engine innodb
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_1_to_90;
start transaction;
replace into t1 select seq from seq_1_to_80;
replace into t1 select seq from seq_1_to_70;
replace into t1 select seq from seq_1_to_60;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
partition_name table_rows
p0 150
p1 60
pn 90
rollback;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
partition_name table_rows
p0 0
p1 0
pn 90
replace into t1 select seq from seq_1_to_10;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
partition_name table_rows
p0 10
p1 0
pn 90
drop table t1;
# End of 10.3 tests
set global innodb_stats_persistent= @save_persistent;

View File

@ -1,6 +1,10 @@
-- source include/have_partition.inc
-- source suite/versioning/common.inc
-- source suite/versioning/engines.inc
-- source include/have_sequence.inc
set @save_persistent=@@global.innodb_stats_persistent;
set global innodb_stats_persistent= 0;
set system_versioning_alter_history=keep;
--echo # Check conventional partitioning on temporal tables
@ -782,6 +786,44 @@ delete from t1 partition (p0, pn);
delete from t1 partition (p0, p1, pn);
drop table t1;
set timestamp= default;
--echo #
--echo # MDEV-25546 LIMIT partitioning does not respect ROLLBACK
--echo #
create or replace table t1 (pk int primary key)
with system versioning engine innodb
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_1_to_90;
start transaction;
# Puts 80 rows into p0
replace into t1 select seq from seq_1_to_80;
# Puts another 70 rows into p0
replace into t1 select seq from seq_1_to_70;
# Puts 60 rows into p1
replace into t1 select seq from seq_1_to_60;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
rollback;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
# Should put 10 rows into the empty partition p0
replace into t1 select seq from seq_1_to_10;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
# Cleanup
drop table t1;
--echo # End of 10.3 tests
set global innodb_stats_persistent= @save_persistent;
--source suite/versioning/common_finish.inc