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

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2024-10-03 09:31:39 +03:00
482 changed files with 4427 additions and 623 deletions

View File

@@ -139,9 +139,11 @@ select * from t;
update t set a=3 where a=1;
select * from t;
select * from t for system_time all;
--disable_cursor_protocol
--enable_prepare_warnings
select row_start from t where a=3 into @tm;
--disable_prepare_warnings
--enable_cursor_protocol
alter table t add column b int;
select @tm=row_start from t where a=3;
show create table t;

View File

@@ -18,21 +18,27 @@ insert into t1 values ();
set @ts0= now(6);
insert into t1 values ();
--disable_cursor_protocol
--enable_prepare_warnings
select sys_trx_start from t1 where id = last_insert_id() into @tx0;
--enable_cursor_protocol
select transaction_id = @tx0 from mysql.transaction_registry
order by transaction_id desc limit 1;
set @ts1= now(6);
insert into t1 values ();
--disable_cursor_protocol
select sys_trx_start from t1 where id = last_insert_id() into @tx1;
--enable_cursor_protocol
select transaction_id = @tx1 from mysql.transaction_registry
order by transaction_id desc limit 1;
set @ts2= now(6);
insert into t1 values ();
--disable_cursor_protocol
select sys_trx_start from t1 where id = last_insert_id() into @tx2;
--enable_cursor_protocol
select transaction_id = @tx2 from mysql.transaction_registry
order by transaction_id desc limit 1;
@@ -72,22 +78,30 @@ select trt_trx_sees(0, @tx2);
set transaction isolation level read uncommitted;
insert into t1 values ();
--disable_cursor_protocol
select sys_trx_start from t1 where id = last_insert_id() into @tx3;
--enable_cursor_protocol
select isolation_level = 'READ-UNCOMMITTED' from mysql.transaction_registry where transaction_id = @tx3;
set transaction isolation level read committed;
insert into t1 values ();
--disable_cursor_protocol
select sys_trx_start from t1 where id = last_insert_id() into @tx4;
--enable_cursor_protocol
select isolation_level = 'READ-COMMITTED' from mysql.transaction_registry where transaction_id = @tx4;
set transaction isolation level serializable;
insert into t1 values ();
--disable_cursor_protocol
select sys_trx_start from t1 where id = last_insert_id() into @tx5;
--enable_cursor_protocol
select isolation_level = 'SERIALIZABLE' from mysql.transaction_registry where transaction_id = @tx5;
set transaction isolation level repeatable read;
insert into t1 values ();
--disable_cursor_protocol
select sys_trx_start from t1 where id = last_insert_id() into @tx6;
--enable_cursor_protocol
select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where transaction_id = @tx6;
--disable_prepare_warnings

View File

@@ -214,9 +214,11 @@ show create table t3;
--echo ## For versioned table
insert into t1 values (1);
--disable_cursor_protocol
select row_start from t1 into @row_start;
insert into t0 (y) values (2);
select st from t0 into @st;
--enable_cursor_protocol
create or replace table t2 with system versioning as select * from t1;
--replace_result $default_engine DEFAULT_ENGINE
@@ -255,10 +257,12 @@ create or replace table t3 with system versioning select x23, row_start from t1;
create or replace table t3 with system versioning select x23, row_end from t1;
--echo # Prepare checking for historical row
--disable_cursor_protocol
delete from t1;
select row_end from t1 for system_time all into @row_end;
delete from t0;
select en from t0 for system_time all into @en;
--enable_cursor_protocol
--echo ## Combinations of versioned + non-versioned
create or replace table t2 (y int);
@@ -274,9 +278,13 @@ insert into t2 (y) values (1), (2);
delete from t2 where y = 2;
create or replace table t3 select * from t2 for system_time all;
--disable_cursor_protocol
select st, en from t3 where y = 1 into @st, @en;
--enable_cursor_protocol
select y from t2 for system_time all where st = @st and en = @en;
--disable_cursor_protocol
select st, en from t3 where y = 2 into @st, @en;
--enable_cursor_protocol
select y from t2 for system_time all where st = @st and en = @en;
--echo ## Default engine detection

View File

