| 1 |
--source include/galera_cluster.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
--source include/have_debug_sync.inc |
| 4 |
--source include/galera_have_debug_sync.inc |
| 5 |
--source include/have_log_bin.inc |
| 6 |
|
| 7 |
# |
| 8 |
# Test case to stress the order of wsrep XID checkpointing. |
| 9 |
# |
| 10 |
# In buggy version, the transaction which failed certification can |
| 11 |
# rush to record wsrep XID checkpoint before the offending applier, |
| 12 |
# causing assert in innodb sys header update routine |
| 13 |
# |
| 14 |
|
| 15 |
--echo # |
| 16 |
--echo # test the order of wsrep XID storage after certifiation failure |
| 17 |
--echo # |
| 18 |
|
| 19 |
--connection node_1 |
| 20 |
set session wsrep_sync_wait=0; |
| 21 |
|
| 22 |
create table t1 (i int primary key, j int); |
| 23 |
|
| 24 |
insert into t1 values (4, 0); |
| 25 |
|
| 26 |
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 |
| 27 |
--connection node_2b |
| 28 |
set session wsrep_sync_wait=0; |
| 29 |
# wait for the last insert to be replicated from node 1 |
| 30 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1; |
| 31 |
--source include/wait_condition.inc |
| 32 |
|
| 33 |
# block applier before applying |
| 34 |
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; |
| 35 |
|
| 36 |
# send update from node 1, it will pause in the sync point |
| 37 |
--connection node_1 |
| 38 |
UPDATE test.t1 set j=1 where i=4; |
| 39 |
|
| 40 |
--connection node_2b |
| 41 |
# wait until applier has reached the sync point |
| 42 |
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; |
| 43 |
|
| 44 |
# look number of cert failures so far, and expect one more to happen |
| 45 |
--let $expected_cert_failures = `SELECT VARIABLE_VALUE+1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` |
| 46 |
|
| 47 |
# Inject a conflicting update in node 2, it should fail in certification |
| 48 |
--connection node_2 |
| 49 |
set session wsrep_sync_wait=0; |
| 50 |
set session wsrep_retry_autocommit=0; |
| 51 |
--send UPDATE test.t1 SET j=2 WHERE i=4 |
| 52 |
|
| 53 |
--connection node_2b |
| 54 |
# wait until the update has hit certification failure |
| 55 |
|
| 56 |
--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' |
| 57 |
--source include/wait_condition.inc |
| 58 |
|
| 59 |
# release the applier |
| 60 |
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; |
| 61 |
|
| 62 |
SET GLOBAL debug_dbug = ""; |
| 63 |
SET DEBUG_SYNC = "RESET"; |
| 64 |
|
| 65 |
--connection node_2 |
| 66 |
--error ER_LOCK_DEADLOCK |
| 67 |
--reap |
| 68 |
select * from t1; |
| 69 |
|
| 70 |
DROP TABLE t1; |