Debian Codegraph @

mysql-test/suite/galera/t/galera_transaction_read_only.test

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3
4 #
5 # Ensure that transactions that do not write anything do not cause the wsrep_last_committed counter to advance
6 #
7
8 # Empty transaction
9
10 --connection node_1
11 CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
12
13 --connection node_2
14 --let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
15
16 --connection node_1
17
18 SET AUTOCOMMIT=OFF;
19 START TRANSACTION;
20 COMMIT;
21
22 --connection node_2
23 --let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
24 --disable_query_log
25 --eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff;
26 --enable_query_log
27
28 # START TRANSACTION READ ONLY
29
30 --connection node_2
31 --let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
32
33 --connection node_1
34 START TRANSACTION READ ONLY;
35 SELECT COUNT(*) = 0 FROM t1;
36 COMMIT;
37
38 --connection node_2
39 --let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
40 --disable_query_log
41 --eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff;
42 --enable_query_log
43
44 # Ordinary transaction with only SELECTs
45
46 --connection node_1
47 START TRANSACTION;
48 SELECT COUNT(*) = 0 FROM t1;
49 COMMIT;
50
51 --connection node_2
52 --let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
53 --disable_query_log
54 --eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff;
55 --enable_query_log
56
57 DROP TABLE t1;