| 1 |
--source include/galera_cluster.inc |
| 2 |
--source include/have_innodb.inc |
| 3 |
|
| 4 |
# |
| 5 |
# Test KILL CONNECTION on a transaction that has already replicated some data via SR |
| 6 |
# |
| 7 |
|
| 8 |
SET SESSION wsrep_trx_fragment_size = 1; |
| 9 |
|
| 10 |
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; |
| 11 |
|
| 12 |
SET AUTOCOMMIT=OFF; |
| 13 |
START TRANSACTION; |
| 14 |
|
| 15 |
INSERT INTO t1 VALUES (1); |
| 16 |
INSERT INTO t1 VALUES (2); |
| 17 |
INSERT INTO t1 VALUES (3); |
| 18 |
INSERT INTO t1 VALUES (4); |
| 19 |
INSERT INTO t1 VALUES (5); |
| 20 |
|
| 21 |
# Confirm that the transaction is SR-replicated |
| 22 |
--connection node_2 |
| 23 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 24 |
--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; |
| 25 |
--source include/wait_condition.inc |
| 26 |
|
| 27 |
# Kill the transaction by killing the entire connection |
| 28 |
|
| 29 |
--connection node_1 |
| 30 |
--let $connection_id = `SELECT CONNECTION_ID()` |
| 31 |
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 32 |
--disable_query_log |
| 33 |
--eval KILL CONNECTION $connection_id |
| 34 |
--enable_query_log |
| 35 |
|
| 36 |
# Confirm that the disconnection caused the updates made so far to be removed |
| 37 |
--connection node_2 |
| 38 |
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; |
| 39 |
--source include/wait_condition.inc |
| 40 |
|
| 41 |
# Confirm that the transaction can be reissued in its entirety on the slave without a conflict |
| 42 |
|
| 43 |
SET AUTOCOMMIT=OFF; |
| 44 |
START TRANSACTION; |
| 45 |
|
| 46 |
INSERT INTO t1 VALUES (1); |
| 47 |
INSERT INTO t1 VALUES (2); |
| 48 |
INSERT INTO t1 VALUES (3); |
| 49 |
INSERT INTO t1 VALUES (4); |
| 50 |
INSERT INTO t1 VALUES (5); |
| 51 |
|
| 52 |
COMMIT; |
| 53 |
|
| 54 |
SELECT COUNT(*) = 5 FROM t1; |
| 55 |
|
| 56 |
--connection node_1a |
| 57 |
SELECT COUNT(*) = 5 FROM t1; |
| 58 |
|
| 59 |
DROP TABLE t1; |