| 1 |
-- source suite/versioning/common.inc |
| 2 |
|
| 3 |
create table t1( |
| 4 |
id int auto_increment primary key, |
| 5 |
sys_trx_start bigint unsigned as row start invisible, |
| 6 |
sys_trx_end bigint unsigned as row end invisible, |
| 7 |
period for system_time (sys_trx_start, sys_trx_end) |
| 8 |
) |
| 9 |
with system versioning |
| 10 |
engine innodb; |
| 11 |
|
| 12 |
|
| 13 |
# TRT_TRX_ID, TRT_COMMIT_ID, TRT_TRX_SEES # |
| 14 |
|
| 15 |
insert into t1 values (); |
| 16 |
|
| 17 |
--real_sleep 0.01 |
| 18 |
set @ts0= now(6); |
| 19 |
insert into t1 values (); |
| 20 |
|
| 21 |
--disable_cursor_protocol |
| 22 |
--enable_prepare_warnings |
| 23 |
|
| 24 |
select sys_trx_start from t1 where id = last_insert_id() into @tx0; |
| 25 |
--enable_cursor_protocol |
| 26 |
select transaction_id = @tx0 from mysql.transaction_registry |
| 27 |
order by transaction_id desc limit 1; |
| 28 |
|
| 29 |
set @ts1= now(6); |
| 30 |
insert into t1 values (); |
| 31 |
--disable_cursor_protocol |
| 32 |
select sys_trx_start from t1 where id = last_insert_id() into @tx1; |
| 33 |
--enable_cursor_protocol |
| 34 |
select transaction_id = @tx1 from mysql.transaction_registry |
| 35 |
order by transaction_id desc limit 1; |
| 36 |
|
| 37 |
set @ts2= now(6); |
| 38 |
insert into t1 values (); |
| 39 |
--disable_cursor_protocol |
| 40 |
select sys_trx_start from t1 where id = last_insert_id() into @tx2; |
| 41 |
--enable_cursor_protocol |
| 42 |
select transaction_id = @tx2 from mysql.transaction_registry |
| 43 |
order by transaction_id desc limit 1; |
| 44 |
|
| 45 |
set @ts3= now(6); |
| 46 |
|
| 47 |
select |
| 48 |
trt_trx_id(@ts0) < @tx0 as A, |
| 49 |
trt_trx_id(@ts0, true) = @tx0 as B, |
| 50 |
trt_trx_id(@ts1) = @tx0 as C, |
| 51 |
trt_trx_id(@ts1, true) = @tx1 as D, |
| 52 |
trt_trx_id(@ts2) = @tx1 as E, |
| 53 |
trt_trx_id(@ts2, true) = @tx2 as F, |
| 54 |
trt_trx_id(@ts3) = @tx2 as G, |
| 55 |
trt_trx_id(@ts3, true) is null as H; |
| 56 |
|
| 57 |
select |
| 58 |
trt_commit_id(@ts0) < @tx0 as A, |
| 59 |
trt_commit_id(@ts0, true) = trt_commit_id(null, @tx0) as B, |
| 60 |
trt_commit_id(@ts1) = trt_commit_id(null, @tx0) as C, |
| 61 |
trt_commit_id(@ts1, true) = trt_commit_id(null, @tx1) as D, |
| 62 |
trt_commit_id(@ts2) = trt_commit_id(null, @tx1) as E, |
| 63 |
trt_commit_id(@ts2, true) = trt_commit_id(null, @tx2) as F, |
| 64 |
trt_commit_id(@ts3) = trt_commit_id(null, @tx2) as G, |
| 65 |
trt_commit_id(@ts3, true) is null as H; |
| 66 |
|
| 67 |
select |
| 68 |
trt_trx_sees(@tx1, @tx0) as A, |
| 69 |
not trt_trx_sees(@tx0, @tx1) as B, |
| 70 |
trt_trx_sees_eq(@tx1, @tx1) as C, |
| 71 |
not trt_trx_sees(@tx1, @tx1) as D, |
| 72 |
trt_trx_sees(@tx2, 0) as E, |
| 73 |
trt_trx_sees(-1, @tx2) as F; |
| 74 |
|
| 75 |
select trt_trx_sees(0, @tx2); |
| 76 |
|
| 77 |
# TRT_ISO_LEVEL # |
| 78 |
|
| 79 |
set transaction isolation level read uncommitted; |
| 80 |
insert into t1 values (); |
| 81 |
--disable_cursor_protocol |
| 82 |
select sys_trx_start from t1 where id = last_insert_id() into @tx3; |
| 83 |
--enable_cursor_protocol |
| 84 |
select isolation_level = 'READ-UNCOMMITTED' from mysql.transaction_registry where transaction_id = @tx3; |
| 85 |
|
| 86 |
set transaction isolation level read committed; |
| 87 |
insert into t1 values (); |
| 88 |
--disable_cursor_protocol |
| 89 |
select sys_trx_start from t1 where id = last_insert_id() into @tx4; |
| 90 |
--enable_cursor_protocol |
| 91 |
select isolation_level = 'READ-COMMITTED' from mysql.transaction_registry where transaction_id = @tx4; |
| 92 |
|
| 93 |
set transaction isolation level serializable; |
| 94 |
insert into t1 values (); |
| 95 |
--disable_cursor_protocol |
| 96 |
select sys_trx_start from t1 where id = last_insert_id() into @tx5; |
| 97 |
--enable_cursor_protocol |
| 98 |
select isolation_level = 'SERIALIZABLE' from mysql.transaction_registry where transaction_id = @tx5; |
| 99 |
|
| 100 |
set transaction isolation level repeatable read; |
| 101 |
insert into t1 values (); |
| 102 |
--disable_cursor_protocol |
| 103 |
select sys_trx_start from t1 where id = last_insert_id() into @tx6; |
| 104 |
--enable_cursor_protocol |
| 105 |
select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where transaction_id = @tx6; |
| 106 |
|
| 107 |
--disable_prepare_warnings |
| 108 |
|
| 109 |
drop table t1; |
| 110 |
call verify_trt; |
| 111 |
|
| 112 |
-- source suite/versioning/common_finish.inc |