mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
98 lines
3.1 KiB
Text
98 lines
3.1 KiB
Text
-- source suite/versioning/common.inc
|
|
|
|
create table t1(
|
|
id int auto_increment primary key,
|
|
sys_trx_start bigint unsigned as row start invisible,
|
|
sys_trx_end bigint unsigned as row end invisible,
|
|
period for system_time (sys_trx_start, sys_trx_end)
|
|
)
|
|
with system versioning
|
|
engine innodb;
|
|
|
|
|
|
# TRT_TRX_ID, TRT_COMMIT_ID, TRT_TRX_SEES #
|
|
|
|
insert into t1 values ();
|
|
|
|
--real_sleep 0.01
|
|
set @ts0= now(6);
|
|
insert into t1 values ();
|
|
|
|
--enable_prepare_warnings
|
|
|
|
select sys_trx_start from t1 where id = last_insert_id() into @tx0;
|
|
select transaction_id = @tx0 from mysql.transaction_registry
|
|
order by transaction_id desc limit 1;
|
|
|
|
set @ts1= now(6);
|
|
insert into t1 values ();
|
|
select sys_trx_start from t1 where id = last_insert_id() into @tx1;
|
|
select transaction_id = @tx1 from mysql.transaction_registry
|
|
order by transaction_id desc limit 1;
|
|
|
|
set @ts2= now(6);
|
|
insert into t1 values ();
|
|
select sys_trx_start from t1 where id = last_insert_id() into @tx2;
|
|
select transaction_id = @tx2 from mysql.transaction_registry
|
|
order by transaction_id desc limit 1;
|
|
|
|
set @ts3= now(6);
|
|
|
|
select
|
|
trt_trx_id(@ts0) < @tx0 as A,
|
|
trt_trx_id(@ts0, true) = @tx0 as B,
|
|
trt_trx_id(@ts1) = @tx0 as C,
|
|
trt_trx_id(@ts1, true) = @tx1 as D,
|
|
trt_trx_id(@ts2) = @tx1 as E,
|
|
trt_trx_id(@ts2, true) = @tx2 as F,
|
|
trt_trx_id(@ts3) = @tx2 as G,
|
|
trt_trx_id(@ts3, true) is null as H;
|
|
|
|
select
|
|
trt_commit_id(@ts0) < @tx0 as A,
|
|
trt_commit_id(@ts0, true) = trt_commit_id(null, @tx0) as B,
|
|
trt_commit_id(@ts1) = trt_commit_id(null, @tx0) as C,
|
|
trt_commit_id(@ts1, true) = trt_commit_id(null, @tx1) as D,
|
|
trt_commit_id(@ts2) = trt_commit_id(null, @tx1) as E,
|
|
trt_commit_id(@ts2, true) = trt_commit_id(null, @tx2) as F,
|
|
trt_commit_id(@ts3) = trt_commit_id(null, @tx2) as G,
|
|
trt_commit_id(@ts3, true) is null as H;
|
|
|
|
select
|
|
trt_trx_sees(@tx1, @tx0) as A,
|
|
not trt_trx_sees(@tx0, @tx1) as B,
|
|
trt_trx_sees_eq(@tx1, @tx1) as C,
|
|
not trt_trx_sees(@tx1, @tx1) as D,
|
|
trt_trx_sees(@tx2, 0) as E,
|
|
trt_trx_sees(-1, @tx2) as F;
|
|
|
|
select trt_trx_sees(0, @tx2);
|
|
|
|
# TRT_ISO_LEVEL #
|
|
|
|
set transaction isolation level read uncommitted;
|
|
insert into t1 values ();
|
|
select sys_trx_start from t1 where id = last_insert_id() into @tx3;
|
|
select isolation_level = 'READ-UNCOMMITTED' from mysql.transaction_registry where transaction_id = @tx3;
|
|
|
|
set transaction isolation level read committed;
|
|
insert into t1 values ();
|
|
select sys_trx_start from t1 where id = last_insert_id() into @tx4;
|
|
select isolation_level = 'READ-COMMITTED' from mysql.transaction_registry where transaction_id = @tx4;
|
|
|
|
set transaction isolation level serializable;
|
|
insert into t1 values ();
|
|
select sys_trx_start from t1 where id = last_insert_id() into @tx5;
|
|
select isolation_level = 'SERIALIZABLE' from mysql.transaction_registry where transaction_id = @tx5;
|
|
|
|
set transaction isolation level repeatable read;
|
|
insert into t1 values ();
|
|
select sys_trx_start from t1 where id = last_insert_id() into @tx6;
|
|
select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where transaction_id = @tx6;
|
|
|
|
--disable_prepare_warnings
|
|
|
|
drop table t1;
|
|
call verify_trt;
|
|
|
|
-- source suite/versioning/common_finish.inc
|