1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Merge branch '10.6' into 10.9

This commit is contained in:
Oleksandr Byelkin
2023-08-04 08:01:06 +02:00
858 changed files with 12277 additions and 6177 deletions

View File

@@ -133,18 +133,38 @@ drop table t1;
#
# MDEV-21138 Assertion `col->ord_part' or `f.col->ord_part' failed in row_build_index_entry_low
#
# Check DELETE and multi-DELETE with foreign key
create table t1 (
f1 int, f2 text, f3 int, fulltext (f2), key(f1), key(f3),
foreign key r (f3) references t1 (f1) on delete set null)
foreign key r (f3) references t1 (f1) on delete set null,
row_start SYS_TYPE as row start invisible,
row_end SYS_TYPE as row end invisible,
period for system_time (row_start, row_end))
with system versioning engine innodb;
insert into t1 values (1, repeat('a', 8193), 1), (1, repeat('b', 8193), 1);
select f1, f3, check_row_ts(row_start, row_end) from t1;
f1 f3 check_row_ts(row_start, row_end)
insert into t1 select 2, f2, 2 from t1;
select f1, f3, check_row(row_start, row_end) from t1;
f1 f3 check_row(row_start, row_end)
1 1 CURRENT ROW
1 1 CURRENT ROW
delete from t1;
select f1, f3, check_row_ts(row_start, row_end) from t1 for system_time all;
f1 f3 check_row_ts(row_start, row_end)
2 2 CURRENT ROW
2 2 CURRENT ROW
delete from t1 where f1 = 1;
select f1, f3, check_row(row_start, row_end) from t1 for system_time all order by f1, row_end;
f1 f3 check_row(row_start, row_end)
1 1 HISTORICAL ROW
1 1 HISTORICAL ROW
drop table t1;
2 2 CURRENT ROW
2 2 CURRENT ROW
create table t2 (f1 int);
insert into t2 values (2);
# Multi-delelte
delete t1, t2 from t1 join t2 where t1.f1 = t2.f1;
select f1, f3, check_row(row_start, row_end) from t1 for system_time all order by f1, row_end;
f1 f3 check_row(row_start, row_end)
1 1 HISTORICAL ROW
1 1 HISTORICAL ROW
2 2 HISTORICAL ROW
2 2 HISTORICAL ROW
# Cleanup
drop tables t1, t2;

View File

@@ -3413,4 +3413,17 @@ drop table t;
create table t (a int) with system versioning partition by system_time interval 5 week;
alter table t partition by system_time interval 10 week;
drop table t;
#
# MDEV-29727 ALTER and CREATE with default partitioning
# differently react to SQL_MODE => unusable SHOW CREATE
#
create table t (a int) with system versioning;
alter table t partition by system_time partitions 3;
ERROR HY000: Maybe missing parameters: no rotation condition for multiple HISTORY partitions.
drop table t;
create table t (a int) with system versioning partition by system_time partitions 3;
ERROR HY000: Maybe missing parameters: no rotation condition for multiple HISTORY partitions.
#
# End of 10.5 tests
#
set global innodb_stats_persistent= @save_persistent;

View File

@@ -189,6 +189,55 @@ include/diff_tables.inc [master:test.t1,slave:test.t1]
connection master;
drop table t1;
#
# MDEV-31313 SYSTEM VERSIONING and FOREIGN KEY CASCADE create orphan rows on replica
#
create table parent (
id int(11) not null auto_increment,
processdate datetime default null,
primary key (id)
) engine=innodb with system versioning;
set timestamp= unix_timestamp('2000-01-01 00:00:00');
insert into parent values (1, now());
create table child (
id int(11) not null auto_increment,
ch_name varchar(30),
andreid int(11) default null,
primary key (id),
key andreid (andreid),
constraint fk_andreid foreign key (andreid) references parent (id) on delete cascade
) engine=innodb with system versioning;
set timestamp= unix_timestamp('2000-01-01 00:00:01');
insert into child values (null, 'vimtomar', 1);
set timestamp= unix_timestamp('2000-01-01 00:00:02');
delete from parent where id = 1;
select check_row(row_start, row_end) from parent for system_time all;
check_row(row_start, row_end)
HISTORICAL ROW
select check_row(row_start, row_end) from child for system_time all;
check_row(row_start, row_end)
HISTORICAL ROW
select * from child;
id ch_name andreid
select * from parent;
id processdate
connection slave;
select check_row_slave(row_start, row_end) from parent for system_time all;
check_row_slave(row_start, row_end)
HISTORICAL ROW
select check_row_slave(row_start, row_end) from child for system_time all;
check_row_slave(row_start, row_end)
HISTORICAL ROW
select * from child;
id ch_name andreid
select * from parent;
id processdate
connection master;
set timestamp= default;
drop table child;
drop table parent;
connection slave;
connection master;
#
# MDEV-17554 Auto-create new partition for system versioned tables
# with history partitioned by INTERVAL/LIMIT
#

