| 1 |
# |
| 2 |
# This test performs two dependent updates on two nodes and checks the results on the third where |
| 3 |
# parallel apply is enabled. |
| 4 |
# |
| 5 |
|
| 6 |
--source include/galera_cluster.inc |
| 7 |
--source include/have_innodb.inc |
| 8 |
--source include/have_debug.inc |
| 9 |
--source include/have_debug_sync.inc |
| 10 |
|
| 11 |
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 |
| 12 |
--connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 13 |
|
| 14 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; |
| 15 |
INSERT INTO t1 VALUES (1); |
| 16 |
|
| 17 |
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` |
| 18 |
|
| 19 |
--connection node_3 |
| 20 |
SET GLOBAL wsrep_slave_threads = 2; |
| 21 |
|
| 22 |
--connection node_1_ctrl |
| 23 |
SET SESSION wsrep_sync_wait=0; |
| 24 |
|
| 25 |
# |
| 26 |
# We will make the following UPDATE depend on the UPDATE below |
| 27 |
# |
| 28 |
--connection node_1 |
| 29 |
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; |
| 30 |
--send UPDATE t1 SET f1 = f1 + 10; |
| 31 |
|
| 32 |
--connection node_1_ctrl |
| 33 |
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; |
| 34 |
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; |
| 35 |
|
| 36 |
--connection node_2 |
| 37 |
--send UPDATE t1 SET f1 = f1 + 100; |
| 38 |
|
| 39 |
# |
| 40 |
# Let's wait for the first UPDATE the be BF aborted |
| 41 |
# |
| 42 |
--connection node_1_ctrl |
| 43 |
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; |
| 44 |
|
| 45 |
# |
| 46 |
# and make sure the second has committed |
| 47 |
# |
| 48 |
--let $wait_condition = SELECT VARIABLE_VALUE > $wsrep_last_committed_before FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' |
| 49 |
--source include/wait_condition.inc |
| 50 |
|
| 51 |
# |
| 52 |
# now release the first UPDATE. |
| 53 |
# |
| 54 |
SET GLOBAL debug_dbug = NULL; |
| 55 |
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; |
| 56 |
|
| 57 |
# |
| 58 |
# Both UPDATEs should succeed. |
| 59 |
# |
| 60 |
--connection node_1 |
| 61 |
--reap |
| 62 |
|
| 63 |
--connection node_2 |
| 64 |
--reap |
| 65 |
|
| 66 |
--connection node_3 |
| 67 |
SELECT f1 = 111 FROM t1; |
| 68 |
SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); |
| 69 |
|
| 70 |
SET GLOBAL wsrep_slave_threads = DEFAULT; |
| 71 |
|
| 72 |
DROP TABLE t1; |
| 73 |
|
| 74 |
--connection node_1 |
| 75 |
SET DEBUG_SYNC= 'RESET'; |