Debian Codegraph @

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

raw
1 #
2 # Tests functions WSREP_LAST_WRITTEN_GTID and WSREP_LAST_SEEN_GTID
3 #
4
5 --source include/galera_cluster.inc
6
7 # Returns domain-server-0 if no transactions have been run
8
9 SELECT WSREP_LAST_WRITTEN_GTID();
10
11 # WSREP_LAST_WRITTEN_GTID() should not be influenced by transactions written
12 # on other nodes or connections
13
14 --connection node_1
15 CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
16 INSERT INTO t1 VALUES (1);
17
18 --disable_query_log
19 --let $wsrep_last_written_id_conn_1 = `SELECT WSREP_LAST_WRITTEN_GTID()`
20 --enable_query_log
21
22 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
23 --connection node_1a
24 --eval SELECT WSREP_LAST_WRITTEN_GTID() != '$wsrep_last_written_id_conn_1' AS wsrep_written_does_not_match_different_conn
25
26 --connection node_2
27 --eval SELECT WSREP_LAST_WRITTEN_GTID() != '$wsrep_last_written_id_conn_1' AS wsrep_written_does_not_match_different_nodes
28
29 # WSREP_LAST_SEEN_GTID() should be influenced by transactions written
30 # on other connections
31
32 --connection node_1
33 INSERT INTO t1 VALUES (1);
34 --disable_query_log
35 --let $wsrep_last_written_id_conn_1 = `SELECT WSREP_LAST_WRITTEN_GTID()`
36 --enable_query_log
37
38 --connection node_2
39 --disable_query_log
40 --eval SELECT WSREP_LAST_SEEN_GTID() = '$wsrep_last_written_id_conn_1' AS wsrep_last_written_seen_id_match
41 --enable_query_log
42
43 # Should not advance while a transaction is in progress
44
45 --connection node_1
46 SET AUTOCOMMIT=OFF;
47 START TRANSACTION;
48
49 --disable_query_log
50 --let $wsrep_last_written_id_before = `SELECT WSREP_LAST_WRITTEN_GTID()`
51 --enable_query_log
52 INSERT INTO t1 VALUES (1);
53 --disable_query_log
54 --eval SELECT WSREP_LAST_SEEN_GTID() = '$wsrep_last_written_id_before'
55 --eval SELECT WSREP_LAST_WRITTEN_GTID() = '$wsrep_last_written_id_before' AS wsrep_last_written_id_match
56 --enable_query_log
57
58 # Should only advance after the transaction has been commited
59
60 COMMIT;
61 --disable_query_log
62 --eval SELECT WSREP_LAST_WRITTEN_GTID() != 'wsrep_last_written_id_before' AS wsrep_last_written_id_advanced
63 --enable_query_log
64 SET AUTOCOMMIT=ON;
65
66 DROP TABLE t1;
67
68 --connection node_2
69 CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");