View File

@@ -1,6 +1,6 @@
--- update.result 2018-12-19 13:55:35.873917389 +0300
+++ update,trx_id.reject 2018-12-19 13:55:35.533917399 +0300
@@ -81,12 +81,10 @@
--- update.result
+++ update.reject
@@ -84,12 +84,10 @@
commit;
select x, y, sys_trx_end = MAXVAL as current from t1 for system_time all order by sys_trx_end, x, y;
x y current
@@ -14,3 +14,11 @@
1 1 1
2 2 1
3 3 1
@@ -464,7 +462,6 @@
select nid, nstate, check_row(row_start, row_end) from t1 for system_time all order by row_start, row_end;
nid nstate check_row(row_start, row_end)
1 1 HISTORICAL ROW
-1 1 HISTORICAL ROW
1 3 CURRENT ROW
commit;
drop tables t1;

View File

@@ -51,19 +51,22 @@ sys_trx_start SYS_DATATYPE as row start invisible,
sys_trx_end SYS_DATATYPE as row end invisible,
period for system_time (sys_trx_start, sys_trx_end))
with system versioning;
set timestamp= unix_timestamp('2000-01-01 00:00:00');
insert into t1 values(1, 1, 1);
set @ins_t= now(6);
select sys_trx_start into @tmp1 from t1;
set timestamp= unix_timestamp('2000-01-01 01:00:00');
update t1 set x= 11, y= 11 where id = 1;
select @tmp1 < sys_trx_start as A1, x, y from t1;
A1 x y
1 11 11
select sys_trx_start into @tmp1 from t1;
set timestamp= unix_timestamp('2000-01-01 02:00:00');
update t1 set y= 1 where id = 1;
select @tmp1 = sys_trx_start as A2, x from t1;
A2 x
1 11
drop table t1;
set timestamp= default;
create table t1 (
x int,
y int,
@@ -437,4 +440,46 @@ update t1 set a = 3 where b <= 9;
update t2 set a = 3 where b <= 9;
update t1, t2 set t1.a = 3, t2.a = 3 where t1.b <= 10 and t2.b <= 10 and t1.b = t2.b;
drop tables t1, t2;
#
# MDEV-23100 ODKU of non-versioning column inserts history row
#
create table t1 (
x int unique,
y int without system versioning
) with system versioning;
insert into t1 (x, y) values ('1', '1');
insert into t1 (x, y) values ('1', '2')
on duplicate key update y = 3;
select x, y, check_row_ts(row_start, row_end) from t1 for system_time all order by row_end;
x y check_row_ts(row_start, row_end)
1 3 CURRENT ROW
drop table t1;
#
# MDEV-25644 UPDATE not working properly on transaction precise system versioned table
#
create or replace table t1 (nid int primary key, nstate int, ntype int) engine innodb;
alter table t1 add
row_start SYS_DATATYPE generated always as row start invisible,
add row_end SYS_DATATYPE generated always as row end invisible,
add period for system_time(row_start, row_end),
add system versioning;
insert into t1 values (1, 1, 1);
select nid, nstate, check_row(row_start, row_end) from t1 for system_time all order by row_start, row_end;
nid nstate check_row(row_start, row_end)
1 1 CURRENT ROW
start transaction;
update t1 set nstate= nstate where nid = 1;
select nid, nstate, check_row(row_start, row_end) from t1 for system_time all order by row_start, row_end;
nid nstate check_row(row_start, row_end)
1 1 HISTORICAL ROW
1 1 CURRENT ROW
# Bug: ERROR 1761 (23000): Foreign key constraint for table 'xxx', record '1-18446744073709551615' would lead to a duplicate entry in table 'xxx', key 'PRIMARY'
update t1 set nstate= 3 where nid= 1;
select nid, nstate, check_row(row_start, row_end) from t1 for system_time all order by row_start, row_end;
nid nstate check_row(row_start, row_end)
1 1 HISTORICAL ROW
1 1 HISTORICAL ROW
1 3 CURRENT ROW
commit;
drop tables t1;
# End of 10.4 tests