summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera_sr/t/galera_sr_rollback_retry.test
blob: c6c443a08288903377e4c2155909b64a1c04b9bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--source include/galera_cluster.inc
--source include/have_innodb.inc

#
# Test that a SR transaction that was just ROLLBACKed on one node can be 
# run against another node without any conflicts
#

--connection node_1
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
SET SESSION wsrep_trx_fragment_size = 1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);

--connection node_2
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
--source include/wait_condition.inc

--connection node_1
ROLLBACK;

#
# After ROLLBACK, the table on node #2 should be empty
#

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc

#
# It should be possible to reissue the same transaction against node #2
#

SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
COMMIT;

SELECT COUNT(*) = 5 FROM t1;

--connection node_1
SELECT COUNT(*) = 5 FROM t1;

DROP TABLE t1;