@@ -1,6 +1,6 @@
if (`SELECT $PS_PROTOCOL != 0`)
if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`)
{
--skip Test temporarily disabled for ps-protocol
--skip Test temporarily disabled for ps-protocol and cursor-protocol
}
--source include/have_innodb.inc
--source include/default_optimizer_switch.inc
@@ -38,7 +38,9 @@ insert into emp (emp_id, name, salary, dept_id, mgr) values
(20, "john", 500, 10, 1),
(30, "jane", 750, 10,1 );
--disable_cursor_protocol
select row_start into @ts_1 from emp where name="jane";
--enable_cursor_protocol
update emp set mgr=30 where name ="john";
@@ -49,7 +51,9 @@ with ancestors as (
select e.emp_id, e.name, e.mgr, e.salary from emp as e
) select * from ancestors for system_time as of @ts_1;
--disable_cursor_protocol
select row_start into @ts_2 from emp where name="john";
--enable_cursor_protocol
let $q=
/* All report to 'Bill' */

View File

@@ -42,7 +42,9 @@ eval create or replace table t1(
with system versioning;
insert into t1(x) values (1);
--disable_cursor_protocol
select sys_start into @sys_start from t1;
--disable_cursor_protocol
delete from t1;
select * from t1;
select x = 1 as A, sys_start = @sys_start as B, sys_end > sys_start as C from t1 for system_time all;

View File

@@ -314,9 +314,11 @@ create or replace table subchild (
) engine=innodb;
insert into parent (value) values (23);
--disable_cursor_protocol
--enable_prepare_warnings
select id, value from parent into @id, @value;
--disable_prepare_warnings
--enable_cursor_protocol
insert into child values (default, @id, @value);
insert into subchild values (default, @id, @value);
@@ -398,21 +400,27 @@ INSERT INTO t2 VALUES (1,'against'),(2,'q');
SET SQL_MODE= '';
SET timestamp = 2;
--disable_cursor_protocol
--disable_ps2_protocol
SELECT * INTO OUTFILE 't1.data' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
SET timestamp = 3;
UPDATE t1 SET f13 = 'q';
SET timestamp = 4;
LOAD DATA INFILE 't1.data' REPLACE INTO TABLE t1;
--disable_cursor_protocol
--disable_ps2_protocol
SELECT * INTO OUTFILE 't1.data.2' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
SET timestamp = 5;
LOAD DATA INFILE 't1.data.2' REPLACE INTO TABLE t1;
--disable_cursor_protocol
--disable_ps2_protocol
SELECT * INTO OUTFILE 't2.data' FROM t2;
--enable_ps2_protocol
--enable_cursor_protocol
SET timestamp = 6;
LOAD DATA INFILE 't2.data' REPLACE INTO TABLE t2;
SET FOREIGN_KEY_CHECKS = OFF;
@@ -555,9 +563,11 @@ delete from t0;
--error ER_ROW_IS_REFERENCED_2
replace t0 values (1);
--disable_cursor_protocol
--disable_ps2_protocol
select * into outfile 'load_t0' from t0 ;
--enable_ps2_protocol
--enable_cursor_protocol
--error ER_ROW_IS_REFERENCED_2
load data infile 'load_t0' replace into table t0;

View File

@@ -52,9 +52,11 @@ drop view vt1_1;
replace_result $sys_datatype_expl SYS_DATATYPE;
eval create or replace table t1( id bigint primary key, a int, b int) with system versioning;
insert into t1 values(1, 1, 1);
--disable_cursor_protocol
--enable_prepare_warnings
select row_start, row_end from t1 into @sys_start, @sys_end;
--disable_prepare_warnings
--enable_cursor_protocol
select id, a, b from t1;
insert into t1 values(2, 2, 2);
select id, a, b, row_start > @sys_start as C, row_end = @sys_end as D from t1 where id = 2;

View File

@@ -48,7 +48,9 @@ insert into t1 (row_start) select row_end from t1;
set sql_mode='';
insert into t1 (row_start, row_end) values (DEFAULT, 1);
set sql_mode=default;
--disable_cursor_protocol
select @@sql_mode into @saved_mode;
--enable_cursor_protocol
set sql_mode= '';
insert into t1 (x, row_start, row_end) values (3, 4, 5);
set sql_mode= @saved_mode;

View File

@@ -4,11 +4,13 @@
CREATE TABLE t1 (a INT, b INT, c INT, vc INT AS (c), UNIQUE(a), UNIQUE(b)) WITH SYSTEM VERSIONING;
INSERT IGNORE INTO t1 (a,b,c) VALUES (1,2,3);
--disable_cursor_protocol
--enable_prepare_warnings
--disable_ps2_protocol
SELECT a, b, c FROM t1 INTO OUTFILE '15330.data';
--disable_prepare_warnings
--enable_ps2_protocol
--enable_cursor_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

@@ -997,6 +997,7 @@ create or replace table t1 (
insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
--disable_cursor_protocol
--disable_ps2_protocol
select * into outfile 'load.data' from t1;
--enable_ps2_protocol
@@ -1005,6 +1006,7 @@ load data infile 'load.data' replace into table t1;
load data infile 'load.data' replace into table t1;
--error ER_RECORD_FILE_FULL
load data infile 'load.data' replace into table t1;
--enable_cursor_protocol
# Cleanup
--let $datadir= `select @@datadir`
@@ -1341,9 +1343,11 @@ partition by system_time limit 100 (
partition pn current);
insert into t1 select seq from seq_0_to_49;
--disable_cursor_protocol
--disable_ps2_protocol
select x into outfile 'MDEV-20077.data' from t1;
--enable_ps2_protocol
--enable_cursor_protocol
load data infile 'MDEV-20077.data' replace into table t1 (x);
load data infile 'MDEV-20077.data' replace into table t1 (x);

View File

@@ -1,6 +1,6 @@
if (`SELECT $PS_PROTOCOL != 0`)
if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`)
{
--skip Need regular protocol but ps-protocol was specified
--skip Need regular protocol but ps-protocol and cursor-protocol were specified
}
--source suite/versioning/engines.inc
--source suite/versioning/common.inc
@@ -37,7 +37,9 @@ set @t0= now(6);
if ($MTR_COMBINATION_TRX_ID)
{
--disable_query_log
--disable_cursor_protocol
select sys_trx_start from t1 limit 1 into @x0;
--enable_cursor_protocol
--enable_query_log
}
@@ -45,12 +47,16 @@ delete from t1 where x = 3;
delete from t1 where x > 7;
insert into t1(x, y) values(3, 33);
--disable_cursor_protocol
select sys_trx_start from t1 where x = 3 and y = 33 into @t1;
--enable_cursor_protocol
if ($MTR_COMBINATION_TRX_ID)
{
--disable_query_log
set @x1= @t1;
--disable_cursor_protocol
select trt_commit_ts(@x1) into @t1;
--enable_cursor_protocol
--enable_query_log
}
@@ -126,12 +132,14 @@ delete from t1;
insert into t1 values (3);
delete from t1;
--disable_cursor_protocol
select row_start into @start1 from t1 for system_time all where x = 1;
select row_end into @end1 from t1 for system_time all where x = 1;
select row_start into @start2 from t1 for system_time all where x = 2;
select row_end into @end2 from t1 for system_time all where x = 2;
select row_start into @start3 from t1 for system_time all where x = 3;
select row_end into @end3 from t1 for system_time all where x = 3;
--enable_cursor_protocol
select x as ASOF_x from t1 for system_time as of @start2;
select x as ASOF_x from t1 for system_time as of @end2;
@@ -262,7 +270,9 @@ create or replace table t1 (
insert into t1 values (1);
set @ts= now(6);
delete from t1;
--disable_cursor_protocol
select sys_trx_start from t1 for system_time all into @trx_start;
--enable_cursor_protocol
--echo ## ensure @trx_start is much lower than unix timestamp
select @trx_start < unix_timestamp(@ts) - 100 as trx_start_good;
@@ -390,8 +400,10 @@ eval create or replace table t1 (
) with system versioning;
insert into t1 values (1);
delete from t1;
--disable_cursor_protocol
select row_start from t1 for system_time all into @t1;
select row_end from t1 for system_time all into @t2;
--enable_cursor_protocol
--disable_query_log
if($MTR_COMBINATION_TRX_ID) {
set @t1= trt_begin_ts(@t1);

View File

@@ -22,13 +22,17 @@ insert into t1 (x, y) values
(8, 108),
(9, 109);
set @t0= now(6);
--disable_cursor_protocol
--enable_prepare_warnings
select sys_start from t1 limit 1 into @x0;
--disable_prepare_warnings
--enable_cursor_protocol
delete from t1 where x = 3;
delete from t1 where x > 7;
insert into t1(x, y) values(3, 33);
--disable_cursor_protocol
--enable_prepare_warnings
select sys_start from t1 where x = 3 and y = 33 into @t1;
--disable_prepare_warnings
@@ -36,6 +40,7 @@ if($MTR_COMBINATION_TRX_ID) {
set @x1= @t1;
select trt_commit_ts(@x1) into @t1;
}
--enable_cursor_protocol
select x, y from t1;
select x as ASOF_x, y from t1 for system_time as of timestamp @t0;

View File

@@ -18,6 +18,7 @@ create or replace table emp (
)
with system versioning;
--disable_cursor_protocol
select now() into @ts_0;
insert into dept (dept_id, name) values (10, "accounting");
@@ -29,13 +30,16 @@ insert into emp (emp_id, name, salary, dept_id) values (1, "bill", 1000, 10);
commit;
select row_start into @ts_2 from emp where name="bill";
--enable_cursor_protocol
select * from emp;
update emp set salary=2000 where name="bill";
commit;
--disable_cursor_protocol
select row_start into @ts_3 from emp where name="bill";
--enable_cursor_protocol
select * from emp;
select * from emp for system_time as of timestamp @ts_2;

View File

@@ -40,11 +40,15 @@ alter table t1
add period for system_time(s, e),
add system versioning,
algorithm=inplace;
--disable_cursor_protocol
select s from t1 into @trx_start;
--enable_cursor_protocol
select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start;
create or replace table t1 (x int);
--disable_cursor_protocol
select count(*) from mysql.transaction_registry into @tmp;
--enable_cursor_protocol
alter table t1
add column s bigint unsigned as row start,
add column e bigint unsigned as row end,
@@ -61,11 +65,15 @@ alter table t1
add period for system_time(s, e),
add system versioning,
algorithm=copy;
--disable_cursor_protocol
select s from t1 into @trx_start;
--enable_cursor_protocol
select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start;
create or replace table t1 (x int);
--disable_cursor_protocol
select count(*) from mysql.transaction_registry into @tmp;
--enable_cursor_protocol
alter table t1
add column s bigint unsigned as row start,
add column e bigint unsigned as row end,
@@ -124,9 +132,11 @@ commit;
--sleep 0.01
set @ts3= sysdate(6);
--disable_cursor_protocol
select sys_start from t1 where x = 1 into @trx_id1;
select sys_start from t1 where x = 2 into @trx_id2;
select sys_start from t1 where x = 3 into @trx_id3;
--enable_cursor_protocol
select @trx_id1 < @trx_id2, @trx_id2 < @trx_id3;
select @ts1 < @ts2, @ts2 < @ts3;
@@ -267,7 +277,9 @@ set @ts1= now(6);
insert into t1 values (1);
commit;
--disable_cursor_protocol
select row_start from t1 into @trx_id;
--enable_cursor_protocol
select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD;
drop table t1;

View File

@@ -28,11 +28,15 @@ eval create table t1 (
with system versioning;
set timestamp= unix_timestamp('2000-01-01 00:00:00');
insert into t1 values(1, 1, 1);
--disable_cursor_protocol
select sys_trx_start into @tmp1 from t1;
--enable_cursor_protocol
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;
--disable_cursor_protocol
select sys_trx_start into @tmp1 from t1;
--enable_cursor_protocol
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;
@@ -135,14 +139,18 @@ create table t2 like t1;
insert into t1 values (1, "Jeremy", 3000);
insert into t2 values (1, "Jeremy", 4000);
--disable_cursor_protocol
select sys_trx_start into @tmp1 from t1;
select sys_trx_start into @tmp2 from t2;
--enable_cursor_protocol
update t1, t2 set t1.name= "Jerry", t2.name= "Jerry" where t1.id = t2.id and t1.name = "Jeremy";
select @tmp1 < sys_trx_start as A1, name from t1;
select @tmp2 < sys_trx_start as A2, name from t2;
--disable_cursor_protocol
select sys_trx_start into @tmp1 from t1;
select sys_trx_start into @tmp2 from t2;
--enable_cursor_protocol
update t1, t2 set t1.salary= 2500, t2.salary= 2500 where t1.id = t2.id and t1.name = "Jerry";
select @tmp1 = sys_trx_start as B1, salary from t1;
select @tmp2 = sys_trx_start as B2, salary from t2;
@@ -335,7 +343,9 @@ drop tables t1, t2, t3;
create or replace table t1 (x int) with system versioning;
insert t1 values (1);
update t1 set x= 1;
--disable_cursor_protocol
select row_start into @r from t1;
--enable_cursor_protocol
select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r;
drop table t1;

View File

@@ -5,10 +5,14 @@
create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
--disable_cursor_protocol
select now(6) into @t1;
--enable_cursor_protocol
update t1 set x= 2;
--disable_cursor_protocol
select now(6) into @t2;
--enable_cursor_protocol
delete from t1;
set @vt1= concat("create or replace view vt1 as select * from t1 for system_time as of timestamp '", @t1, "'");