1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +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

@@ -97,16 +97,26 @@ drop table t1;
--echo #
--echo # MDEV-21138 Assertion `col->ord_part' or `f.col->ord_part' failed in row_build_index_entry_low
--echo #
create table t1 (
--echo # Check DELETE and multi-DELETE with foreign key
replace_result $sys_datatype_expl SYS_TYPE;
eval 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_datatype_expl as row start invisible,
row_end $sys_datatype_expl 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;
delete from t1;
select f1, f3, check_row_ts(row_start, row_end) from t1 for system_time all;
# cleanup
drop table t1;
insert into t1 select 2, f2, 2 from t1;
select f1, f3, check_row(row_start, row_end) from t1;
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;
create table t2 (f1 int);
insert into t2 values (2);
--echo # 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;
--echo # Cleanup
drop tables t1, t2;
--source suite/versioning/common_finish.inc

View File

@@ -398,15 +398,21 @@ INSERT INTO t2 VALUES (1,'against'),(2,'q');
SET SQL_MODE= '';
SET timestamp = 2;
--disable_ps2_protocol
SELECT * INTO OUTFILE 't1.data' FROM t1;
--enable_ps2_protocol
SET timestamp = 3;
UPDATE t1 SET f13 = 'q';
SET timestamp = 4;
LOAD DATA INFILE 't1.data' REPLACE INTO TABLE t1;
--disable_ps2_protocol
SELECT * INTO OUTFILE 't1.data.2' FROM t1;
--enable_ps2_protocol
SET timestamp = 5;
LOAD DATA INFILE 't1.data.2' REPLACE INTO TABLE t1;
--disable_ps2_protocol
SELECT * INTO OUTFILE 't2.data' FROM t2;
--enable_ps2_protocol
SET timestamp = 6;
LOAD DATA INFILE 't2.data' REPLACE INTO TABLE t2;
SET FOREIGN_KEY_CHECKS = OFF;
@@ -549,7 +555,9 @@ delete from t0;
--error ER_ROW_IS_REFERENCED_2
replace t0 values (1);
--disable_ps2_protocol
select * into outfile 'load_t0' from t0 ;
--enable_ps2_protocol
--error ER_ROW_IS_REFERENCED_2
load data infile 'load_t0' replace into table t0;

View File

@@ -6,8 +6,10 @@ CREATE TABLE t1 (a INT, b INT, c INT, vc INT AS (c), UNIQUE(a), UNIQUE(b)) WITH
INSERT IGNORE INTO t1 (a,b,c) VALUES (1,2,3);
--enable_prepare_warnings
--disable_ps2_protocol
SELECT a, b, c FROM t1 INTO OUTFILE '15330.data';
--disable_prepare_warnings
--enable_ps2_protocol
LOAD DATA INFILE '15330.data' IGNORE INTO TABLE t1 (a,b,c);
LOAD DATA INFILE '15330.data' REPLACE INTO TABLE t1 (a,b,c);

View File

@@ -1019,7 +1019,9 @@ create or replace table t1 (
insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
--disable_ps2_protocol
select * into outfile 'MDEV-17891.data' from t1;
--enable_ps2_protocol
load data infile 'MDEV-17891.data' replace into table t1;
--error ER_RECORD_FILE_FULL
load data infile 'MDEV-17891.data' replace into table t1;
@@ -1365,7 +1367,9 @@ partition by system_time limit 100 (
partition pn current);
insert into t1 select seq from seq_0_to_49;
--disable_ps2_protocol
select x into outfile 'MDEV-20077.data' from t1;
--enable_ps2_protocol
load data infile 'MDEV-20077.data' replace into table t1 (x);
load data infile 'MDEV-20077.data' replace into table t1 (x);
@@ -2204,7 +2208,9 @@ create or replace table t1 (x int primary key) with system versioning
partition by system_time interval 1 hour auto;
insert t1 values (1), (2), (3);
--disable_ps2_protocol
select x into outfile 'MDEV-17554.data' from t1;
--enable_ps2_protocol
set timestamp= unix_timestamp('2000-01-01 01:00:00');
load data infile 'MDEV-17554.data' replace into table t1 (x);
@@ -2634,5 +2640,21 @@ alter table t partition by system_time interval 10 week;
drop table t;
--disable_prepare_warnings
--echo #
--echo # MDEV-29727 ALTER and CREATE with default partitioning
--echo # differently react to SQL_MODE => unusable SHOW CREATE
--echo #
create table t (a int) with system versioning;
--error WARN_VERS_PARAMETERS
alter table t partition by system_time partitions 3;
drop table t;
--error WARN_VERS_PARAMETERS
create table t (a int) with system versioning partition by system_time partitions 3;
--echo #
--echo # End of 10.5 tests
--echo #
set global innodb_stats_persistent= @save_persistent;
--source suite/versioning/common_finish.inc

View File

@@ -1,4 +1,5 @@
--source suite/versioning/engines.inc
--source suite/versioning/common.inc
--source include/have_partition.inc
--source include/master-slave.inc
@@ -6,6 +7,7 @@
#Testing command counters -BEFORE.
#Storing the before counts of Slave
connection slave;
--source suite/versioning/common.inc
let $slave_com_commit_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1);
let $slave_com_insert_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1);
let $slave_com_delete_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1);
@@ -167,6 +169,57 @@ sync_slave_with_master;
connection master;
drop table t1;
--echo #
--echo # MDEV-31313 SYSTEM VERSIONING and FOREIGN KEY CASCADE create orphan rows on replica
--echo #
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;
select check_row(row_start, row_end) from child for system_time all;
select * from child;
select * from parent;
sync_slave_with_master;
# Annoying tweaking of microseconds in slave row_end, so row_end can be <= row_start
select check_row_slave(row_start, row_end) from parent for system_time all;
select check_row_slave(row_start, row_end) from child for system_time all;
select * from child;
select * from parent;
# Cleanup
--source suite/versioning/common_finish.inc
--connection master
set timestamp= default;
drop table child;
drop table parent;
sync_slave_with_master;
connection master;
--source suite/versioning/common_finish.inc
--echo #
--echo # MDEV-17554 Auto-create new partition for system versioned tables
--echo # with history partitioned by INTERVAL/LIMIT

View File

@@ -26,15 +26,18 @@ eval create table t1 (
sys_trx_end $sys_datatype_expl 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;
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;
drop table t1;
set timestamp= default;
replace_result $sys_datatype_expl SYS_DATATYPE;
eval create table t1 (
@@ -373,6 +376,44 @@ update t1, t2 set t1.a = 3, t2.a = 3 where t1.b <= 10 and t2.b <= 10 and t1.b =
# cleanup
drop tables t1, t2;
--echo #
--echo # MDEV-23100 ODKU of non-versioning column inserts history row
--echo #
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;
drop table t1;
--echo #
--echo # MDEV-25644 UPDATE not working properly on transaction precise system versioned table
--echo #
create or replace table t1 (nid int primary key, nstate int, ntype int) engine innodb;
--replace_result $sys_datatype_expl SYS_DATATYPE
eval alter table t1 add
row_start $sys_datatype_expl generated always as row start invisible,
add row_end $sys_datatype_expl 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;
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;
--echo # 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;
# Under one transaction trx_id generates only one history row, that differs from timestamp
select nid, nstate, check_row(row_start, row_end) from t1 for system_time all order by row_start, row_end;
commit;
drop tables t1;
--echo # End of 10.4 tests
source suite/versioning/common_finish.inc;