| 1 |
# |
| 2 |
# This test tests that one successful node wins over two nodes that fail for |
| 3 |
# different reasons |
| 4 |
# |
| 5 |
--source include/galera_cluster.inc |
| 6 |
--source include/have_innodb.inc |
| 7 |
|
| 8 |
--let $galera_connection_name = node_3 |
| 9 |
--let $galera_server_number = 3 |
| 10 |
--source include/galera_connect.inc |
| 11 |
|
| 12 |
--let $node_1=node_1 |
| 13 |
--let $node_2=node_2 |
| 14 |
--let $node_3=node_3 |
| 15 |
--source suite/galera/include/auto_increment_offset_save.inc |
| 16 |
|
| 17 |
# create inconsistency on node 2 |
| 18 |
--connection node_2 |
| 19 |
SET GLOBAL wsrep_on=OFF; |
| 20 |
DROP SCHEMA test; |
| 21 |
|
| 22 |
# create inconsistency on node 3 |
| 23 |
--connection node_3 |
| 24 |
SET GLOBAL wsrep_on=OFF; |
| 25 |
CREATE TABLE t1 (f1 INTEGER); |
| 26 |
|
| 27 |
--connection node_1 |
| 28 |
CREATE TABLE t1 (f1 INTEGER); |
| 29 |
|
| 30 |
# check that nodes 2 and 3 leave the cluster, and node_1 is Primary by itself |
| 31 |
|
| 32 |
--connection node_1 |
| 33 |
SET SESSION wsrep_sync_wait=0; |
| 34 |
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 35 |
--source include/wait_condition.inc |
| 36 |
|
| 37 |
--connection node_2 |
| 38 |
SET SESSION wsrep_sync_wait=0; |
| 39 |
--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; |
| 40 |
--source include/wait_condition.inc |
| 41 |
|
| 42 |
--connection node_3 |
| 43 |
SET SESSION wsrep_sync_wait=0; |
| 44 |
--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; |
| 45 |
--source include/wait_condition.inc |
| 46 |
|
| 47 |
--connection node_1 |
| 48 |
# this is a workaround for "sending install message failed" BUG: |
| 49 |
# https://github.com/codership/galera/issues/174 |
| 50 |
# When it happens, node_1 becomes non-prim |
| 51 |
SET GLOBAL wsrep_provider_options='pc.bootstrap=YES'; |
| 52 |
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; |
| 53 |
--source include/wait_condition.inc |
| 54 |
|
| 55 |
# restart nodes 2 and 3, since they failed |
| 56 |
|
| 57 |
--connection node_2 |
| 58 |
# need to reinitialize connection due to a "Bad handshake" bug. |
| 59 |
# we reconnect using the 'mysql' database as 'test' was dropped. |
| 60 |
--disconnect node_2 |
| 61 |
--connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2 |
| 62 |
--source include/restart_mysqld.inc |
| 63 |
|
| 64 |
--connection node_3 |
| 65 |
--source include/restart_mysqld.inc |
| 66 |
|
| 67 |
--connection node_1 |
| 68 |
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 69 |
--source include/wait_condition.inc |
| 70 |
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; |
| 71 |
--source include/wait_condition.inc |
| 72 |
|
| 73 |
DROP TABLE test.t1; |
| 74 |
|
| 75 |
--source suite/galera/include/auto_increment_offset_restore.inc |
| 76 |
|
| 77 |
--connection node_2 |
| 78 |
CALL mtr.add_suppression("Inconsistent by consensus\\."); |
| 79 |
CALL mtr.add_suppression("Error_code: 1049"); |
| 80 |
CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); |
| 81 |
CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); |
| 82 |
CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); |
| 83 |
|
| 84 |
--connection node_3 |
| 85 |
CALL mtr.add_suppression("Inconsistent by consensus\\."); |
| 86 |
CALL mtr.add_suppression("Error_code: 1050"); |
| 87 |
CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); |
| 88 |
CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); |
| 89 |
CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); |