Debian Codegraph @

mysql-test/suite/storage_engine/trx/consistent_snapshot.inc

raw
1 #
2 # TRANSACTION WITH CONSISTENT SNAPSHOT
3 #
4
5 --source ../have_engine.inc
6
7 # Save the initial number of concurrent sessions
8 --source include/count_sessions.inc
9
10 --disable_warnings
11 DROP TABLE IF EXISTS t1;
12 --enable_warnings
13
14 connect (con1,localhost,root,,);
15 connect (con2,localhost,root,,);
16
17 connection con1;
18
19 let $create_definition = a $int_col;
20 --source ../create_table.inc
21
22 eval SET SESSION TRANSACTION ISOLATION LEVEL $trx_isolation;
23
24 # While a consistent snapshot transaction is executed,
25 # no external inserts should be visible to the transaction.
26 # But it should only work this way for REPEATABLE-READ and SERIALIZABLE
27
28 START TRANSACTION WITH CONSISTENT SNAPSHOT;
29
30 connection con2;
31 INSERT INTO t1 (a) VALUES (1);
32 if ($mysql_errname)
33 {
34 --echo # INSERT finished with error $mysql_errname
35 }
36
37 connection con1;
38 --echo # If consistent read works on this isolation level ($trx_isolation), the following SELECT should not return the value we inserted (1)
39 SELECT a FROM t1;
40 COMMIT;
41
42 connection default;
43 disconnect con1;
44 disconnect con2;
45 DROP TABLE t1;
46
47 --source include/wait_until_count_sessions.inc
48