1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-16546 System versioning setting to allow history modification

1. system_versioning_insert_history session variable allows
pseudocolumns ROW_START and ROW_END be specified in INSERT,
INSERT..SELECT and LOAD DATA.

2. Cleaned up select_insert::send_data() from setting vers_write as
this parameter is now set on TABLE initialization.

4. Replication of system_versioning_insert_history via option_bits in
OPTIONS_WRITTEN_TO_BIN_LOG.
This commit is contained in:
Aleksey Midenkov
2022-08-28 22:44:56 +03:00
committed by Sergei Golubchik
parent d9b0c9ad2b
commit a2cda88631
23 changed files with 581 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection slave;
set @@session.time_zone='+00:00';
connection master;
CREATE TABLE t1 (x int) with system versioning;
insert into t1 values (1);
@@ -384,4 +385,55 @@ connection slave;
connection master;
drop tables t, t2;
set timestamp= default;
#
# MDEV-16546 System versioning setting to allow history modification
#
create table t1(x int) with system versioning;
insert into t1(x) values (1);
insert into t1(x, row_start, row_end) values (2, '1980-01-01 00:00:00', '1980-01-01 00:00:01');
ERROR 42S22: Unknown column 'row_start' in 'field list'
set @@system_versioning_insert_history= 1;
insert into t1(x, row_start, row_end) values (3, '1980-01-01 00:00:00', '1980-01-01 00:00:01');
update t1 set x= x + 1;
connection slave;
set @@session.time_zone='+00:00';
select x, check_row_ts(row_start, row_end) from t1 for system_time all order by x;
x check_row_ts(row_start, row_end)
1 HISTORICAL ROW
2 CURRENT ROW
3 HISTORICAL ROW
select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t1 for system_time all where x = 3;
row_start = '1980-01-01 00:00:00' row_end = '1980-01-01 00:00:01'
1 1
## INSERT..SELECT
connection master;
create or replace table t2 like t1;
set @@system_versioning_insert_history= 1;
insert into t2 (x, row_start, row_end) select x, row_start, row_end from t1 for system_time all;
connection slave;
select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x;
x check_row_ts(row_start, row_end)
1 HISTORICAL ROW
2 CURRENT ROW
3 HISTORICAL ROW
select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t2 for system_time all where x = 3;
row_start = '1980-01-01 00:00:00' row_end = '1980-01-01 00:00:01'
1 1
# LOAD DATA
connection master;
select x, row_start, row_end into outfile 'DATAFILE' from t1 for system_time all;
create or replace table t3 like t1;
set @@system_versioning_insert_history= 1;
load data infile 'DATAFILE' into table t3 (x, row_start, row_end);
connection slave;
select x, check_row_ts(row_start, row_end) from t3 for system_time all order by x;
x check_row_ts(row_start, row_end)
1 HISTORICAL ROW
2 CURRENT ROW
3 HISTORICAL ROW
select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t3 for system_time all where x = 3;
row_start = '1980-01-01 00:00:00' row_end = '1980-01-01 00:00:01'
1 1
connection master;
drop tables t1, t2, t3;
include/rpl_end.inc