| 1 |
# |
| 2 |
# Check that wsrep position is updated in innodb after |
| 3 |
# a dummy write set is applied. |
| 4 |
# |
| 5 |
|
| 6 |
--source include/galera_cluster.inc |
| 7 |
--source include/have_debug.inc |
| 8 |
--source include/have_debug_sync.inc |
| 9 |
--source include/galera_have_debug_sync.inc |
| 10 |
|
| 11 |
--let $node_1=node_1 |
| 12 |
--let $node_2=node_2 |
| 13 |
--source include/auto_increment_offset_save.inc |
| 14 |
|
| 15 |
# |
| 16 |
# Cause a certification failure. The INSERT on in node_1 will fail certification, |
| 17 |
# and will result in a dummy writeset on node_2. This is going to be the last |
| 18 |
# writeset before shutting down node_2. |
| 19 |
# |
| 20 |
--connection node_1 |
| 21 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; |
| 22 |
SET GLOBAL wsrep_slave_threads = 2; |
| 23 |
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; |
| 24 |
|
| 25 |
--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` |
| 26 |
|
| 27 |
--connection node_2 |
| 28 |
--send INSERT INTO t1 VALUES (1, 'node_2'); |
| 29 |
|
| 30 |
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 31 |
--connection node_1a |
| 32 |
SET SESSION wsrep_sync_wait=0; |
| 33 |
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; |
| 34 |
|
| 35 |
--connection node_1 |
| 36 |
SET SESSION wsrep_sync_wait = 0; |
| 37 |
SET SESSION wsrep_retry_autocommit = 0; |
| 38 |
|
| 39 |
--send INSERT INTO t1 VALUES (1, 'node_1'); |
| 40 |
|
| 41 |
--connection node_1a |
| 42 |
--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' |
| 43 |
--source include/wait_condition.inc |
| 44 |
|
| 45 |
SET GLOBAL DEBUG_DBUG = ""; |
| 46 |
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; |
| 47 |
|
| 48 |
--connection node_1 |
| 49 |
--error ER_LOCK_DEADLOCK |
| 50 |
--reap |
| 51 |
|
| 52 |
--connection node_2 |
| 53 |
--reap |
| 54 |
|
| 55 |
# |
| 56 |
# Keep track of the current position in variable $expected_position |
| 57 |
# |
| 58 |
--let $expected_position_uuid = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'` |
| 59 |
--let $expected_position_seqno = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_last_committed'` |
| 60 |
|
| 61 |
--let $expected_position = $expected_position_uuid:$expected_position_seqno |
| 62 |
|
| 63 |
# |
| 64 |
# Shutdown node 2 |
| 65 |
# |
| 66 |
--connection node_2 |
| 67 |
--source include/shutdown_mysqld.inc |
| 68 |
|
| 69 |
--connection node_1 |
| 70 |
SET SESSION wsrep_sync_wait = 0; |
| 71 |
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 72 |
--source include/wait_condition.inc |
| 73 |
|
| 74 |
# |
| 75 |
# Check that start position matches the position we recorded |
| 76 |
# before shutdown in $expected_position |
| 77 |
# |
| 78 |
--let $galera_wsrep_recover_server_id = 2 |
| 79 |
--source suite/galera/include/galera_wsrep_recover.inc |
| 80 |
|
| 81 |
if ($galera_wsrep_start_position != $expected_position) |
| 82 |
{ |
| 83 |
--exec echo "expected position $expected_position" |
| 84 |
--exec echo "recover position $galera_wsrep_start_position" |
| 85 |
die("Expected position and recover position did not match"); |
| 86 |
} |
| 87 |
|
| 88 |
# |
| 89 |
# Restart the node 2 and cleanup |
| 90 |
# |
| 91 |
--connection node_2 |
| 92 |
--source include/start_mysqld.inc |
| 93 |
|
| 94 |
--connection node_1 |
| 95 |
DROP TABLE t1; |
| 96 |
SET GLOBAL wsrep_slave_threads = DEFAULT; |
| 97 |
--source include/auto_increment_offset_restore.inc |
| 98 |
|
| 99 |
--connection node_1a |
| 100 |
SET GLOBAL DEBUG_DBUG=NULL; |
| 101 |
SET DEBUG_SYNC = "RESET"; |