1
by brian
clean slate |
1 |
-- source include/have_innodb.inc
|
2 |
||
3 |
--disable_warnings
|
|
4 |
drop table if exists t1; |
|
5 |
--enable_warnings
|
|
6 |
||
7 |
connect (con1,localhost,root,,); |
|
8 |
connect (con2,localhost,root,,); |
|
9 |
||
10 |
### Test 1: |
|
11 |
### - While a consistent snapshot transaction is executed, |
|
12 |
### no external inserts should be visible to the transaction. |
|
13 |
||
14 |
connection con1; |
|
15 |
create table t1 (a int) engine=innodb; |
|
16 |
start transaction with consistent snapshot; |
|
17 |
||
18 |
connection con2; |
|
19 |
insert into t1 values(1); |
|
20 |
||
21 |
connection con1; |
|
22 |
select * from t1; # if consistent snapshot was set as expected, we |
|
23 |
# should see nothing. |
|
24 |
commit; |
|
25 |
||
26 |
### Test 2: |
|
27 |
### - For any non-consistent snapshot transaction, external |
|
28 |
### committed inserts should be visible to the transaction. |
|
29 |
||
30 |
delete from t1; |
|
31 |
start transaction; # Now we omit WITH CONSISTENT SNAPSHOT |
|
32 |
||
33 |
connection con2; |
|
34 |
insert into t1 values(1); |
|
35 |
||
36 |
connection con1; |
|
37 |
select * from t1; # if consistent snapshot was not set, as expected, we |
|
38 |
# should see 1. |
|
39 |
commit; |
|
40 |
||
41 |
drop table t1; |
|
42 |
||
43 |
# End of 4.1 tests |