diff options
Diffstat (limited to 'mysql-test/suite/galera_3nodes')
101 files changed, 6917 insertions, 0 deletions
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def new file mode 100644 index 00000000..d0e68295 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -0,0 +1,21 @@ +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : MDEV-<xxxx> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## + +galera_2_cluster : MDEV-29877 Galera test failure on galera_2_cluster +galera_gtid_2_cluster : MDEV-29877 Galera test failure on galera_2_cluster +galera_ipv6_mariabackup : MDEV-24097 +galera_ipv6_mariabackup_section : MDEV-24097, MDEV-22195 +galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed +galera_ssl_reload : MDEV-30172 At line 50: mysql_shutdown failed +# Opensuse/suse/rocky9/rocky84/rhel9/rhel8-ppc64le .. - all same IPv6 isn't configured right or skipping or galera +galera_ipv6_rsync : Can't connect to server on '::1' (115) +galera_ipv6_rsync_section : Can't connect to server on '::1' (115) diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf new file mode 100644 index 00000000..cd7a892f --- /dev/null +++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf @@ -0,0 +1,103 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld] +loose-innodb +log-bin=mysqld-bin +log-slave-updates +binlog-format=row +innodb-autoinc-lock-mode=2 +default-storage-engine=innodb +wsrep_gtid_mode=1 +gtid_ignore_duplicates +auto_increment_increment=3 + +wsrep-provider=@ENV.WSREP_PROVIDER +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +wsrep-sync-wait=15 + +[mysqld.1] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' + +[mysqld.2] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' + +[mysqld.3] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' + +[mysqld.4] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' + +[mysqld.5] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.5.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.5.#sst_port' + +[mysqld.6] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.6.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port' + +[ENV] +NODE_MYPORT_1= @mysqld.1.port +NODE_MYSOCK_1= @mysqld.1.socket + +NODE_MYPORT_2= @mysqld.2.port +NODE_MYSOCK_2= @mysqld.2.socket + +NODE_MYPORT_3= @mysqld.3.port +NODE_MYSOCK_3= @mysqld.3.socket + +NODE_MYPORT_4= @mysqld.4.port +NODE_MYSOCK_4= @mysqld.4.socket + +NODE_MYPORT_5= @mysqld.5.port +NODE_MYSOCK_5= @mysqld.5.socket + +NODE_MYPORT_6= @mysqld.6.port +NODE_MYSOCK_6= @mysqld.6.socket diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf new file mode 100644 index 00000000..a7dd4d21 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -0,0 +1,57 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld] +loose-innodb +binlog-format=row +innodb-autoinc-lock-mode=2 +default-storage-engine=innodb +auto_increment_increment=3 + +wsrep-provider=@ENV.WSREP_PROVIDER +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +wsrep-sync-wait=15 + +[mysqld.1] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' + +[mysqld.2] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' + +[mysqld.3] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' + +[ENV] +NODE_MYPORT_1= @mysqld.1.port +NODE_MYSOCK_1= @mysqld.1.socket + +NODE_MYPORT_2= @mysqld.2.port +NODE_MYSOCK_2= @mysqld.2.socket + +NODE_MYPORT_3= @mysqld.3.port +NODE_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/galera_3nodes/include/galera_resume.inc b/mysql-test/suite/galera_3nodes/include/galera_resume.inc new file mode 100644 index 00000000..af8f2b95 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/include/galera_resume.inc @@ -0,0 +1,9 @@ +--echo Resuming node ... +--perl + my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'}; + my $mysqld_pid = `cat $pid_filename`; + chomp($mysqld_pid); + system("kill -SIGCONT $mysqld_pid"); + exit(0); +EOF + diff --git a/mysql-test/suite/galera_3nodes/include/have_garbd.inc b/mysql-test/suite/galera_3nodes/include/have_garbd.inc new file mode 100644 index 00000000..560372c2 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/include/have_garbd.inc @@ -0,0 +1,3 @@ +if (!$MTR_GARBD_EXE) { + skip Needs garbd; +} diff --git a/mysql-test/suite/galera_3nodes/my.cnf b/mysql-test/suite/galera_3nodes/my.cnf new file mode 100644 index 00000000..bb25b95c --- /dev/null +++ b/mysql-test/suite/galera_3nodes/my.cnf @@ -0,0 +1 @@ +!include galera_3nodes.cnf diff --git a/mysql-test/suite/galera_3nodes/r/GAL-501.result b/mysql-test/suite/galera_3nodes/r/GAL-501.result new file mode 100644 index 00000000..850fb6f3 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/GAL-501.result @@ -0,0 +1,20 @@ +connection node_2; +connection node_1; +connection node_3; +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +VARIABLE_VALUE LIKE '%[::1]%' +1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 3 +1 +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/GCF-354.result b/mysql-test/suite/galera_3nodes/r/GCF-354.result new file mode 100644 index 00000000..2b1399e6 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/GCF-354.result @@ -0,0 +1,55 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_2; +SET SESSION wsrep_on=OFF; +DROP SCHEMA test; +connection node_3; +SET SESSION wsrep_on=OFF; +CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; +connection node_1; +CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; +INSERT INTO test.t1 values (1); +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Primary +DROP TABLE test.t1; +connection node_2; +SET SESSION wsrep_sync_wait=0; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Disconnected +disconnect node_2; +connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2; +Killing server ... +connection node_2; +Starting node_2 +# restart +connection node_3; +SET SESSION wsrep_sync_wait=0; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Disconnected +disconnect node_3; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +Killing server ... +connection node_3; +Starting node_3 +# restart +connection node_1; +Nodes 2 and 3 started +connection node_2; +USE test; +Node 2 synced +CALL mtr.add_suppression("Slave SQL: Error 'Unknown database 'test'' on query. Default database: 'test'. Query: 'CREATE TABLE test.t1 \\\(f1 INTEGER\\\)', Error_code: 1049"); +CALL mtr.add_suppression("Query apply failed"); +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on .*"); +CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +connection node_3; +Node 3 synced +CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query. Default database: 'test'. Query: 'CREATE TABLE test.t1 \\\(f1 INTEGER\\\)', Error_code: 1050"); +CALL mtr.add_suppression("Query apply failed"); +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on .*"); +CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); diff --git a/mysql-test/suite/galera_3nodes/r/GCF-363.result b/mysql-test/suite/galera_3nodes/r/GCF-363.result new file mode 100644 index 00000000..a7b811f7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/GCF-363.result @@ -0,0 +1,49 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB; +SET GLOBAL wsrep_on=OFF; +INSERT INTO t1 VALUES (1, 'a'); +SET GLOBAL wsrep_on=ON; +connection node_2; +SET GLOBAL wsrep_on=OFF; +INSERT INTO t1 VALUES (1, 'a'); +SET GLOBAL wsrep_on=ON; +connection node_3; +INSERT INTO t1 VALUES (1, 'b'); +SET SESSION wsrep_sync_wait = 0; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Disconnected +connection node_1; +connection node_3; +SET SESSION wsrep_on=OFF; +# restart +SET SESSION wsrep_on=ON; +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +connection node_3; +SELECT * FROM t1; +f1 f2 +1 a +DROP TABLE t1; +connection node_1; +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 155, Error_code: 1062"); +CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno "); +connection node_2; +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 155, Error_code: 1062"); +CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno "); +connection node_3; +CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster."); +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); +CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +connection node_1; diff --git a/mysql-test/suite/galera_3nodes/r/GCF-376.result b/mysql-test/suite/galera_3nodes/r/GCF-376.result new file mode 100644 index 00000000..7b535a01 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/GCF-376.result @@ -0,0 +1,91 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE test.t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB; +connection node_2; +SET GLOBAL wsrep_on=OFF; +INSERT INTO t1 VALUES (1, 'a'); +SET GLOBAL wsrep_on=ON; +LOCK TABLE t1 WRITE; +connection node_1; +INSERT INTO t1 VALUES (1, 'b'); +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait=0; +connection node_3; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 2 +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Primary +connection node_2; +UNLOCK TABLES; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +connection node_1; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status non-Primary +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 1 +connection node_2; +SET SESSION wsrep_sync_wait=0; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Disconnected +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 0 +SET GLOBAL wsrep_on=OFF; +SELECT * FROM t1; +f1 f2 +1 a +connection node_3; +SET SESSION wsrep_sync_wait=0; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Primary +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 1 +SELECT * FROM t1; +f1 f2 +1 b +# reconnect node #1 +connection node_1; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +# reconnect node #2 +connection node_2; +# restart +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Primary +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +SELECT * FROM t1; +f1 f2 +1 b +connection node_1; +SELECT * FROM t1; +f1 f2 +1 b +connection node_2; +SELECT * FROM t1; +f1 f2 +1 b +connection node_3; +SELECT * FROM t1; +f1 f2 +1 b +DROP TABLE t1; +connection node_2; +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos (.*), Error_code: 1062"); +CALL mtr.add_suppression("WSREP: Event (.*) Write_rows_v1 apply failed: 121, seqno "); +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on (.*)"); +CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Failed to apply write set: "); diff --git a/mysql-test/suite/galera_3nodes/r/MDEV-29171.result b/mysql-test/suite/galera_3nodes/r/MDEV-29171.result new file mode 100644 index 00000000..151be86d --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/MDEV-29171.result @@ -0,0 +1,41 @@ +connection node_2; +connection node_1; +connection node_1; +select @@wsrep_gtid_domain_id,@@wsrep_node_name; +@@wsrep_gtid_domain_id @@wsrep_node_name +100 node1 +connection node_2; +select @@wsrep_gtid_domain_id,@@wsrep_node_name; +@@wsrep_gtid_domain_id @@wsrep_node_name +100 node2 +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; +select @@wsrep_gtid_domain_id,@@wsrep_node_name; +@@wsrep_gtid_domain_id @@wsrep_node_name +100 node3 +connection node_3; +connection node_2; +connection node_1; +connection node_1; +# restart: --wsrep_new_cluster --wsrep_gtid_domain_id=200 +show variables like 'wsrep_gtid_domain_id'; +Variable_name Value +wsrep_gtid_domain_id 200 +connection node_2; +# restart +show variables like 'wsrep_gtid_domain_id'; +Variable_name Value +wsrep_gtid_domain_id 200 +connection node_3; +# restart: --wsrep_sst_donor=node2 +show variables like 'wsrep_gtid_domain_id'; +Variable_name Value +wsrep_gtid_domain_id 200 +connection node_1; +set global wsrep_gtid_domain_id=100; +connection node_2; +set global wsrep_gtid_domain_id=100; +CALL mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +connection node_3; +set global wsrep_gtid_domain_id=100; +CALL mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); diff --git a/mysql-test/suite/galera_3nodes/r/galera-features#119.result b/mysql-test/suite/galera_3nodes/r/galera-features#119.result new file mode 100644 index 00000000..aa49e4e5 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera-features#119.result @@ -0,0 +1,32 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +CREATE TABLE test.t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_2; +SET wsrep_on=OFF; +INSERT INTO t1 VALUES (1); +LOCK TABLE t1 WRITE; +SET GLOBAL wsrep_sync_wait=0; +connection node_1; +INSERT INTO t1 VALUES (1); +SET GLOBAL wsrep_sync_wait=0; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +connection node_3; +connection node_2; +UNLOCK TABLES; +connection node_3; +connection node_1; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SET GLOBAL wsrep_sync_wait=15; +DROP TABLE test.t1; +connection node_2; +Killing server ... +# restart +connection node_2; +CALL mtr.add_suppression("Inconsistent by consensus."); +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST"); +CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster..."); +CALL mtr.add_suppression("WSREP: Failed to apply write set: "); diff --git a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result new file mode 100644 index 00000000..5214eafa --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result @@ -0,0 +1,93 @@ +connection node_2; +connection node_1; +connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5; +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_4; +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;; +START SLAVE; +include/wait_for_slave_to_start.inc +connection node_1; +CREATE TABLE t1(c1 INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INTEGER); +INSERT INTO t1(c2) VALUES(1); +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6; +connection node_6; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +connection node_2; +ALTER TABLE t1 ADD COLUMN t3 INTEGER; +Node 2 column number AFTER ALTER +SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; +COUNT(*) = 3 +1 +connection node_3; +Node 3 column number AFTER ALTER +SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; +COUNT(*) = 3 +1 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +Node 4 column number AFTER ALTER +SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; +COUNT(*) = 3 +1 +connection node_6; +Node 6 column number AFTER ALTER +SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; +COUNT(*) = 3 +1 +connection node_2; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +connection node_1; +connection node_4; +connection node_6; +connection node_1; +DROP TABLE t1; +connection node_4; +STOP SLAVE; +RESET SLAVE; +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; +SET GLOBAL GTID_SLAVE_POS=""; +connection node_1; +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; +connection node_2; +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); +connection node_3; +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); +connection node_5; +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); +connection node_6; +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_allowlist.result b/mysql-test/suite/galera_3nodes/r/galera_allowlist.result new file mode 100644 index 00000000..471444d8 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_allowlist.result @@ -0,0 +1,35 @@ +connection node_2; +connection node_1; +SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist; +COUNT(*) = 3 +1 +connection node_2; +SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist; +COUNT(*) = 3 +1 +connection node_3; +SET @@global.wsrep_desync = 1; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +connection node_1; +DELETE FROM mysql.wsrep_allowlist WHERE ip LIKE '127.0.0.3'; +SELECT COUNT(*) = 2 FROM mysql.wsrep_allowlist; +COUNT(*) = 2 +1 +connection node_2; +SELECT COUNT(*) = 2 FROM mysql.wsrep_allowlist; +COUNT(*) = 2 +1 +connection node_3; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SET @@global.wsrep_desync = 0; +connection node_1; +INSERT INTO mysql.wsrep_allowlist(ip) VALUES ('127.0.0.3'); +connection node_3; +# restart +connection node_1; +CALL mtr.add_suppression('WSREP: Connection not allowed'); +connection node_2; +CALL mtr.add_suppression('WSREP: Connection not allowed'); +connection node_3; +CALL mtr.add_suppression('WSREP: Ignoring lack of quorum'); diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result new file mode 100644 index 00000000..6393a30d --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result @@ -0,0 +1,30 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 3 +1 +connection node_3; +SET GLOBAL wsrep_cluster_address = ''; +connection node_1; +INSERT INTO t1 VALUES (2); +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +COMMIT; +connection node_2; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +connection node_3; +connection node_1; +DROP TABLE t1; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result new file mode 100644 index 00000000..d43b42be --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result @@ -0,0 +1,19 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +connection node_2; +INSERT INTO t1 VALUES (1); +connection node_3; +INSERT INTO t2 VALUES (1); +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_3; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_3nodes/r/galera_dynamic_protocol.result b/mysql-test/suite/galera_3nodes/r/galera_dynamic_protocol.result new file mode 100644 index 00000000..a6002b56 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_dynamic_protocol.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +connection node_3; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +connection node_1; +connection node_2; +connection node_2; +# restart: with restart_parameters +INSERT INTO t1 VALUES (2); +connection node_3; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result new file mode 100644 index 00000000..1910106c --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result @@ -0,0 +1,38 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S'; +connection node_2; +SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S'; +connection node_3; +connection node_3; +Suspending node ... +connection node_1; +SET SESSION wsrep_sync_wait=0; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +CREATE TABLE t1 (f1 INTEGER) engine=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +SET SESSION wsrep_sync_wait=0; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +connection node_3; +Resuming node ... +CALL mtr.add_suppression("WSREP: gcs_caused"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg"); +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd.result b/mysql-test/suite/galera_3nodes/r/galera_garbd.result new file mode 100644 index 00000000..ebc5fdf3 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result @@ -0,0 +1,33 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_1; +connection node_2; +connection node_3; +Killing node #3 to free ports for garbd ... +connection node_3; +connection node_1; +Starting garbd ... +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1); +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +Killing garbd ... +connection node_1; +INSERT INTO t1 VALUES (2); +connection node_2; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +DROP TABLE t1; +Restarting node #3 to satisfy MTR's end-of-test checks +connection node_3; +connection node_1; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); +connection node_2; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); +connection node_3; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result new file mode 100644 index 00000000..4a5e9a45 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result @@ -0,0 +1,41 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +SET GLOBAL innodb_max_dirty_pages_pct=99; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=99; +connection node_1; +CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +connection node_2; +Killing node #3 to free ports for garbd ... +connection node_3; +connection node_1; +SET GLOBAL debug_dbug = "+d,sync.wsrep_donor_state"; +Starting garbd ... +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_donor_state_reached"; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0; +SET GLOBAL innodb_max_dirty_pages_pct=0; +SET SESSION debug_sync = "now SIGNAL signal.wsrep_donor_state"; +SET GLOBAL debug_dbug = ""; +SET debug_sync='RESET'; +connection node_2; +Killing garbd ... +connection node_1; +connection node_2; +DROP TABLE t1; +DROP TABLE ten; +Restarting node #3 to satisfy MTR's end-of-test checks +connection node_3; +connection node_1; +connection node_1; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); +connection node_2; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); +connection node_3; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result new file mode 100644 index 00000000..7d4751e7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result @@ -0,0 +1,323 @@ +connection node_2; +connection node_1; +connection node_1; +cluster 1 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +connection node_2; +cluster 1 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; +cluster 1 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_4; +cluster 2 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5; +connection node_5; +cluster 2 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6; +connection node_6; +cluster 2 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +connection node_1; +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +connection node_4; +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +cluster 1 node 1 +connection node_1; +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2 +#wait for sync cluster 1 and 2 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +cluster 2 node 1 +connection node_4; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2 +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +select * from t1; +cluster_domain_id node_server_id seq_no +1 11 2 +2 21 1 +#wait for sync cluster 1 and 2 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +cluster 1 node 2 +connection node_2; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-3,2-21-1 +#wait for sync cluster 1 and 2 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +cluster 1 node 3 +connection node_3; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-3,2-21-1 +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-1 +#wait for sync cluster 1 and 2 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +cluster 2 node 2 +connection node_5; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-1 +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-2 +#wait for sync cluster 2 and 1 +connection node_4; +include/save_master_gtid.inc +connection node_1; +include/sync_with_master_gtid.inc +cluster 2 node 3 +connection node_6; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-2 +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-3 +#wait for sync cluster 2 and 1 +connection node_4; +include/save_master_gtid.inc +connection node_1; +include/sync_with_master_gtid.inc +cluster 1 node 1 +connection node_1; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-3 +drop table t1; +stop slave; +reset slave; +cluster 2 node 1 +connection node_4; +stop slave; +reset slave; +cluster 1 node 1 +connection node_1; +change master to master_use_gtid=no, ignore_server_ids=(); +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +set global GTID_SLAVE_POS=""; +cluster 2 node 1 +connection node_4; +change master to master_use_gtid=no, ignore_server_ids=(); +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +set global GTID_SLAVE_POS=""; +connection node_2; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +connection node_3; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +connection node_5; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +connection node_6; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +connection node_1; +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +connection node_4; +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +cluster 1 node 1 +connection node_1; +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-7 +#wait for sync cluster 1 and 2 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +cluster 2 node 1 +connection node_4; +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-7,2-21-4 +select * from t1; +cluster_domain_id node_server_id seq_no +1 11 2 +2 21 1 +#wait for sync cluster 1 and 2 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +cluster 1 node 2 +connection node_2; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-7,2-21-4 +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-8,2-21-4 +#wait for sync cluster 1 and 2 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +cluster 1 node 3 +connection node_3; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-8,2-21-4 +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-4 +#wait for sync cluster 1 and 2 +connection node_1; +include/save_master_gtid.inc +connection node_4; +include/sync_with_master_gtid.inc +cluster 2 node 2 +connection node_5; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-4 +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-5 +#wait for sync cluster 2 and 1 +connection node_4; +include/save_master_gtid.inc +connection node_1; +include/sync_with_master_gtid.inc +cluster 2 node 3 +connection node_6; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-5 +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-6 +#wait for sync cluster 2 and 1 +connection node_4; +include/save_master_gtid.inc +connection node_1; +include/sync_with_master_gtid.inc +cluster 1 node 1 +connection node_1; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-6 +drop table t1; +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +set global GTID_SLAVE_POS=""; +cluster 2 node 1 +connection node_4; +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +set global GTID_SLAVE_POS=""; +connection node_2; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +connection node_3; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +connection node_5; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +connection node_6; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result new file mode 100644 index 00000000..9a96addb --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +VARIABLE_VALUE LIKE '%[::1]%' +1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 3 +1 +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +DROP TABLE t1; +connection node_1; +include/assert_grep.inc [Streaming the backup to joiner at \[::1\]] +include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:] +include/assert_grep.inc [IST receiver addr using tcp://\[::1\]] +include/assert_grep.inc [, listening at: tcp://\[::1\]] diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result new file mode 100644 index 00000000..182fb1af --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result @@ -0,0 +1,25 @@ +connection node_2; +connection node_1; +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +VARIABLE_VALUE LIKE '%[::1]%' +1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 3 +1 +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +DROP TABLE t1; +connection node_1; +include/assert_grep.inc [Streaming the backup to joiner at \[::1\]] +include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:] +connection node_2; +include/assert_grep.inc [IST receiver addr using tcp://\[::1\]] +include/assert_grep.inc [, listening at: tcp://\[::1\]] diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result new file mode 100644 index 00000000..1fb0ea30 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result @@ -0,0 +1,40 @@ +connection node_2; +connection node_1; +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to'"); +call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos"); +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE USER 'sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; +connection node_2; +SET GLOBAL wsrep_sst_method = 'mysqldump'; +Shutting down server ... +connection node_1; +Cleaning var directory ... +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +Starting server ... +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +DROP TABLE t1; +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +VARIABLE_VALUE LIKE '%[::1]%' +1 +connection node_1; +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +DROP USER sst; +connection node_2; +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); +CALL mtr.add_suppression("Can't open and lock time zone table"); +CALL mtr.add_suppression("Can't open and lock privilege tables"); +CALL mtr.add_suppression("Info table is not ready to be used"); +CALL mtr.add_suppression("Native table .* has the wrong structure"); +CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist"); +connection node_2; +CALL mtr.add_suppression("Unsupported protocol downgrade: incremental data collection disabled. Expect abort"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result new file mode 100644 index 00000000..27cbd7db --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result @@ -0,0 +1,19 @@ +connection node_2; +connection node_1; +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +VARIABLE_VALUE LIKE '%[::1]%' +1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 3 +1 +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result new file mode 100644 index 00000000..27cbd7db --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result @@ -0,0 +1,19 @@ +connection node_2; +connection node_1; +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +VARIABLE_VALUE LIKE '%[::1]%' +1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 3 +1 +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result new file mode 100644 index 00000000..9f1d3fec --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result @@ -0,0 +1,66 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +INSERT INTO t1 VALUES (01), (02), (03), (04), (05); +connection node_2; +Unloading wsrep provider ... +SET GLOBAL wsrep_cluster_address = ''; +connection node_3; +Unloading wsrep provider ... +SET GLOBAL wsrep_cluster_address = ''; +connection node_1; +INSERT INTO t1 VALUES (11), (12), (13), (14), (15); +INSERT INTO t1 VALUES (21), (22), (23), (24), (25); +SET GLOBAL wsrep_provider_options = 'dbug=d,ist_sender_send_after_get_buffers'; +connection node_2; +connection node_1; +INSERT INTO t1 VALUES (31), (32), (33), (34), (35); +connection node_3; +connection node_1; +SHOW STATUS LIKE 'wsrep_debug_sync_waiters'; +Variable_name Value +wsrep_debug_sync_waiters ist_sender_send_after_get_buffers ist_sender_send_after_get_buffers +INSERT INTO t1 VALUES (41), (42), (43), (44), (45); +CREATE TABLE t2 (f1 LONGTEXT); +INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); +INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); +INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=ist_sender_send_after_get_buffers'; +INSERT INTO t1 VALUES (51), (52), (53), (54), (55); +connection node_2; +connection node_3; +connection node_2; +SELECT COUNT(*) = 30 FROM t1; +COUNT(*) = 30 +1 +SELECT COUNT(*) = 3 FROM t2; +COUNT(*) = 3 +1 +SELECT LENGTH(f1) = 512 * 1024 FROM t2; +LENGTH(f1) = 512 * 1024 +1 +1 +1 +CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); +connection node_3; +SELECT COUNT(*) = 30 FROM t1; +COUNT(*) = 30 +1 +SELECT COUNT(*) = 3 FROM t2; +COUNT(*) = 3 +1 +SELECT LENGTH(f1) = 512 * 1024 FROM t2; +LENGTH(f1) = 512 * 1024 +1 +1 +1 +CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); +DROP TABLE t1, t2; +disconnect node_3; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result new file mode 100644 index 00000000..18136075 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result @@ -0,0 +1,84 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 1); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (2, 3); +connection node_2; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET wsrep_sync_wait = 0; +SET wsrep_on = OFF; +SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (3, 2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +connection node_3; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (4, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (5, 2); +connection node_3; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; +SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (6, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (7, 2); +connection node_3; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (8, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; +SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +connection node_2; +INSERT INTO t1 VALUES (9, 2); +connection node_3; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; +DROP TABLE t1; +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_2; +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_3; +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result new file mode 100644 index 00000000..732385a3 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result @@ -0,0 +1,94 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 1); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (2, 3); +connection node_2; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET wsrep_sync_wait = 0; +SET wsrep_on = OFF; +SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (3, 2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +connection node_3; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (4, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (5, 2); +connection node_3; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; +SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; +VARIABLE_NAME VARIABLE_VALUE +WSREP_DEBUG_SYNC_WAITERS after_shift_to_joining +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (6, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (7, 2); +connection node_3; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (8, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; +SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +connection node_2; +INSERT INTO t1 VALUES (9, 2); +connection node_3; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; +VARIABLE_NAME VARIABLE_VALUE +WSREP_DEBUG_SYNC_WAITERS process_primary_configuration +SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; +DROP TABLE t1; +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_2; +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_3; +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result new file mode 100644 index 00000000..d85f121b --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result @@ -0,0 +1,102 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 1); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (2, 3); +connection node_2; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET wsrep_sync_wait = 0; +SET wsrep_on = OFF; +SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (3, 2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +connection node_3; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (4, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (5, 2); +connection node_3; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; +SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; +SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request'; +4 +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; +VARIABLE_NAME VARIABLE_VALUE +WSREP_DEBUG_SYNC_WAITERS +connection node_3; +INSERT INTO t1 VALUES (6, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +INSERT INTO t1 VALUES (7, 2); +connection node_3; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; +SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +INSERT INTO t1 VALUES (8, 3); +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +connection node_2; +INSERT INTO t1 VALUES (9, 2); +connection node_3; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; +connection node_1; +DROP TABLE t1; +call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)"); +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_2; +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_3; +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result new file mode 100644 index 00000000..087f9e7e --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result @@ -0,0 +1,35 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_3; +SET GLOBAL wsrep_slave_threads = 2; +connection node_1_ctrl; +SET SESSION wsrep_sync_wait=0; +connection node_1; +SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; +UPDATE t1 SET f1 = f1 + 10;; +connection node_1_ctrl; +SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; +SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; +connection node_2; +UPDATE t1 SET f1 = f1 + 100;; +connection node_1_ctrl; +SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; +SET GLOBAL debug_dbug = NULL; +SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; +connection node_1; +connection node_2; +connection node_3; +SELECT f1 = 111 FROM t1; +f1 = 111 +1 +SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%'; +COUNT(*) IN (1, 2) +1 +SET GLOBAL wsrep_slave_threads = DEFAULT; +DROP TABLE t1; +connection node_1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result new file mode 100644 index 00000000..8cdd62db --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result @@ -0,0 +1,44 @@ +connection node_2; +connection node_1; +call mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\).*"); +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER); +SET SESSION wsrep_sync_wait=0; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +connection node_2; +SET SESSION wsrep_sync_wait=0; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +connection node_3; +SET SESSION wsrep_sync_wait=0; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +connection node_2; +SET GLOBAL wsrep_provider_options = 'pc.bootstrap=1'; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 1 +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Primary +INSERT INTO t1 VALUES (1); +connection node_2; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +connection node_1; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +connection node_3; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +connection node_1; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +connection node_2; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +connection node_3; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result new file mode 100644 index 00000000..6d8c7a51 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result @@ -0,0 +1,166 @@ +connection node_2; +connection node_1; +connection node_1; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +VARIABLE_VALUE = 3 +1 +SET GLOBAL wsrep_provider_options = 'pc.weight=3'; +SELECT VARIABLE_VALUE AS expect_5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +expect_5 +5 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +connection node_2; +SET SESSION wsrep_sync_wait=0; +SET SESSION wsrep_on=OFF; +SET SESSION wsrep_on=ON; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 2 +SHOW STATUS LIKE 'wsrep_cluster_weight'; +Variable_name Value +wsrep_cluster_weight 0 +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status non-Primary +SHOW STATUS LIKE 'wsrep_connected'; +Variable_name Value +wsrep_connected ON +SHOW STATUS LIKE 'wsrep_ready'; +Variable_name Value +wsrep_ready OFF +SHOW STATUS LIKE 'wsrep_local_state'; +Variable_name Value +wsrep_local_state 0 +SHOW STATUS LIKE 'wsrep_local_state_comment'; +Variable_name Value +wsrep_local_state_comment Initialized +connection node_3; +SET SESSION wsrep_sync_wait=0; +SET SESSION wsrep_on=OFF; +SET SESSION wsrep_on=ON; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 2 +SHOW STATUS LIKE 'wsrep_cluster_weight'; +Variable_name Value +wsrep_cluster_weight 0 +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status non-Primary +SHOW STATUS LIKE 'wsrep_connected'; +Variable_name Value +wsrep_connected ON +SHOW STATUS LIKE 'wsrep_ready'; +Variable_name Value +wsrep_ready OFF +SHOW STATUS LIKE 'wsrep_local_state'; +Variable_name Value +wsrep_local_state 0 +SHOW STATUS LIKE 'wsrep_local_state_comment'; +Variable_name Value +wsrep_local_state_comment Initialized +connection node_1; +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +expect_3 +3 +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; +expect_ON +ON +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +expect_ON +ON +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; +expect_4 +4 +SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +expect_Synced +Synced +SET GLOBAL wsrep_provider_options = 'pc.weight=1'; +SELECT VARIABLE_VALUE AS expect_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +expect_1 +1 +connection node_1; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +connection node_2; +connection node_3; +connection node_2; +connection node_3; +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_3 +3 +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +expect_3 +3 +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; +expect_ON +ON +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +expect_ON +ON +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; +expect_4 +4 +SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +expect_Synced +Synced +connection node_2; +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_3 +3 +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +expect_3 +3 +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; +expect_ON +ON +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +expect_ON +ON +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; +expect_4 +4 +SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +expect_Synced +Synced +connection node_1; +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_3 +3 +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +expect_3 +3 +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; +expect_ON +ON +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +expect_ON +ON +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; +expect_4 +4 +SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +expect_Synced +Synced +SET GLOBAL wsrep_provider_options = 'pc.weight=1'; +CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); +connection node_2; +CALL mtr.add_suppression('SYNC message from member'); +CALL mtr.add_suppression('user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); +CALL mtr.add_suppression('overriding reported weight for'); +connection node_3; +CALL mtr.add_suppression('WSREP: user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); +CALL mtr.add_suppression('overriding reported weight for'); diff --git a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result new file mode 100644 index 00000000..5d4b1d43 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result @@ -0,0 +1,69 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +connection node_2; +connection node_1; +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +connection node_3; +connection node_1; +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 1'] +connection node_2; +connection node_1; +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0'] +connection node_2; +connection node_1; +SET SESSION wsrep_on = OFF; +Killing server ... +safe_to_bootstrap: 1 +safe_to_bootstrap: 0 +safe_to_bootstrap: 0 +connection node_1; +connection node_2; +connection node_3; +connection node_2; +CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); +CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); +CALL mtr.add_suppression("WSREP: wsrep::connect(.*) failed: 7"); +CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); +CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); +CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); +CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("Plugin 'wsrep' init function returned error."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed."); +CALL mtr.add_suppression("Failed to initialize plugins."); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()"); +connection node_3; +CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); +CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); +CALL mtr.add_suppression("WSREP: wsrep::connect(.*) failed: 7"); +CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); +CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); +CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); +CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("Plugin 'wsrep' init function returned error."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed."); +CALL mtr.add_suppression("Failed to initialize plugins."); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()"); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_ssl_reload.result b/mysql-test/suite/galera_3nodes/r/galera_ssl_reload.result new file mode 100644 index 00000000..1daf3bed --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ssl_reload.result @@ -0,0 +1,16 @@ +connection node_2; +connection node_1; +# Correct Galera library found +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +connection node_2; +connection node_2; +# restart: with restart_parameters +SET GLOBAL wsrep_provider_options = 'socket.ssl_reload=1'; +connection node_3; +# restart: with restart_parameters +connection node_2; +FLUSH SSL; diff --git a/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result b/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result new file mode 100644 index 00000000..13caead7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result @@ -0,0 +1,22 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_3; +SET SESSION wsrep_on=OFF; +DROP SCHEMA test; +connection node_1; +CREATE SCHEMA test; +ERROR HY000: Can't create database 'test'; database exists +connection node_1; +SET SESSION wsrep_sync_wait=0; +connection node_2; +SET SESSION wsrep_sync_wait=0; +connection node_3; +SET SESSION wsrep_sync_wait=0; +disconnect node_3; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +Killing server ... +# restart +CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result new file mode 100644 index 00000000..69d5a3dc --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result @@ -0,0 +1,59 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; +INSERT INTO t1 VALUES (1); +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_dirty_reads = 1; +SELECT f1 FROM t1; +f1 +1 +USE test; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +LOCK TABLE t1 WRITE; +UNLOCK TABLES; +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +PREPARE stmt_select FROM 'SELECT f1 FROM t1'; +EXECUTE stmt_select; +f1 +1 +PREPARE stmt_update FROM 'UPDATE t1 SET f1 = f1 + f1'; +SET GLOBAL wsrep_dirty_reads = 1; +SET GLOBAL wsrep_sync_wait = 0; +SET GLOBAL wsrep_dirty_reads = 0; +SET GLOBAL wsrep_sync_wait = 15; +SET SESSION wsrep_dirty_reads = 1; +INSERT INTO t1 SELECT * FROM t1; +ERROR 08S01: WSREP has not yet prepared node for application use +DELETE FROM t1; +ERROR 08S01: WSREP has not yet prepared node for application use +UPDATE t1 SET f1 = f1 + 1; +ERROR 08S01: WSREP has not yet prepared node for application use +DROP TABLE t1; +ERROR 08S01: WSREP has not yet prepared node for application use +EXECUTE stmt_update; +ERROR 08S01: WSREP has not yet prepared node for application use +SET SESSION wsrep_dirty_reads = 0; +SELECT * FROM t1; +ERROR 08S01: WSREP has not yet prepared node for application use +EXECUTE stmt_select; +ERROR 08S01: WSREP has not yet prepared node for application use +SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST; +COUNT(*) > 0 +1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_1; +connection node_2; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result new file mode 100644 index 00000000..e49a1714 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result @@ -0,0 +1,83 @@ +connection node_2; +connection node_1; +Setting SST method to mysqldump ... +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'"); +call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos"); +connection node_1; +CREATE USER 'sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; +connection node_2; +SET GLOBAL wsrep_sst_method = 'mysqldump'; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_on=OFF; +ALTER TABLE t1 ADD PRIMARY KEY (f1); +SET SESSION wsrep_on=ON; +connection node_1; +ALTER TABLE t1 LOCK=SHARED, DROP PRIMARY KEY; +ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists +connection node_1; +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +connection node_3; +SELECT VARIABLE_VALUE AS expect_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_2 +2 +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +connection node_2; +SET SESSION wsrep_on=OFF; +SELECT VARIABLE_VALUE AS expect_Disconnected FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Disconnected +Disconnected +SET SESSION wsrep_on=ON; +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +connection node_1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection node_2; +SET SESSION wsrep_on=OFF; +SET SESSION wsrep_on=ON; +# restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +CALL mtr.add_suppression("is inconsistent with group"); +connection node_3; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that column/key exists'"); +connection node_1; +connection node_1; +CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +DROP USER sst; +connection node_2; +CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); +CALL mtr.add_suppression("Can't open and lock time zone table"); +CALL mtr.add_suppression("Can't open and lock privilege tables"); +CALL mtr.add_suppression("Info table is not ready to be used"); +CALL mtr.add_suppression("Native table .* has the wrong structure"); +CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result new file mode 100644 index 00000000..62c3924d --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result @@ -0,0 +1,77 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +SHOW CREATE TABLE mysql.wsrep_cluster; +Table Create Table +wsrep_cluster CREATE TABLE `wsrep_cluster` ( + `cluster_uuid` char(36) NOT NULL, + `view_id` bigint(20) NOT NULL, + `view_seqno` bigint(20) NOT NULL, + `protocol_version` int(11) NOT NULL, + `capabilities` int(11) NOT NULL, + PRIMARY KEY (`cluster_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 +SHOW CREATE TABLE mysql.wsrep_cluster_members; +Table Create Table +wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( + `node_uuid` char(36) NOT NULL, + `cluster_uuid` char(36) NOT NULL, + `node_name` char(32) NOT NULL, + `node_incoming_address` varchar(256) NOT NULL, + PRIMARY KEY (`node_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 +SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; +EXPECT_1 +1 +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; +EXPECT_3 +3 +SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members; +COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') +1 +SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'); +EXPECT_1 +1 +SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members; +node_incoming_address LIKE '127.0.0.1:%' +1 +1 +1 +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +1 +1 +connection node_2; +SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; +EXPECT_3 +3 +connection node_1; +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members; +EXPECT_2 +2 +connection node_2; +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; +EXPECT_3 +3 +connection node_1; +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; +EXPECT_3 +3 +disconnect node_3; diff --git a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result new file mode 100644 index 00000000..862e14d0 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result @@ -0,0 +1,94 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +SHOW CREATE TABLE mysql.wsrep_cluster; +Table Create Table +wsrep_cluster CREATE TABLE `wsrep_cluster` ( + `cluster_uuid` char(36) NOT NULL, + `view_id` bigint(20) NOT NULL, + `view_seqno` bigint(20) NOT NULL, + `protocol_version` int(11) NOT NULL, + `capabilities` int(11) NOT NULL, + PRIMARY KEY (`cluster_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 +SHOW CREATE TABLE mysql.wsrep_cluster_members; +Table Create Table +wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( + `node_uuid` char(36) NOT NULL, + `cluster_uuid` char(36) NOT NULL, + `node_name` char(32) NOT NULL, + `node_incoming_address` varchar(256) NOT NULL, + PRIMARY KEY (`node_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 +SELECT @@sql_safe_updates; +@@sql_safe_updates +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster; +COUNT(*) = 1 +1 +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members; +COUNT(*) = 3 +1 +SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members; +COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'); +COUNT(*) = 1 +1 +SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members; +node_incoming_address LIKE '127.0.0.1:%' +1 +1 +1 +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +1 +1 +connection node_2; +SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members; +COUNT(*) = 3 +1 +SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members; +COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'); +COUNT(*) = 1 +1 +SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members; +node_incoming_address LIKE '127.0.0.1:%' +1 +1 +1 +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +1 +1 +connection node_3; +SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members; +COUNT(*) = 3 +1 +SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members; +COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'); +COUNT(*) = 1 +1 +SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members; +node_incoming_address LIKE '127.0.0.1:%' +1 +1 +1 +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; +cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') +1 +1 +1 diff --git a/mysql-test/suite/galera_3nodes/r/inconsistency_shutdown.result b/mysql-test/suite/galera_3nodes/r/inconsistency_shutdown.result new file mode 100644 index 00000000..83c5b015 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/inconsistency_shutdown.result @@ -0,0 +1,142 @@ +connection node_3; +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_2; +SELECT @@wsrep_slave_threads = 8; +@@wsrep_slave_threads = 8 +1 +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT); +INSERT INTO t1 VALUES (1, 0),(2, 0),(3, 0),(4, 0),(5, 0),(6, 0),(7, 0),(8, 0); +connection node_2; +SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K'; +SET wsrep_on=OFF; +DELETE FROM t1 WHERE f1 = 2; +DELETE FROM t1 WHERE f1 = 4; +SET wsrep_on=ON; +LOCK TABLES t1 WRITE; +connection node_1; +UPDATE t1 SET f2 = 1 WHERE f1 = 1; +UPDATE t1 SET f2 = 1 WHERE f1 = 2; +UPDATE t1 SET f2 = 1 WHERE f1 = 3; +UPDATE t1 SET f2 = 1 WHERE f1 = 4; +UPDATE t1 SET f2 = 2 WHERE f1 = 4; +/* dependent applier */ +UPDATE t1 SET f2 = 3 WHERE f1 = 4; +/* dependent applier */ +UPDATE t1 SET f2 = 1 WHERE f1 = 5; +UPDATE t1 SET f2 = 1 WHERE f1 = 6; +UPDATE t1 SET f2 = 1 WHERE f1 = 7; +UPDATE t1 SET f2 = 1 WHERE f1 = 8; +connection node_2; +SET wsrep_on=OFF; +SET wsrep_on=ON; +UNLOCK TABLES; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +connection node_1; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 2 +SELECT * FROM t1; +f1 f2 +1 1 +2 1 +3 1 +4 3 +5 1 +6 1 +7 1 +8 1 +connection node_2; +SET GLOBAL wsrep_on=OFF; +# restart +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT); +START TRANSACTION; +INSERT INTO t1 VALUES (1, 0); +INSERT INTO t1 VALUES (2, 0); +INSERT INTO t1 VALUES (3, 0); +INSERT INTO t1 VALUES (4, 0); +INSERT INTO t1 VALUES (5, 0); +INSERT INTO t1 VALUES (6, 0); +INSERT INTO t1 VALUES (7, 0); +INSERT INTO t1 VALUES (8, 0); +COMMIT; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INT); +connection node_2; +SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K'; +SET wsrep_on=OFF; +DROP TABLE t2; +SET wsrep_on=ON; +SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; +LOCK TABLES t1 READ; +connection node_1; +UPDATE t1 SET f2 = 1 WHERE f1 = 1; +UPDATE t1 SET f2 = 1 WHERE f1 = 2; +UPDATE t1 SET f2 = 1 WHERE f1 = 3; +UPDATE t1 SET f2 = 1 WHERE f1 = 4; +UPDATE t1 SET f2 = 2 WHERE f1 = 4; +/* dependent applier */; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +DROP TABLE t2;; +connection node_2; +SET wsrep_on=OFF; +"Wait for DROP TABLE to replicate" +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 0; +SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +"DROP TABLE replicated" +SET wsrep_on=ON; +connection node_1; +UPDATE t1 SET f2 = 3 WHERE f1 = 4; +/* dependent applier */ +UPDATE t1 SET f2 = 1 WHERE f1 = 5; +UPDATE t1 SET f2 = 1 WHERE f1 = 6; +UPDATE t1 SET f2 = 1 WHERE f1 = 7; +UPDATE t1 SET f2 = 1 WHERE f1 = 8; +connection node_2; +SET wsrep_on=OFF; +SET wsrep_on=ON; +UNLOCK TABLES; +connection node_2a; +ERROR 42S02: Unknown table 'test.t2' +connection node_1; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 2 +SELECT * FROM t1; +f1 f2 +1 1 +2 1 +3 1 +4 3 +5 1 +6 1 +7 1 +8 1 +connection node_2; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +SET GLOBAL wsrep_on=OFF; +# restart +DROP TABLE t1; +CALL mtr.add_suppression('Can\'t find record in \'t1\''); +CALL mtr.add_suppression('Update_rows_v1 apply failed'); +CALL mtr.add_suppression('Inconsistency detected: Inconsistent by consensus on'); +CALL mtr.add_suppression('last left .* greater than drain seqno'); +CALL mtr.add_suppression('WSREP: Failed to apply write set:'); diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm new file mode 100644 index 00000000..49b93248 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -0,0 +1,79 @@ +package My::Suite::GALERA_3NODES; + +use lib 'suite'; +use wsrep::common; + +@ISA = qw(My::Suite); + +return wsrep_not_ok() if wsrep_not_ok(); + +push @::global_suppressions, + ( + qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), + qr(WSREP: Could not open saved state file for reading: .*), + qr(WSREP: Could not open state file for reading: .*), + qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: Failed to prepare for incremental state transfer:), + qr(WSREP:.*down context.*), + qr(WSREP: Failed to send state UUID:), + qr(WSREP: last inactive check more than .* skipping check), + qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), + qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Quorum: No node with complete state), + qr(WSREP: Initial position was provided by configuration or SST, avoiding override), + qr|WSREP: discarding established \(time wait\) .*|, + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr(WSREP: evs::proto.*), + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr(WSREP: no nodes coming from prim view, prim not possible), + qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: user message in state LEAVING), + qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: Resource temporarily unavailable), + qr(WSREP: Maximum writeset size exceeded by .*), + qr(WSREP: transaction size exceeded.*), + qr(WSREP: RBR event .*), + qr(WSREP: Ignoring error for TO isolated action: .*), + qr(WSREP: transaction size limit .*), + qr(WSREP: rbr write fail, .*), + qr(WSREP: .*Backend not supported: foo.*), + qr(WSREP: .*Failed to initialize backend using .*), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: gcs connect failed: Socket type not supported), + qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*), + qr(WSREP: .*Failed to open backend connection: -110 .*), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: gcs connect failed: Connection timed out), + qr|WSREP: wsrep::connect\(.*\) failed: 7|, + qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.), + qr(WSREP: Could not find peer:), + qr(WSREP: TO isolation failed for: .*), + qr|WSREP: gcs_caused\(\) returned .*|, + qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, + qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, + qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|, + qr(WSREP: Action message in non-primary configuration from member [0-9]*), + qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), + qr(WSREP: discarding established .*), + qr|WSREP: .*core_handle_uuid_msg.*|, + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|, + qr|Query apply failed:*|, + qr(WSREP: Ignoring error*), + qr(WSREP: Failed to remove page file .*), + qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), + qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|, + qr|WSREP: Trying to continue unpaused monitor|, + qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, + ); + +sub which($) { return `sh -c "command -v $_[0]"` } + +sub skip_combinations { + my %skip = (); + $skip{'include/have_mariabackup.inc'} = 'Need ss' + unless which("lsof") || which("sockstat") || which("ss"); + %skip; +} + +bless { }; diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.cnf b/mysql-test/suite/galera_3nodes/t/GAL-501.cnf new file mode 100644 index 00000000..cd99c90b --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/GAL-501.cnf @@ -0,0 +1,28 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep_sst_method=rsync + +[mysqld.1] +wsrep-cluster-address=gcomm:// +wsrep_node_address=[::1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]' +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +bind-address=:: + +[mysqld.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_node_address=[::1] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]' +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +bind-address=:: + +[mysqld.3] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_node_address=[::1] +wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]' +wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.3.port' +bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.test b/mysql-test/suite/galera_3nodes/t/GAL-501.test new file mode 100644 index 00000000..ecf1c766 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/GAL-501.test @@ -0,0 +1,46 @@ +# +# Test GAL-501 Improved URI parsing for IPv6 addresses +# The .cnf file contains +# wsrep_node_address=[::1] +# ist.recv_addr=[::1] + +--let galera_connection_address=::1 +--source include/galera_cluster.inc +--source include/check_ipv6.inc +--source include/force_restart.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc +--connection node_3 +--source include/galera_wait_ready.inc + +# Confirm that initial handshake happened over ipv6 + +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Force IST + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.cnf b/mysql-test/suite/galera_3nodes/t/GCF-354.cnf new file mode 100644 index 00000000..4c5e4854 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/GCF-354.cnf @@ -0,0 +1,5 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 +wsrep_sync_wait=0 diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.test b/mysql-test/suite/galera_3nodes/t/GCF-354.test new file mode 100644 index 00000000..e1459734 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/GCF-354.test @@ -0,0 +1,105 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/force_restart.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +# +# 1. Create different inconsistencies on nodes 2 and 3 +# +--connection node_2 +SET SESSION wsrep_on=OFF; +DROP SCHEMA test; + +--connection node_3 +SET SESSION wsrep_on=OFF; +CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; +# +# 2. The following should generate different errors on nodes 2 and 3 and +# trigger voting with 3 different votes. node_1 should remain alone +# in the cluster. +# +--connection node_1 +CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; +INSERT INTO test.t1 values (1); + +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; + +# Test cleanup +DROP TABLE test.t1; +# +# 3. Wait for nodes 2 and 3 to drop out of the cluster and restart them to +# recover the initial configuration. +# +--connection node_2 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; + +# need to reinitialize connection due to a "Bad handshake" bug +--disconnect node_2 +--connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2 + +--source include/kill_galera.inc + +--connection node_2 +--source include/wait_until_disconnected.inc +--echo Starting node_2 +--source include/start_mysqld.inc + +--connection node_3 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; + +# need to reinitialize connection due to a "Bad handshake" bug +--disconnect node_3 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +--source include/kill_galera.inc + +--connection node_3 +--source include/wait_until_disconnected.inc +--echo Starting node_3 +--source include/start_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--echo Nodes 2 and 3 started + +--connection node_2 +# fix the default schema +USE test; +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc +--echo Node 2 synced +CALL mtr.add_suppression("Slave SQL: Error 'Unknown database 'test'' on query. Default database: 'test'. Query: 'CREATE TABLE test.t1 \\\(f1 INTEGER\\\)', Error_code: 1049"); +CALL mtr.add_suppression("Query apply failed"); +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on .*"); +CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc +--echo Node 3 synced +CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query. Default database: 'test'. Query: 'CREATE TABLE test.t1 \\\(f1 INTEGER\\\)', Error_code: 1050"); +CALL mtr.add_suppression("Query apply failed"); +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on .*"); +CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/GCF-363.cnf b/mysql-test/suite/galera_3nodes/t/GCF-363.cnf new file mode 100644 index 00000000..7b7770e3 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/GCF-363.cnf @@ -0,0 +1,8 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 + +# [mysqld.3] +# wsrep-sst-method=mysqldump +# wsrep_sst_receive_address=127.0.0.2:@mysqld.3.port diff --git a/mysql-test/suite/galera_3nodes/t/GCF-363.test b/mysql-test/suite/galera_3nodes/t/GCF-363.test new file mode 100644 index 00000000..00af0212 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/GCF-363.test @@ -0,0 +1,77 @@ +# +# GCF-363 Inconsistency voting: If in a 3-node cluster the nodes with applier +# error survive, the other node can not join properly +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB; + +SET GLOBAL wsrep_on=OFF; +INSERT INTO t1 VALUES (1, 'a'); +SET GLOBAL wsrep_on=ON; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc + +SET GLOBAL wsrep_on=OFF; +INSERT INTO t1 VALUES (1, 'a'); +SET GLOBAL wsrep_on=ON; + +--connection node_3 +INSERT INTO t1 VALUES (1, 'b'); +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; + +--connection node_1 +# Wait until node #3 leaves the cluster +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_3 +SET SESSION wsrep_on=OFF; +--source include/restart_mysqld.inc +--source include/wait_until_connected_again.inc +SET SESSION wsrep_on=ON; + +--connection node_1 +SELECT * FROM t1; + +--connection node_2 +SELECT * FROM t1; + +--connection node_3 +SELECT * FROM t1; + +DROP TABLE t1; + +--connection node_1 +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 155, Error_code: 1062"); +CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno "); + +--connection node_2 +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 155, Error_code: 1062"); +CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno "); + +--connection node_3 +CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster."); +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); +CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); + +--connection node_1 +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/GCF-376.cnf b/mysql-test/suite/galera_3nodes/t/GCF-376.cnf new file mode 100644 index 00000000..e255e1d5 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/GCF-376.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 diff --git a/mysql-test/suite/galera_3nodes/t/GCF-376.test b/mysql-test/suite/galera_3nodes/t/GCF-376.test new file mode 100644 index 00000000..20b9703f --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/GCF-376.test @@ -0,0 +1,118 @@ +# +# GCF-376: slaves become inconsistent if master goes non-prim during +# inconsistency voting +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE test.t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +SET GLOBAL wsrep_on=OFF; +INSERT INTO t1 VALUES (1, 'a'); +SET GLOBAL wsrep_on=ON; + +LOCK TABLE t1 WRITE; + +--connection node_1 +INSERT INTO t1 VALUES (1, 'b'); + +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait=0; + +# Wait until node #1 leaves the cluster +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_status'; + +--connection node_2 +UNLOCK TABLES; + +# Wait until node #2 leaves the cluster +--source include/wsrep_wait_disconnect.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connection node_2 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; +SHOW STATUS LIKE 'wsrep_cluster_size'; +SET GLOBAL wsrep_on=OFF; +SELECT * FROM t1; + +--connection node_3 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; +SHOW STATUS LIKE 'wsrep_cluster_size'; +SELECT * FROM t1; + +--echo # reconnect node #1 +--connection node_1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--echo # reconnect node #2 +--connection node_2 +--source include/restart_mysqld.inc +--source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; +SHOW STATUS LIKE 'wsrep_cluster_size'; +SELECT * FROM t1; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SELECT * FROM t1; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SELECT * FROM t1; + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SELECT * FROM t1; + +DROP TABLE t1; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc + +--connection node_2 +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos (.*), Error_code: 1062"); +CALL mtr.add_suppression("WSREP: Event (.*) Write_rows_v1 apply failed: 121, seqno "); +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on (.*)"); +CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Failed to apply write set: "); diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-29171.cnf b/mysql-test/suite/galera_3nodes/t/MDEV-29171.cnf new file mode 100644 index 00000000..27f1c29f --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/MDEV-29171.cnf @@ -0,0 +1,14 @@ +!include ../galera_3nodes.cnf + +[mysqld.1] +wsrep-node-name="node1" +wsrep-gtid-mode=ON +wsrep-gtid-domain-id=100 + +[mysqld.2] +wsrep-node-name="node2" +wsrep-gtid-mode=ON + +[mysqld.3] +wsrep-node-name="node3" +wsrep-gtid-mode=ON diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-29171.test b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test new file mode 100644 index 00000000..33fa4d72 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test @@ -0,0 +1,83 @@ +# +# MDEV-29171: changing the value of wsrep_gtid_domain_id +# with full cluster restart fails on some nodes +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Initially wsrep gtid domain id is 100 +# +--connection node_1 +select @@wsrep_gtid_domain_id,@@wsrep_node_name; + +--connection node_2 +select @@wsrep_gtid_domain_id,@@wsrep_node_name; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +select @@wsrep_gtid_domain_id,@@wsrep_node_name; + + +# +# Shutdown all nodes +# +--connection node_3 +--source include/shutdown_mysqld.inc + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--source include/shutdown_mysqld.inc + + +# +# Bootstrap from node_1 and change wsrep_gtid_domain_id to 200 +# +--connection node_1 +--let $restart_parameters = --wsrep_new_cluster --wsrep_gtid_domain_id=200 +--source include/start_mysqld.inc +show variables like 'wsrep_gtid_domain_id'; + + +# +# Restart node_2, expect that wsrep_gtid_domain_id has changed to 200 +# +--connection node_2 +--let $restart_parameters = +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc +show variables like 'wsrep_gtid_domain_id'; + + +# +# Restart node_3, select node_2 as donor +# If bug is present, node_3 remains on domain id 100 +# +--connection node_3 +--let $restart_parameters = --wsrep_sst_donor="node2" +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect +--source include/start_mysqld.inc +# Expect domain id 200 +show variables like 'wsrep_gtid_domain_id'; + + +# +# Cleanup +# +--connection node_1 +set global wsrep_gtid_domain_id=100; + +--connection node_2 +set global wsrep_gtid_domain_id=100; +CALL mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); + +--connection node_3 +set global wsrep_gtid_domain_id=100; +CALL mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); diff --git a/mysql-test/suite/galera_3nodes/t/galera-features#119.test b/mysql-test/suite/galera_3nodes/t/galera-features#119.test new file mode 100644 index 00000000..d1dd435c --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera-features#119.test @@ -0,0 +1,72 @@ +# +# This test tests voting (successful slave wins) in the absence of the master +# for trasaction. +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +CREATE TABLE test.t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--connection node_2 +--let $wsrep_provider_orig = `SELECT @@wsrep_provider` +--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` +SET wsrep_on=OFF; +INSERT INTO t1 VALUES (1); +LOCK TABLE t1 WRITE; +SET GLOBAL wsrep_sync_wait=0; + +--connection node_1 +INSERT INTO t1 VALUES (1); +SET GLOBAL wsrep_sync_wait=0; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--connection node_3 +# wait for node_1 to disappear +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +UNLOCK TABLES; +# wait to go non-Primary due to inconsistency voting +#--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +#--source include/wait_condition.inc +# Somehow the above times out so we use connectin to node 3 + +--connection node_3 +# wait for node_1 to disappear +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +--source include/galera_wait_ready.inc +SET GLOBAL wsrep_sync_wait=15; +DROP TABLE test.t1; + +# reconnect node 2, since it is now inconsistent +--connection node_2 +--source include/kill_galera.inc +--source include/wait_until_disconnected.inc +--source include/start_mysqld.inc + +--connection node_2 +CALL mtr.add_suppression("Inconsistent by consensus."); +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST"); +CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster..."); +CALL mtr.add_suppression("WSREP: Failed to apply write set: "); + + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc + diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf new file mode 100644 index 00000000..41c1c7c0 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf @@ -0,0 +1,25 @@ +!include ../galera_2x3nodes.cnf + +[mysqld.1] +wsrep_gtid_domain_id=1 +server-id=11 + +[mysqld.2] +wsrep_gtid_domain_id=1 +server-id=12 + +[mysqld.3] +wsrep_gtid_domain_id=1 +server-id=13 + +[mysqld.4] +wsrep_gtid_domain_id=2 +server-id=21 + +[mysqld.5] +wsrep_gtid_domain_id=2 +server-id=22 + +[mysqld.6] +wsrep_gtid_domain_id=2 +server-id=23 diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test new file mode 100644 index 00000000..d7b0f365 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test @@ -0,0 +1,156 @@ +# +# This test creates 2x3 nodes galera cluster. +# +# A(1) <-> B(2) <-> C(3) {Galera cluster 1} +# | {Circular Async replication} +# D(4) <-> E(5) <-> F(6) {Galera cluster 2} +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5 + +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--connection node_4 + +--replace_result $NODE_MYPORT_1 NODE_MYPORT_1 +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos; +START SLAVE; +--source include/wait_for_slave_to_start.inc + +# +# CREATE TABLE & INSERT +# + +--connection node_1 + +CREATE TABLE t1(c1 INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INTEGER); +INSERT INTO t1(c2) VALUES(1); + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 + +SELECT COUNT(*) = 1 FROM t1; + +--connection node_1 +--source include/save_master_gtid.inc + +--connection node_4 +--source include/sync_with_master_gtid.inc + +SELECT COUNT(*) = 1 FROM t1; + +--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6 +--connection node_6 + +SELECT COUNT(*) = 1 FROM t1; + +# +# ALTER TABLE +# + +--connection node_2 + +ALTER TABLE t1 ADD COLUMN t3 INTEGER; +--echo Node 2 column number AFTER ALTER +SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; + +--connection node_3 + +--echo Node 3 column number AFTER ALTER +SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; + +--connection node_1 +--source include/save_master_gtid.inc + +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo Node 4 column number AFTER ALTER +SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; + +--connection node_6 + +--echo Node 6 column number AFTER ALTER +SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; + +# +# OPTIMIZE TABLE +# + +--connection node_2 + +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +OPTIMIZE TABLE t1; + +--connection node_1 + +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +--connection node_4 + +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +--connection node_6 + +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +# +# Cleanup +# + +--connection node_1 + +DROP TABLE t1; + +--connection node_4 + +STOP SLAVE; +RESET SLAVE; +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; +SET GLOBAL GTID_SLAVE_POS=""; + +--connection node_1 + +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; + +--connection node_2 + +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; + +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); + +--connection node_3 + +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; + +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); + +--connection node_5 + +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; + +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); + +--connection node_6 + +SET GLOBAL wsrep_on = OFF; +RESET MASTER; +SET GLOBAL wsrep_on = ON; + +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf b/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf new file mode 100644 index 00000000..62f24c17 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf @@ -0,0 +1,26 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep_sst_method=rsync + +[mysqld.1] +wsrep_allowlist="127.0.0.1,127.0.0.2,127.0.0.3" + +[mysqld.2] +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=127.0.0.2;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' + +# Variable is only used on bootstrap node, so this will be ignored +wsrep_allowlist="127.0.0.1,127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.5" + +wsrep_node_address=127.0.0.2 +wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port +wsrep_node_incoming_address=127.0.0.2:@mysqld.2.port +wsrep_sst_receive_address='127.0.0.2:@mysqld.2.#sst_port' + +[mysqld.3] +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=127.0.0.3;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_quorum=TRUE;pc.wait_prim=FALSE' + +wsrep_node_address=127.0.0.3 +wsrep_sst_receive_address=127.0.0.3:@mysqld.3.#sst_port +wsrep_node_incoming_address=127.0.0.3:@mysqld.3.port +wsrep_sst_receive_address='127.0.0.3:@mysqld.3.#sst_port'
\ No newline at end of file diff --git a/mysql-test/suite/galera_3nodes/t/galera_allowlist.test b/mysql-test/suite/galera_3nodes/t/galera_allowlist.test new file mode 100644 index 00000000..74fff61c --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_allowlist.test @@ -0,0 +1,66 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# Check that `wsrep_allowlist` variable is loaded +SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist; + +--connection node_2 +# Check that non-bootstrap nodes doesn't populate `mysql.wsrep_allowlist` +SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist; + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--connection node_3 +# Desync and disconnect node 3 from the PC: +SET @@global.wsrep_desync = 1; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--connection node_1 +# Wait until node 3 disappears from the PC: +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Delete node ip (127.0.0.3) from allowlist +DELETE FROM mysql.wsrep_allowlist WHERE ip LIKE '127.0.0.3'; + +SELECT COUNT(*) = 2 FROM mysql.wsrep_allowlist; + +--connection node_2 +SELECT COUNT(*) = 2 FROM mysql.wsrep_allowlist; + +--connection node_3 +# Reconnect node 2 to the PC: +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; + +# We should reach Primary with cluster size = 1 because of `pc.ignore_quorum=TRUE and pc.wait_prim=FALSE` used in configuration +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Resync should pass: +SET @@global.wsrep_desync = 0; + +# Shutdown node +--source include/shutdown_mysqld.inc + +--connection node_1 +# Allow node 3 could be reconnected to cluster +INSERT INTO mysql.wsrep_allowlist(ip) VALUES ('127.0.0.3'); + +--connection node_3 +--source include/start_mysqld.inc +--source include/wait_until_connected_again.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CALL mtr.add_suppression('WSREP: Connection not allowed'); + +--connection node_2 +CALL mtr.add_suppression('WSREP: Connection not allowed'); + +--connection node_3 +CALL mtr.add_suppression('WSREP: Ignoring lack of quorum'); diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test new file mode 100644 index 00000000..b4fe10bf --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test @@ -0,0 +1,53 @@ +# +# Test that a cluster configuration change during a transaction does not cause a failure +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +--connection node_3 +--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` +SET GLOBAL wsrep_cluster_address = ''; +--sleep 5 + +--connection node_1 +INSERT INTO t1 VALUES (2); +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +COMMIT; + +--connection node_2 +SELECT COUNT(*) = 2 FROM t1; + +--connection node_3 +--disable_query_log +--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; +--enable_query_log +--sleep 5 +--source include/wait_until_ready.inc + +--connection node_1 +DROP TABLE t1; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc + +--source include/galera_end.inc + diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test b/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test new file mode 100644 index 00000000..5366d2a4 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test @@ -0,0 +1,35 @@ +# +# This test creates a transaction whose certification will fail on two separate nodes +# for two different reasons. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); + +--connection node_2 +INSERT INTO t1 VALUES (1); + +--connection node_3 +INSERT INTO t2 VALUES (1); + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +--connection node_3 +--source include/galera_wait_ready.inc +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf new file mode 100644 index 00000000..14577272 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf @@ -0,0 +1,16 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep_sst_method=rsync + +[mysqld.1] +wsrep_node_name='node.1' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true' + +[mysqld.2] +wsrep_node_name='node.2' +wsrep_provider_options='base_port=@mysqld.2.#galera_port' + +[mysqld.3] +wsrep_node_name='node.3' +wsrep_provider_options='base_port=@mysqld.3.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true' diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test new file mode 100644 index 00000000..bdb6a9db --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test @@ -0,0 +1,65 @@ +# +# Test galera dynamic protocol support. By providing `socket.dynamic=true` in +# galera configuration it is possible to use same port for communication over ssl or tcp. +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1 = node_1 +--let $node_2 = node_2 +--let $node_3 = node_3 +--source ../galera/include/auto_increment_offset_save.inc + + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +SELECT COUNT(*) = 1 FROM t1; + +# Setup galera ports +--connection node_1 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT + +--connection node_2 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT + +--connection node_2 +# Restart node with SSL enabled +--source include/shutdown_mysqld.inc +--let $restart_noprint = 1 +--let $restart_parameters = --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1 --wsrep_provider_options=base_port=$NODE_GALERAPORT_2;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem +--source include/start_mysqld.inc +--source include/galera_wait_ready.inc + +INSERT INTO t1 VALUES (2); + +--connection node_3 +SELECT COUNT(*) = 2 FROM t1; + +DROP TABLE t1; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test new file mode 100644 index 00000000..8848e698 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test @@ -0,0 +1,83 @@ +# +# Test the operation of evs.suspect_timeout. +# +# We set evs.inactive_timeout to a very high value so that evs.suspect_timeout can kick in instead. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +--let $wsrep_provider_options_node1 = `SELECT @@wsrep_provider_options` +SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S'; + +--connection node_2 +--let $wsrep_provider_options_node2 = `SELECT @@wsrep_provider_options` +SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S'; + +--connection node_3 +--source include/wait_until_connected_again.inc +--let $wsrep_cluster_address_node3 = `SELECT @@wsrep_cluster_address` + +# Suspend node #3 +--connection node_3 +--source include/galera_suspend.inc +--sleep 5 + +# Confirm that the other nodes have booted it out + +--connection node_1 +--source include/wait_until_connected_again.inc +SET SESSION wsrep_sync_wait=0; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node1'; +--enable_query_log +--source include/wait_until_connected_again.inc + +CREATE TABLE t1 (f1 INTEGER) engine=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +--source include/wait_until_connected_again.inc +SET SESSION wsrep_sync_wait=0; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node2'; +--enable_query_log +--source include/wait_until_connected_again.inc + +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM t1; + +# Reconnect node #3 so that MTR's end-of-test checks can run + +--connection node_3 +--source include/galera_resume.inc +--source include/wait_until_connected_again.inc + +--disable_query_log +--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node3'; +--enable_query_log +--source include/galera_wait_ready.inc + +CALL mtr.add_suppression("WSREP: gcs_caused"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg"); + +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM t1; + +--connection node_1 +DROP TABLE t1; +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd.test b/mysql-test/suite/galera_3nodes/t/galera_garbd.test new file mode 100644 index 00000000..05b1b259 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test @@ -0,0 +1,90 @@ +# +# A very basic test for the galera arbitrator. We shut down node #3 and use its port allocation to start garbd. +# As MTR does not allow multiple servers to be down at the same time, we are limited as to what we can test. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_garbd.inc +--source include/big_test.inc + +# Save galera ports +--connection node_1 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT + +--connection node_2 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--echo Killing node #3 to free ports for garbd ... +--connection node_3 +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--echo Starting garbd ... +--exec $MTR_GARBD_EXE --address "gcomm://127.0.0.1:$NODE_GALERAPORT_1" --group my_wsrep_cluster --options 'base_port=$NODE_GALERAPORT_3' > $MYSQL_TMP_DIR/garbd.log 2>&1 & + +--sleep 5 + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; + +--echo Killing garbd ... +# FreeBSD's /bin/pkill only supports short versions of the options: +# -o Select only the oldest (least recently started) +# -f Match against full argument lists +--exec pkill -o -f garbd.*$NODE_GALERAPORT_3 + +--sleep 5 + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (2); + +--connection node_2 +SELECT COUNT(*) = 2 FROM t1; + +DROP TABLE t1; + +--echo Restarting node #3 to satisfy MTR's end-of-test checks +--connection node_3 +let $restart_noprint=2; +--source include/start_mysqld.inc + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc + +# Workaround for galera#101 + +--connection node_1 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); + +--connection node_2 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); + +--connection node_3 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.cnf b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.cnf new file mode 100644 index 00000000..8b7cb948 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.cnf @@ -0,0 +1,13 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep_sst_method=rsync + +[mysqld.1] +wsrep_node_name=node1 + +[mysqld.2] +wsrep_node_name=node2 + +[mysqld.3] +wsrep_node_name=node3 diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test new file mode 100644 index 00000000..f5eaf6fc --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test @@ -0,0 +1,136 @@ +# +# A very basic test for the galera arbitrator. We shut down node #3 and use its port allocation to start garbd. +# As MTR does not allow multiple servers to be down at the same time, we are limited as to what we can test. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_garbd.inc +--source include/big_test.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--connection node_1 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT + +--source ../galera/include/auto_increment_offset_save.inc + +# Save galera ports +--connection node_1 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT +--let $datadir= `SELECT @@datadir` + +--let $innodb_max_dirty_pages_pct = `SELECT @@innodb_max_dirty_pages_pct` +--let $innodb_max_dirty_pages_pct_lwm = `SELECT @@innodb_max_dirty_pages_pct_lwm` + +SET GLOBAL innodb_max_dirty_pages_pct=99; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=99; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_2 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT + +--echo Killing node #3 to free ports for garbd ... +--connection node_3 +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# stop SST donor thread when node is in donor state +SET GLOBAL debug_dbug = "+d,sync.wsrep_donor_state"; + +--echo Starting garbd ... +--exec $MTR_GARBD_EXE --address "gcomm://127.0.0.1:$NODE_GALERAPORT_1" --group my_wsrep_cluster --donor node1 --sst backup --options 'base_port=$NODE_GALERAPORT_3' > $MYSQL_TMP_DIR/garbd.log 2>&1 & + +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_donor_state_reached"; + +# +# get hash of data directory contents before BP dirty page flushing +# +--exec find $datadir -type f ! -name tables_flushed ! -name backup_sst_complete -exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_before + +# this should force buffer pool flushing, if not already done by donor state change transfer +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0; +SET GLOBAL innodb_max_dirty_pages_pct=0; + +--disable_query_log +--disable_result_log +select f1 from t1; +select * from ten; +--enable_result_log +--enable_query_log + +# +# +# record the hash of data directory contents after BP dirty page flushing +# +--exec find $datadir -type f ! -name tables_flushed ! -name backup_sst_complete -exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_after + +# there should be no disk writes +--diff_files $MYSQLTEST_VARDIR/tmp/innodb_before $MYSQLTEST_VARDIR/tmp/innodb_after + +SET SESSION debug_sync = "now SIGNAL signal.wsrep_donor_state"; +SET GLOBAL debug_dbug = ""; +SET debug_sync='RESET'; + +--connection node_2 + +# +# garbd will die automatically, because of the backup SST script +# but just to be sure, sending explicit kill here, as well +# +--echo Killing garbd ... +# FreeBSD's /bin/pkill only supports short versions of the options: +# -o Select only the oldest (least recently started) +# -f Match against full argument lists +--error 0,1 +--exec pkill -o -f garbd.*$NODE_GALERAPORT_3 + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_2 + +DROP TABLE t1; +DROP TABLE ten; + +--echo Restarting node #3 to satisfy MTR's end-of-test checks +--connection node_3 +let $restart_noprint=2; +--source include/start_mysqld.inc + +--connection node_1 +--disable_query_log +--eval SET GLOBAL innodb_max_dirty_pages_pct = $innodb_max_dirty_pages_pct +--eval SET GLOBAL innodb_max_dirty_pages_pct_lwm = $innodb_max_dirty_pages_pct_lwm +--enable_query_log + +--source ../galera/include/auto_increment_offset_restore.inc + +--connection node_1 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); + +--connection node_2 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); + +--connection node_3 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf new file mode 100644 index 00000000..dc5535ef --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf @@ -0,0 +1,28 @@ +# We need a dedicated .cnf file, even if empty, in order to force this test to run +# alone on a freshly started cluster. Otherwise there are adverse interactions with +# following tests such as galera_3nodes.galera_var_dirty_reads2 + +!include ../galera_2x3nodes.cnf +[mysqld.1] +wsrep_gtid_domain_id=1 +server-id=11 + +[mysqld.2] +wsrep_gtid_domain_id=1 +server-id=12 + +[mysqld.3] +wsrep_gtid_domain_id=1 +server-id=13 + +[mysqld.4] +wsrep_gtid_domain_id=2 +server-id=21 + +[mysqld.5] +wsrep_gtid_domain_id=2 +server-id=22 + +[mysqld.6] +wsrep_gtid_domain_id=2 +server-id=23 diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test new file mode 100644 index 00000000..925600ff --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test @@ -0,0 +1,322 @@ +# +# This test creates 2x 3 nodes galera cluster. +# The whole test case +# A <-> B <-> C {Galera cluster 1} +# | {Circular Async replication} +# D <-> E <-> F {Galera cluster 2} +# We will write on any random node to see if gtid is consitent or not +# Then we will kill node D and set up the replication between A and E +# To see whether fail over works or not. + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +--echo cluster 1 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connection node_2 +--echo cluster 1 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +--echo cluster 1 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--connection node_4 +--echo cluster 2 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5 +--connection node_5 +--echo cluster 2 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6 +--connection node_6 +--echo cluster 2 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +#--disable_parsing +--connection node_1 +--replace_result $NODE_MYPORT_4 NODE_MYPORT_4 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--connection node_4 +--replace_result $NODE_MYPORT_1 NODE_MYPORT_1 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--echo cluster 1 node 1 +--connection node_1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 1 +--connection node_4 +select @@gtid_binlog_state; +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +select * from t1; +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 2 +--connection node_2 +select @@gtid_binlog_state; +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 1 node 3 +--connection node_3 +select @@gtid_binlog_state; +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 2 +--connection node_5 +select @@gtid_binlog_state; +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 3 +--connection node_6 +select @@gtid_binlog_state; +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 1 +--connection node_1 +select @@gtid_binlog_state; +drop table t1; +stop slave; +reset slave; + +--echo cluster 2 node 1 +--connection node_4 +stop slave; +reset slave; + +--echo cluster 1 node 1 +--connection node_1 +change master to master_use_gtid=no, ignore_server_ids=(); +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +set global GTID_SLAVE_POS=""; +--sleep 2 + +--echo cluster 2 node 1 +--connection node_4 +change master to master_use_gtid=no, ignore_server_ids=(); +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +set global GTID_SLAVE_POS=""; + +--connection node_2 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +--connection node_3 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +--connection node_5 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +--connection node_6 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +#--enable_parsing +# +# This test creates 2x 3 nodes galera cluster. +# The whole test case +# A <-> B <-> C {Galera cluster 1} +# \ / +# \ / +# / {C->D, F->A , Async normal slave repl} +# / \ +# | \ +# D <-> E <-> F {Galera cluster 2} +# We will write on any random node to see if gtid is consitent or not +# Then we will kill node D and set up the replication between A and E +# To see whether fail over works or not. +--connection node_1 +--replace_result $NODE_MYPORT_6 NODE_MYPORT_6 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--connection node_4 +--replace_result $NODE_MYPORT_3 NODE_MYPORT_3 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--echo cluster 1 node 1 +--connection node_1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); + +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc +--sleep 2 +--echo cluster 2 node 1 +--connection node_4 +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +select * from t1; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 2 +--connection node_2 +select @@gtid_binlog_state; +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 1 node 3 +--connection node_3 +select @@gtid_binlog_state; +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 2 +--connection node_5 +select @@gtid_binlog_state; +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 3 +--connection node_6 +select @@gtid_binlog_state; +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 1 +--connection node_1 +select @@gtid_binlog_state; +drop table t1; +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +set global GTID_SLAVE_POS=""; + +--echo cluster 2 node 1 +--connection node_4 +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +set global GTID_SLAVE_POS=""; + +--connection node_2 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +--connection node_3 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +--connection node_5 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +--connection node_6 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf new file mode 100644 index 00000000..ed0e6204 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf @@ -0,0 +1,38 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" + +[mysqld.1] +wsrep-cluster-address=gcomm:// +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +wsrep_node_name=node_1 +bind-address=:: + +[mysqld.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +wsrep_node_name=node_2 +wsrep_sst_donor=node_1 +bind-address=:: + +[mysqld.3] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.3.port' +wsrep_node_name=node_3 +wsrep_sst_donor=node_1 +bind-address=:: + +[SST] +transferfmt=@ENV.MTR_GALERA_TFMT +streamfmt=xbstream diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test new file mode 100644 index 00000000..f5633924 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test @@ -0,0 +1,72 @@ +--let galera_connection_address=::1 +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/check_ipv6.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc +--source include/force_restart.inc + +# Confirm that initial handshake happened over ipv6 + +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Force IST + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +DROP TABLE t1; + +# Confirm that key messages around SST and IST reference IPv6 + +--connection node_1 +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err +--let $assert_only_after = CURRENT_TEST + +# The SSTs happen when nodes are started first time +--let $assert_count = 2 +--let $assert_text = Streaming the backup to joiner at \[::1\] +--let $assert_select = Streaming the backup to joiner at \[::1\] +--source include/assert_grep.inc + +# There will be 3 ISTs donated from node_1 in Galera 4. +# Two first happen at the initial startup to populate the certification +# index. The third one is from the IST which happens during the actual test. +--let $assert_count = 3 +--let $assert_text = async IST sender starting to serve tcp://\[::1\]: +--let $assert_select = async IST sender starting to serve tcp://\[::1\]: +--source include/assert_grep.inc + +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err + +# There are two ISTs on joiner, the first at the initial startup, the second +# during the actual test. +--let $assert_count = 2 +--let $assert_text = IST receiver addr using tcp://\[::1\] +--let $assert_select = IST receiver addr using tcp://\[::1\] +--source include/assert_grep.inc + +# The receiver expects IST +--let $assert_count = 2 +--let $assert_text = , listening at: tcp://\[::1\] +--let $assert_select = , listening at: tcp://\[::1\] +--source include/assert_grep.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf new file mode 100644 index 00000000..aaad88eb --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf @@ -0,0 +1,43 @@ +!include ../galera_3nodes.cnf + +# decoy value - should not be read by mysqld or sst scripts +[mysqld] +innodb-data-home-dir=/tmp +innodb-data-home-dir= +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" + +[mysqld.1] +wsrep-cluster-address=gcomm:// +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +wsrep_node_name=node_1 +bind-address=:: + +[mysqld.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +wsrep_node_name=node_2 +wsrep_sst_donor=node_1 +bind-address=:: + +[mysqld.3] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.3.port' +wsrep_node_name=node_3 +wsrep_sst_donor=node_1 +bind-address=:: + +[SST] +transferfmt=@ENV.MTR_GALERA_TFMT +streamfmt=xbstream +# Not needed, but left here for debugging: +sockopt=",pf=ip6" diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test new file mode 100644 index 00000000..2ed69ea9 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test @@ -0,0 +1,74 @@ +--let galera_connection_address=::1 +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/check_ipv6.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc +--source include/force_restart.inc + +# Confirm that initial handshake happened over ipv6 + +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Force IST + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +DROP TABLE t1; + +# Confirm that key messages around SST and IST reference IPv6 + +--connection node_1 +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err +--let $assert_only_after = CURRENT_TEST + +# The SSTs happen when nodes are started first time +--let $assert_count = 2 +--let $assert_text = Streaming the backup to joiner at \[::1\] +--let $assert_select = Streaming the backup to joiner at \[::1\] +--source include/assert_grep.inc + +# There will be 3 ISTs donated from node_1 in Galera 4. +# Two first happen at the initial startup to populate the certification +# index. The third one is from the IST which happens during the actual test. +--let $assert_count = 3 +--let $assert_text = async IST sender starting to serve tcp://\[::1\]: +--let $assert_select = async IST sender starting to serve tcp://\[::1\]: +--source include/assert_grep.inc + +--connection node_2 +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err +--let $assert_only_after = CURRENT_TEST + +# There are two ISTs on joiner, the first at the initial startup, the second +# during the actual test. +--let $assert_count = 2 +--let $assert_text = IST receiver addr using tcp://\[::1\] +--let $assert_select = IST receiver addr using tcp://\[::1\] +--source include/assert_grep.inc + +# The receiver expects IST +--let $assert_count = 2 +--let $assert_text = , listening at: tcp://\[::1\] +--let $assert_select = , listening at: tcp://\[::1\] +--source include/assert_grep.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf new file mode 100644 index 00000000..0a54fb8e --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf @@ -0,0 +1,28 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep_sst_method=rsync + +[mysqld.1] +wsrep-cluster-address=gcomm:// +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +bind-address=:: + +[mysqld.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +bind-address=:: + +[mysqld.3] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.3.port' +bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test new file mode 100644 index 00000000..27e71da2 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test @@ -0,0 +1,93 @@ +--let galera_connection_address=::1 +--source include/galera_cluster.inc +--source include/check_ipv6.inc +--source include/force_restart.inc + +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to'"); +call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos"); + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE USER 'sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; + +--let $wsrep_sst_auth_orig = `SELECT @@wsrep_sst_auth` +SET GLOBAL wsrep_sst_auth = 'sst:'; + +--connection node_2 +--source include/wait_until_connected_again.inc +--let $wsrep_sst_method_orig = `SELECT @@wsrep_sst_method` +--let $wsrep_sst_receive_address_orig = `SELECT @@wsrep_sst_receive_address` + +--disable_query_log +--eval SET GLOBAL wsrep_sst_receive_address = '[::1]:$NODE_MYPORT_2'; +--enable_query_log +SET GLOBAL wsrep_sst_method = 'mysqldump'; + +# +# Force mysqldump SST +# + +#--connection node_2 +#--source suite/galera/include/galera_stop_replication.inc + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--echo Cleaning var directory ... +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data + +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +--echo Starting server ... +--let $start_mysqld_params = --wsrep_sst_auth=sst: --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=[::1].1:$NODE_MYPORT_2 +let $restart_noprint=2; +--source include/start_mysqld.inc + +#--source suite/galera/include/galera_start_replication.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +DROP TABLE t1; + +# Confirm that initial handshake happened over ipv6 + +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; + +# restart node so we don't fail on WSREP_START_POSITION internal check +--source include/restart_mysqld.inc +--source include/wait_until_connected_again.inc + +--source ../galera/include/auto_increment_offset_restore.inc +--source suite/galera/include/galera_sst_restore.inc +--connection node_2 +CALL mtr.add_suppression("Unsupported protocol downgrade: incremental data collection disabled. Expect abort"); + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf new file mode 100644 index 00000000..0a54fb8e --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf @@ -0,0 +1,28 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep_sst_method=rsync + +[mysqld.1] +wsrep-cluster-address=gcomm:// +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +bind-address=:: + +[mysqld.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +bind-address=:: + +[mysqld.3] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.3.port' +bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test new file mode 100644 index 00000000..04a88675 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test @@ -0,0 +1,34 @@ +--let galera_connection_address=::1 +--source include/galera_cluster.inc +--source include/check_ipv6.inc +--source include/force_restart.inc + +# Confirm that initial handshake happened over ipv6 + +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Force IST + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf new file mode 100644 index 00000000..35196700 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf @@ -0,0 +1,33 @@ +!include ../galera_3nodes.cnf + +# decoy value - should not be read by mysqld or sst scripts +[mysqld] +innodb-data-home-dir=/tmp + +[mysqld] +innodb-data-home-dir= +wsrep_sst_method=rsync + +[mysqld.1] +wsrep-cluster-address=gcomm:// +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +bind-address=:: + +[mysqld.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +bind-address=:: + +[mysqld.3] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.3.port' +bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test new file mode 100644 index 00000000..04a88675 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test @@ -0,0 +1,34 @@ +--let galera_connection_address=::1 +--source include/galera_cluster.inc +--source include/check_ipv6.inc +--source include/force_restart.inc + +# Confirm that initial handshake happened over ipv6 + +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Force IST + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf new file mode 100644 index 00000000..303087df --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf @@ -0,0 +1,11 @@ +!include ../galera_3nodes.cnf + +[mysqld.1] +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' + +[mysqld.2] +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' + +[mysqld.3] +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' + diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test new file mode 100644 index 00000000..210a4c23 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test @@ -0,0 +1,116 @@ +# +# Test that if the gcache rolls over while IST is in progress, IST will still complete. +# This is achieved by using the ist_sender_send_after_get_buffers Galera dbug sync point to block the donor after +# the first gcache buffer has been locked for IST. +# +# After IST blocks, we roll over the gcache and resume IST to confirm that it completes successfully. +# +# Two nodes perform IST at the same time in order to make the test more stressfull +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +INSERT INTO t1 VALUES (01), (02), (03), (04), (05); + +# Disconnect nodes #2 and #3 +--connection node_2 +--let $wsrep_cluster_address_orig2 = `select @@wsrep_cluster_address` +--source suite/galera/include/galera_stop_replication.inc + +--connection node_3 +--let $wsrep_cluster_address_orig3 = `select @@wsrep_cluster_address` +--source suite/galera/include/galera_stop_replication.inc + +--connection node_1 +--source include/wait_until_connected_again.inc +INSERT INTO t1 VALUES (11), (12), (13), (14), (15); + +# Wait until nodes #2 and #3 have left +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (21), (22), (23), (24), (25); + +# Make sure IST will block ... +--let $galera_sync_point = ist_sender_send_after_get_buffers +--source include/galera_set_sync_point.inc + +# ... and restart providers to force IST +--connection node_2 +--disable_query_log +SET GLOBAL wsrep_cluster_address=''; +--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig2'; +--enable_query_log + +--connection node_1 +INSERT INTO t1 VALUES (31), (32), (33), (34), (35); + +--connection node_3 +--disable_query_log +SET GLOBAL wsrep_cluster_address=''; +--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig3'; +--enable_query_log + +--connection node_1 +--sleep 2 +SHOW STATUS LIKE 'wsrep_debug_sync_waiters'; + +INSERT INTO t1 VALUES (41), (42), (43), (44), (45); + +# Roll over gcache by writing a lot of information to it + +CREATE TABLE t2 (f1 LONGTEXT); +INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); +INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); +INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); + +# Unlock IST and wait for it to complete +--source include/galera_clear_sync_point.inc +--source include/galera_signal_sync_point.inc + +INSERT INTO t1 VALUES (51), (52), (53), (54), (55); + +--connection node_2 +--source include/wait_until_connected_again.inc + +--connection node_3 +--source include/wait_until_connected_again.inc + +sleep 5; + +# Final checks +--connection node_2 +SELECT COUNT(*) = 30 FROM t1; +SELECT COUNT(*) = 3 FROM t2; +SELECT LENGTH(f1) = 512 * 1024 FROM t2; +CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); + +# Final checks +--connection node_3 +SELECT COUNT(*) = 30 FROM t1; +SELECT COUNT(*) = 3 FROM t2; +SELECT LENGTH(f1) = 512 * 1024 FROM t2; +CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); + +DROP TABLE t1, t2; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc + +--let $galera_cluster_size=3 +--source include/galera_end.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test new file mode 100644 index 00000000..db8bf90c --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test @@ -0,0 +1,270 @@ +# +# Tests handling of several configuration changes while a joiner gets +# state transfer +# +# Variant A: sending of state transfer request delayed until two more +# primary configuration changes happen +# +# Refs codersihp/galera-bugs#454 +# +--source include/have_innodb.inc +--source include/galera_cluster.inc +--source include/galera_have_debug_sync.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 1); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc + +# +# Isolate node_1 and update cluster state to force node 1 into joiner mode +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (2, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; +--source include/wait_condition.inc + +# +# Now reconnect node_1 but first make it block before sending state transfer +# request +# +# THIS IS PC1 +# +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET wsrep_sync_wait = 0; +SET wsrep_on = OFF; +--let $galera_sync_point = after_shift_to_joining +--source include/galera_set_sync_point.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (3, 2); + +--connection node_1a +--source include/galera_wait_sync_point.inc +# +# At this point every node thinks that node_1 is in a JOINER state +# + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +# +# Now that node_1 sent state request and became JOINER isolate node_1 again +# and commit one more action, so that node_1 loses JOINER state +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (4, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +# +# Reconnect node_1 again +# +# THIS IS PC2 +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# After this point node_1 is no longer JOINER and is required to start the +# whole procedure over because it missed some actions (4th insert into t1) +# + +INSERT INTO t1 VALUES (5, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +# +# Now let node_1 continue with IST and finish processing PC1, but make it +# block when processing PC2 just before sending state transfer request +# +--connection node_1a +--let $galera_sync_point = before_send_state_request +--source include/galera_set_sync_point.inc +--let $galera_sync_point = after_shift_to_joining +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = before_send_state_request +--source include/galera_wait_sync_point.inc + +# since PC1 has been processed node_1 must have 3 rows in t1 +# 2 were there before PC1 and one was added while in PC1 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +# +# Now disconnect and reconnect node_1 again to get PC3 +# It still is blocked before sending state transfer request in PC2. +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (6, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 6 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# This is PC3 +# + +INSERT INTO t1 VALUES (7, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1; +--source include/wait_condition.inc + +# +# Now disconnect and reconnect node_1 again to get PC4 and allow node_1 +# to send state transfer request to be delivered in PC4 (and thus get +# updated to PC4 seqno in state transfer. +# Note that node_1 still processes PC2. +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (8, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# This is PC4. node_1 is still processing PC2, waiting to send state trasfer +# request +# +--connection node_1a +--let $galera_sync_point = process_primary_configuration +--source include/galera_set_sync_point.inc +--let $galera_sync_point = before_send_state_request +--source include/galera_signal_sync_point.inc +# sent STR from PC2 into PC4 + +--let $galera_sync_point = process_primary_configuration +--source include/galera_wait_sync_point.inc +# +# Now node_1 is processing PC3, but should have completed state transfer from +# PC4 and thus must have 8 rows in t1 +# +--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; +--source include/wait_condition.inc + +--connection node_2 +INSERT INTO t1 VALUES (9, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 9 FROM t1; +--source include/wait_condition.inc + +--connection node_1a +#--let $galera_sync_point = process_primary_configuration +--source include/galera_signal_sync_point.inc +--source include/galera_wait_sync_point.inc +# +# Now node_1 is processing PC4, still must have 8 rows in t1 +# +--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; +--source include/wait_condition.inc + +#--let $galera_sync_point = process_primary_configuration +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc + +--let $wait_condition = SELECT COUNT(*) = 9 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +DROP TABLE t1; + +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--connection node_2 +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--connection node_3 +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test new file mode 100644 index 00000000..55d6b458 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test @@ -0,0 +1,281 @@ +# +# Tests handling of several configuration changes while a joiner gets +# state transfer +# +# Variant B: sending of state transfer request is immediate but completion +# of IST delayed until two more primary configuration changes happen +# +# Refs codersihp/galera-bugs#454 +# +--source include/have_innodb.inc +--source include/galera_cluster.inc +--source include/galera_have_debug_sync.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 1); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc + +# +# Isolate node_1 and update cluster state to force node 1 into joiner mode +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (2, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; +--source include/wait_condition.inc + +# +# Now reconnect node_1 but first make it block before sending state transfer +# request +# +# THIS IS PC1 +# +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET wsrep_sync_wait = 0; +SET wsrep_on = OFF; +--let $galera_sync_point = after_shift_to_joining +--source include/galera_set_sync_point.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (3, 2); + +--connection node_1a +--source include/galera_wait_sync_point.inc +# +# At this point every node thinks that node_1 is in a JOINER state +# + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +# +# Now that node_1 sent state request and became JOINER isolate node_1 again +# and commit one more action, so that node_1 loses JOINER state +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (4, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +# +# Reconnect node_1 again +# +# THIS IS PC2 +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# After this point node_1 is no longer JOINER and is required to start the +# whole procedure over because it missed some actions (4th insert into t1) +# + +INSERT INTO t1 VALUES (5, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +# +# Now let node_1 continue with IST and finish processing PC1, but make it +# block when processing PC2 right after progressing to JOINER state and +# before IST happens. +# +--connection node_1a +--let $galera_sync_point = before_send_state_request +--source include/galera_set_sync_point.inc +--let $galera_sync_point = after_shift_to_joining +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = before_send_state_request +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc +# Here node_1 is processing PC2 just before sending state request + +# since PC1 has been processed node_1 must have 3 rows in t1 +# 2 were there before PC1 and one was added while in PC1 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +# Proceed to sending state transfer request and block right after +--source include/galera_signal_sync_point.inc # before_send_state_request +--let $galera_sync_point = after_shift_to_joining +--source include/galera_wait_sync_point.inc +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; + +# +# Now disconnect and reconnect node_1 again to get PC3 +# It is blocked right after shifting to JOINING state. +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (6, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 6 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# This is PC3 +# + +INSERT INTO t1 VALUES (7, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1; +--source include/wait_condition.inc + +# +# Now disconnect and reconnect node_1 again to get PC4 and allow node_1 +# to continue with IST. +# Note that node_1 still processes PC2 and is joining. +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (8, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# This is PC4. node_1 is still processing PC2, waiting to send state trasfer +# request +# +--connection node_1a +--let $galera_sync_point = process_primary_configuration +--source include/galera_set_sync_point.inc +--let $galera_sync_point = after_shift_to_joining +--source include/galera_signal_sync_point.inc +# continue with IST prepared for in PC2 + +--let $galera_sync_point = process_primary_configuration +--source include/galera_wait_sync_point.inc +# +# Now node_1 is processing PC3, and should have finished state transfer +# State tranfer request was dilivered before PC3, so node_1 should have +# received IST up to 4 rows in t1 (what was there before PC2) plus one more +# INSERT while in PC2. +# +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +--connection node_2 +INSERT INTO t1 VALUES (9, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 9 FROM t1; +--source include/wait_condition.inc + +--connection node_1a +#--let $galera_sync_point = process_primary_configuration +--source include/galera_signal_sync_point.inc +--source include/galera_wait_sync_point.inc +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; +# +# Now node_1 is processing PC4, still must have 8 rows in t1 +# +--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; +--source include/wait_condition.inc + +#--let $galera_sync_point = process_primary_configuration +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc + +--let $wait_condition = SELECT COUNT(*) = 9 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +DROP TABLE t1; + +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--connection node_2 +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--connection node_3 +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test new file mode 100644 index 00000000..d1111e9f --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test @@ -0,0 +1,307 @@ +# +# Tests handling of several configuration changes while a joiner gets +# state transfer +# +# Variant C: sending of state transfer request is scheduled while in non-PRIM +# +# Refs codersihp/galera-bugs#454 +# +--source include/have_innodb.inc +--source include/galera_cluster.inc +--source include/galera_have_debug_sync.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 1); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc + +# +# Isolate node_1 and update cluster state to force node 1 into joiner mode +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (2, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; +--source include/wait_condition.inc + +# +# Now reconnect node_1 but first make it block before sending state transfer +# request +# +# THIS IS PC1 +# +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET wsrep_sync_wait = 0; +SET wsrep_on = OFF; +--let $galera_sync_point = after_shift_to_joining +--source include/galera_set_sync_point.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (3, 2); + +--connection node_1a +--source include/galera_wait_sync_point.inc +# +# At this point every node thinks that node_1 is in a JOINER state +# + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +# +# Now that node_1 sent state request and became JOINER isolate node_1 again +# and commit one more action, so that node_1 loses JOINER state +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (4, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +# +# Reconnect node_1 again +# +# THIS IS PC2 +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# After this point node_1 is no longer JOINER and is required to start the +# whole procedure over because it missed some actions (4th insert into t1) +# + +INSERT INTO t1 VALUES (5, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +# +# Now let node_1 continue with IST and finish processing PC1, but make it +# block when processing PC2 right after progressing to JOINER state and +# before IST happens. +# +--connection node_1a +--let $galera_sync_point = before_send_state_request +--source include/galera_set_sync_point.inc +--let $galera_sync_point = after_shift_to_joining +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = before_send_state_request +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc +# Here we are processing PC2 just before sending state request + +# since PC1 has been processed node_1 must have 3 rows in t1 +# 2 were there before PC1 and one was added while in PC1 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +# +# Now disconnect and reconnect node_1 again to get PC3 +# It still is blocked before sending state transfer request in PC2. +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Proceed to sending state transfer request +--connection node_1a +--let $galera_sync_point = after_shift_to_joining +--source include/galera_set_sync_point.inc +--let $galera_sync_point = before_send_state_request +--source include/galera_signal_sync_point.inc # before_send_state_request +# +# node_1 proceeds to sending state transfer request, it will be delivered only +# in the next PC which is PC3. Only then the node will shift to JOINING +# +--echo 4 +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; + +--connection node_3 +INSERT INTO t1 VALUES (6, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 6 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# This is PC3 +# + +INSERT INTO t1 VALUES (7, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1; +--source include/wait_condition.inc + +# node_1 is stiil processing PC2, it was let to send state transfer request +# while in non-PRIM. Now it should be able to complete it and shift to +# JOINING. Make it block on next PC(3) and continue to receive IST +--connection node_1a +--let $galera_sync_point = after_shift_to_joining +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc # won't need it any more +--let $galera_sync_point = process_primary_configuration +--source include/galera_set_sync_point.inc +--let $galera_sync_point = after_shift_to_joining +--source include/galera_signal_sync_point.inc +# continue with IST while still processing PC2 + +# +# Now disconnect and reconnect node_1 again to generate PC4. +# +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (8, 3); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +# +# This is PC4. node_1 should complete IST, complete PC2, and continue +# with the next item in queue +# +--connection node_1a +--let $galera_sync_point = process_primary_configuration +--source include/galera_wait_sync_point.inc + +# +# Now node_1 is blocked before processing PC3, and should have finished state +# transfer started while in PC2. +# State tranfer request was dilivered in PC3 to donor, so node_1 should have +# received IST up to 6 rows in t1 (what was there before PC3). +# +--let $wait_condition = SELECT COUNT(*) = 6 FROM t1; +--source include/wait_condition.inc + +--connection node_2 +INSERT INTO t1 VALUES (9, 2); + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 9 FROM t1; +--source include/wait_condition.inc + +--connection node_1a +# continue with processing PC3 +--let $galera_sync_point = process_primary_configuration +--source include/galera_signal_sync_point.inc + +# wait for row that follows PC3 +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1; +--source include/wait_condition.inc + +# wait till PC4 +--let $galera_sync_point = process_primary_configuration +--source include/galera_wait_sync_point.inc +# +# Now node_1 is processing PC4, still must have 7 rows in t1 +# +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1; +--source include/wait_condition.inc + +# Continue with PC4 +--let $galera_sync_point = process_primary_configuration +--source include/galera_clear_sync_point.inc +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = after_shift_to_joining +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc +--source include/galera_signal_sync_point.inc + +--let $wait_condition = SELECT COUNT(*) = 9 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +DROP TABLE t1; + +call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)"); +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--connection node_2 +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--connection node_3 +call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test new file mode 100644 index 00000000..84629c96 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test @@ -0,0 +1,75 @@ +# +# This test performs two dependent updates on two nodes and checks the results on the third where +# parallel apply is enabled. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_3 +SET GLOBAL wsrep_slave_threads = 2; + +--connection node_1_ctrl +SET SESSION wsrep_sync_wait=0; + +# +# We will make the following UPDATE depend on the UPDATE below +# +--connection node_1 +SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; +--send UPDATE t1 SET f1 = f1 + 10; + +--connection node_1_ctrl +SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; +SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; + +--connection node_2 +--send UPDATE t1 SET f1 = f1 + 100; + +# +# Let's wait for the first UPDATE the be BF aborted +# +--connection node_1_ctrl +SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; + +# +# and make sure the second has committed +# +--let $wait_condition = SELECT VARIABLE_VALUE > $wsrep_last_committed_before FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +# +# now release the first UPDATE. +# +SET GLOBAL debug_dbug = NULL; +SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; + +# +# Both UPDATEs should succeed. +# +--connection node_1 +--reap + +--connection node_2 +--reap + +--connection node_3 +SELECT f1 = 111 FROM t1; +SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%'; + +SET GLOBAL wsrep_slave_threads = DEFAULT; + +DROP TABLE t1; + +--connection node_1 +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.cnf b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.cnf new file mode 100644 index 00000000..d560b675 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.cnf @@ -0,0 +1,5 @@ +# We need a dedicated .cnf file, even if empty, in order to force this test to run +# alone on a freshly started cluster. Otherwise there are adverse interactions with +# prior tests such as galera_3nodes.galera_innobackupex_backup + +!include ../galera_3nodes.cnf diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test new file mode 100644 index 00000000..58a67c7b --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test @@ -0,0 +1,124 @@ +# +# Test the operation of pc.bootstrap +# +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +call mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\).*"); + +# +# Create connection node_3 and save auto increment variables. +# +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--let $node_1 = node_1 +--let $node_2 = node_2 +--let $node_3 = node_3 + +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 + +CREATE TABLE t1 (f1 INTEGER); + +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# Force all nodes to become non-primary + +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--connection node_2 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--connection node_3 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +# Node #3 should be non-primary +--let $wait_condition = SELECT variable_value = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--connection node_2 +# Node #2 should be non-primary +--let $wait_condition = SELECT variable_value = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +# Signal node #2 to bootstrap +SET GLOBAL wsrep_provider_options = 'pc.bootstrap=1'; + +# Wait until node becomes available for queries again +--source include/wait_until_connected_again.inc + +# Node #2 should now be a primary of a 1-node cluster + +SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_status'; + +# Perform an insert on node #2 +INSERT INTO t1 VALUES (1); + +# Reconnect all nodes +--connection node_2 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; + +--source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + + +--connection node_1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +--source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + + +--connection node_3 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; + +--source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Check that all nodes have the same view of the database + +--connection node_1 +SELECT COUNT(*) FROM t1; + +--connection node_2 +SELECT COUNT(*) FROM t1; + +--connection node_3 +SELECT COUNT(*) FROM t1; + +# Test cleanup +DROP TABLE t1; + +# +# Restore auto increment variables. +# +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf new file mode 100644 index 00000000..833c1437 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf @@ -0,0 +1,5 @@ +# We need a dedicated .cnf file, even if empty, in order to force this test +# to run alone on a freshly started cluster. Otherwise there are adverse +# interactions with following tests such as +# galera_3nodes.galera_var_dirty_reads2 +!include ../galera_3nodes.cnf diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test new file mode 100644 index 00000000..8a1c93a7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test @@ -0,0 +1,142 @@ +# +# Test the pc.weight wsrep provider option. We set Node #1 to have a high +# weight and then suspend it. This will cause Nodes #2 and #3 to transition +# to non-primary component. +# + +--source include/big_test.inc +--source include/galera_cluster.inc + +--connection node_1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +SET GLOBAL wsrep_provider_options = 'pc.weight=3'; +SELECT VARIABLE_VALUE AS expect_5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; + +# Isolate node_1 from the cluster. +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--connection node_2 +# Do not wait for causality as we are no longer in the primary component +SET SESSION wsrep_sync_wait=0; +SET SESSION wsrep_on=OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' +--source include/wait_condition.inc +SET SESSION wsrep_on=ON; + +# We can not use SELECT queries here, as only SHOW is allowed to run. +# For nodes #2 and #3, we expect a non-primary component of size 2 +# and cluster weight 0 +SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_weight'; +SHOW STATUS LIKE 'wsrep_cluster_status'; +SHOW STATUS LIKE 'wsrep_connected'; +SHOW STATUS LIKE 'wsrep_ready'; +SHOW STATUS LIKE 'wsrep_local_state'; +SHOW STATUS LIKE 'wsrep_local_state_comment'; + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc +--connection node_3 +SET SESSION wsrep_sync_wait=0; +SET SESSION wsrep_on=OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' +--source include/wait_condition.inc +SET SESSION wsrep_on=ON; + +SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_weight'; +SHOW STATUS LIKE 'wsrep_cluster_status'; +SHOW STATUS LIKE 'wsrep_connected'; +SHOW STATUS LIKE 'wsrep_ready'; +SHOW STATUS LIKE 'wsrep_local_state'; +SHOW STATUS LIKE 'wsrep_local_state_comment'; + +--connection node_1 + +# For Node #1, we expect a primary component of size 1 +# (NOTE: this is a bit racy as nodes 2 and 3 will try to reconnect ASAP. +# to avoid the raice they should be suspended first as well, but that's +# not currently possible) + +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; +SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; + +SET GLOBAL wsrep_provider_options = 'pc.weight=1'; +SELECT VARIABLE_VALUE AS expect_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; + +# Resume cluster connectivity on node_1 +--connection node_1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +--connection node_2 +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +--connection node_3 +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +# wait until nodes 2 and 3 have declared ready state (can happen after cluster_size raaise) +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc + +--connection node_3 +--source include/wait_condition.inc + + +# On all nodes, we now expect a Primary component of size 3, weight 3, Synced and ready +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; +SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; + +--connection node_2 +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; +SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; + +--connection node_1 +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; +SELECT VARIABLE_VALUE AS expect_ON FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; +SELECT VARIABLE_VALUE AS expect_Synced FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; + +SET GLOBAL wsrep_provider_options = 'pc.weight=1'; +--let $wait_condition = SELECT @@wsrep_provider_options LIKE '%pc.weight = 1%' +--source include/wait_condition.inc + +CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); + +--connection node_2 +CALL mtr.add_suppression('SYNC message from member'); +CALL mtr.add_suppression('user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); +CALL mtr.add_suppression('overriding reported weight for'); + +--connection node_3 +CALL mtr.add_suppression('WSREP: user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); +CALL mtr.add_suppression('overriding reported weight for'); diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.cnf b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.cnf new file mode 100644 index 00000000..880a413f --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.cnf @@ -0,0 +1,10 @@ +!include ../galera_3nodes.cnf + +[mysqld.1] +wsrep_debug=1 + +[mysqld.2] +wsrep_debug=1 + +[mysqld.3] +wsrep_debug=1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test new file mode 100644 index 00000000..65b4000c --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test @@ -0,0 +1,220 @@ +# +# Test the safe_to_bootstrap in grastate.dat +# +--source include/galera_cluster.inc +--source include/force_restart.inc + +# +# Create connection node_3 and save auto increment variables. +# +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--let $node_1 = node_1 +--let $node_2 = node_2 +--let $node_3 = node_3 + +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# +# At start, all grastate.dat files have safe_to_boostrap: 0 +# + +--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 0' +--let $assert_select= safe_to_bootstrap: 0 +--let $assert_count= 1 + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat +--source include/assert_grep.inc + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--source include/assert_grep.inc + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat +--source include/assert_grep.inc + +# +# Shut down one node +# + +--connection node_2 +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Still, all grastate.dat files should have safe_to_boostrap: 0 + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat +--source include/assert_grep.inc + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--source include/assert_grep.inc + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat +--source include/assert_grep.inc + +# +# Shut down one more node +# + +--connection node_3 +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Now, nodes 2,3 should have safe_to_boostrap: 0 + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--source include/assert_grep.inc + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat +--source include/assert_grep.inc + +# But node #1 should have safe_to_boostrap: 1 + +--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 1' +--let $assert_select= safe_to_bootstrap: 1 + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat +--source include/assert_grep.inc + +# Restart one node +--connection node_2 +let $restart_noprint=2; +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# All nodes should be back to 'safe_to_bootstrap: 0' + +--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 0' +--let $assert_select= safe_to_bootstrap: 0 + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat +--source include/assert_grep.inc + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--source include/assert_grep.inc + +--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat +--source include/assert_grep.inc + +# +# Kill the cluster +# + +--connection node_2 +--source include/shutdown_mysqld.inc + +--connection node_1 +SET SESSION wsrep_on = OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--source ../galera/include/kill_galera.inc + +# +# Only node #1 should have safe_to_bootstrap: 1 +# include/assert_grep.inc requires a running server, so we revert to simple grep +# + +--error 0 +--exec grep 'safe_to_bootstrap: 1' $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat + +--error 0 +--exec grep 'safe_to_bootstrap: 0' $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat + +--error 0 +--exec grep 'safe_to_bootstrap: 0' $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat + +# +# Attempt to bootstrap nodes #2, #3, should fail +# + +--error 1 +--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-new-cluster --wsrep-cluster-address='gcomm://' | grep 'This node is not safe to bootstrap the cluster' +--error 1 +--exec $MYSQLD --defaults-group-suffix=.3 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-new-cluster --wsrep-cluster-address='gcomm://' | grep 'This node is not safe to bootstrap the cluster' + +# +# Attempt to bootstrap starting from node #1, should succeed +# + +--connection node_1 +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +let $restart_noprint=2; +--source include/start_mysqld.inc +--source include/wait_until_connected_again.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + + +--connection node_2 +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +let $restart_noprint=2; +--source include/start_mysqld.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + + +--connection node_3 +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect +let $restart_noprint=2; +--source include/start_mysqld.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); +CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); +CALL mtr.add_suppression("WSREP: wsrep::connect(.*) failed: 7"); +CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); +CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); +CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); +CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("Plugin 'wsrep' init function returned error."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed."); +CALL mtr.add_suppression("Failed to initialize plugins."); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()"); + +--connection node_3 +CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); +CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); +CALL mtr.add_suppression("WSREP: wsrep::connect(.*) failed: 7"); +CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); +CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); +CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); +CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("Plugin 'wsrep' init function returned error."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed."); +CALL mtr.add_suppression("Failed to initialize plugins."); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()"); + +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +# +# Restore auto increment variables. +# +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf b/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf new file mode 100644 index 00000000..65d15992 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf @@ -0,0 +1,10 @@ +!include ../galera_3nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.root.crt;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.1.crt;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.1.key' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.root.crt;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.1.crt;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.1.key' + +[mysqld.3] +wsrep_provider_options='base_port=@mysqld.3.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.root.crt;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.1.crt;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera_certs/galera.1.key' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.test b/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.test new file mode 100644 index 00000000..714d4b3f --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.test @@ -0,0 +1,71 @@ +# +# Test reloading of Galera SSL certificate without shutting down node +# + +--source include/galera_cluster.inc +--source include/have_openssl.inc +--source include/have_ssl_communication.inc + +--let $galera_version=26.4.8 +source ../../wsrep/include/check_galera_version.inc; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +# Setup galera ports +--connection node_1 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT + +--connection node_2 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT + +# Setup temporary file for SSL reloading +let $ssl_cert = $MYSQLTEST_VARDIR/tmp/ssl_cert.pem; +let $ssl_key = $MYSQLTEST_VARDIR/tmp/ssl_key.pem; +let $ssl_ca = $MYSQLTEST_VARDIR/tmp/ssl_ca.pem; + +copy_file std_data/galera_certs/galera.root.crt $ssl_ca; +copy_file std_data/galera_certs/galera.1.crt $ssl_cert; +copy_file std_data/galera_certs/galera.1.key $ssl_key; + +--connection node_2 +--source include/shutdown_mysqld.inc +--let $restart_noprint=1 +--let $restart_parameters = --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1 --wsrep_provider_options=base_port=$NODE_GALERAPORT_2;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera_certs/galera.root.crt;socket.ssl_cert=$MYSQLTEST_VARDIR/tmp/ssl_cert.pem;socket.ssl_key=$MYSQLTEST_VARDIR/tmp/ssl_key.pem +--source include/start_mysqld.inc +--source include/galera_wait_ready.inc + +# Set certificate and key and reload by setting directly `wsrep_provider_options` +remove_file $ssl_cert; +remove_file $ssl_key; +copy_file std_data/galera_certs/galera.2.crt $ssl_cert; +copy_file std_data/galera_certs/galera.2.key $ssl_key; +SET GLOBAL wsrep_provider_options = 'socket.ssl_reload=1'; + +--connection node_3 +--source include/shutdown_mysqld.inc +--let $restart_parameters = --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 +--source include/start_mysqld.inc + +# Set certificate and key and reload by executing `FLUSH SSL` +--connection node_2 +remove_file $ssl_cert; +remove_file $ssl_key; +copy_file std_data/galera_certs/galera.1.crt $ssl_cert; +copy_file std_data/galera_certs/galera.1.key $ssl_key; +FLUSH SSL; + +# Cleanup +remove_file $ssl_ca; +remove_file $ssl_cert; +remove_file $ssl_key; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_toi_vote.cnf b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.cnf new file mode 100644 index 00000000..4c5e4854 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.cnf @@ -0,0 +1,5 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 +wsrep_sync_wait=0 diff --git a/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test new file mode 100644 index 00000000..7b5682ed --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test @@ -0,0 +1,67 @@ +# +# This test tests that TOI failure on 2 nodes (master and slave) for the +# same reason, wins over success on a third slave. +# In particular this tests that master and slave TOI cast the same vote for +# the same error +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +# create inconsistency on node 3 +--connection node_3 +SET SESSION wsrep_on=OFF; +DROP SCHEMA test; + +# This should fail on nodes 1 and 2 and succeed on node 3 +--connection node_1 +--error ER_DB_CREATE_EXISTS +CREATE SCHEMA test; + +--connection node_1 +SET SESSION wsrep_sync_wait=0; +# wait for node 3 to drop from the cluster +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--connection node_2 +SET SESSION wsrep_sync_wait=0; +# wait for node 3 to drop from the cluster +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--connection node_3 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +# need to reinitialize connection due to a "Bad handshake" bug +--disconnect node_3 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# reconnect node 3, since it failed +--source include/kill_galera.inc +--source include/wait_until_disconnected.inc +--source include/start_mysqld.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc + +CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster."); + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test new file mode 100644 index 00000000..cbee81b7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test @@ -0,0 +1,130 @@ +# +# Additional tests for wsrep_dirty_reads +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc + +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +SET SESSION wsrep_dirty_reads = 1; + +# Those statements should succeed + +--error 0 +SELECT f1 FROM t1; + +--error 0 +USE test; + +--error 0 +SHOW CREATE TABLE t1; + +--error 0 +LOCK TABLE t1 WRITE; + +--error 0 +UNLOCK TABLES; + +--error 0 +FLUSH TABLES WITH READ LOCK; + +--error 0 +UNLOCK TABLES; + +--error 0 +PREPARE stmt_select FROM 'SELECT f1 FROM t1'; + +--error 0 +EXECUTE stmt_select; + +--error 0 +PREPARE stmt_update FROM 'UPDATE t1 SET f1 = f1 + f1'; + +# Mysqldump should succeed + +SET GLOBAL wsrep_dirty_reads = 1; +SET GLOBAL wsrep_sync_wait = 0; +--error 0 +--exec $MYSQL_DUMP -u root -S $NODE_MYSOCK_2 test >/dev/null +SET GLOBAL wsrep_dirty_reads = 0; +SET GLOBAL wsrep_sync_wait = 15; + +# Those statements should fail + +SET SESSION wsrep_dirty_reads = 1; + +--error ER_UNKNOWN_COM_ERROR +INSERT INTO t1 SELECT * FROM t1; + +--error ER_UNKNOWN_COM_ERROR +DELETE FROM t1; + +--error ER_UNKNOWN_COM_ERROR +UPDATE t1 SET f1 = f1 + 1; + +--error ER_UNKNOWN_COM_ERROR +DROP TABLE t1; + +--error ER_UNKNOWN_COM_ERROR +EXECUTE stmt_update; + +# With wsrep_dirty_reads = 0 , even SELECTS are not allowed + +SET SESSION wsrep_dirty_reads = 0; + +--error ER_UNKNOWN_COM_ERROR +SELECT * FROM t1; + +--error ER_UNKNOWN_COM_ERROR +EXECUTE stmt_select; + +# But reads from INFORMATION_SCHEMA are allowed + +--error 0 +SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST; + +# Restore cluster +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +--source include/galera_wait_ready.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +DROP TABLE t1; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.cnf b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.cnf new file mode 100644 index 00000000..e255e1d5 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test new file mode 100644 index 00000000..70d58cb2 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test @@ -0,0 +1,93 @@ +# +# Test that mysqldump SST is possible after a vote without a cluster restart +# + +--source include/galera_cluster.inc +--source suite/galera/include/galera_sst_set_mysqldump.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +# Introduce inconsistency on node #2 + +--connection node_2 +--let $wsrep_cluster_address_node2 = `SELECT @@wsrep_cluster_address` +SET SESSION wsrep_on=OFF; +ALTER TABLE t1 ADD PRIMARY KEY (f1); +SET SESSION wsrep_on=ON; + +# Run DDL that will fail on nodes #1 and #3 but succeed on node #2 + +--connection node_1 +--error ER_CANT_DROP_FIELD_OR_KEY +ALTER TABLE t1 LOCK=SHARED, DROP PRIMARY KEY; + +# Nodes #1 and #3 remain in the cluster + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; + +--connection node_3 +SELECT VARIABLE_VALUE AS expect_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; + +# Node #2 is kicked out + +--connection node_2 +SET SESSION wsrep_on=OFF; +SELECT VARIABLE_VALUE AS expect_Disconnected FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SET SESSION wsrep_on=ON; + +# Restore cluster + +--disable_query_log +--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node2' +--enable_query_log +--enable_reconnect + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; + +# Confirm that the table is now identical throughout + +--connection node_1 +SHOW CREATE TABLE t1; + +--connection node_2 +SET SESSION wsrep_on=OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--source include/galera_wait_ready.inc +SET SESSION wsrep_on=ON; + +# restart node so we don't fail on WSREP_START_POSITION internal check +--source include/restart_mysqld.inc +--source include/wait_until_connected_again.inc + +SHOW CREATE TABLE t1; +SELECT COUNT(*) AS expect_0 FROM t1; +CALL mtr.add_suppression("is inconsistent with group"); + +--connection node_3 +SHOW CREATE TABLE t1; +DROP TABLE t1; +CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that column/key exists'"); + +--connection node_1 +--source suite/galera/include/galera_sst_restore.inc + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test new file mode 100644 index 00000000..d6e20d3b --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test @@ -0,0 +1,81 @@ +# +# This test performs basic checks on the contents of the wsrep_schema +# +# wsrep_members_history checks are temporarily disabled until it +# can be made configurable. +# + +--source include/galera_cluster.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_1 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +# Make the test fail if table structure has changed + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +SHOW CREATE TABLE mysql.wsrep_cluster; +SHOW CREATE TABLE mysql.wsrep_cluster_members; + +# Checks for the wsrep_cluster table + +SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; + +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; + +# Checks for the wsrep_cluster_members table + +SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; + +SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members; + +SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'); + +SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members; + +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; + +--connection node_2 + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; + +--source include/shutdown_mysqld.inc + +--connection node_1 + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; + +SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members; + +--connection node_2 +let $restart_noprint=2; +--source include/start_mysqld.inc +--source include/wait_until_connected_again.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; + +SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; + +--connection node_1 +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; + +SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; + +--source ../galera/include/auto_increment_offset_restore.inc + +--disconnect node_3 diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.cnf b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.cnf new file mode 100644 index 00000000..317094ce --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.cnf @@ -0,0 +1,5 @@ +!include ../galera_3nodes.cnf + +[mysqld] +sql-safe-updates=1 +wsrep-debug=1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test new file mode 100644 index 00000000..7d8089a8 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test @@ -0,0 +1,58 @@ +# +# This test performs basic checks on the contents of the wsrep_schema +# +# wsrep_members_history checks are temporarily disabled until it +# can be made configurable. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_1 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +# Make the test fail if table structure has changed + +SHOW CREATE TABLE mysql.wsrep_cluster; +SHOW CREATE TABLE mysql.wsrep_cluster_members; +#disabled SHOW CREATE TABLE mysql.wsrep_member_history; +SELECT @@sql_safe_updates; + +# Checks for the wsrep_cluster table + +SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster; +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster; + +# Checks for the wsrep_cluster_members table + +SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members; +SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members; +SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'); + +SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members; +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; + +--connection node_2 + +SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members; +SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members; +SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'); + +SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members; +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; + +--connection node_3 +SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members; +SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members; +SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'); + +SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members; +SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; + +--source ../galera/include/auto_increment_offset_restore.inc + diff --git a/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf new file mode 100644 index 00000000..ae2cf806 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf @@ -0,0 +1,9 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-slave-threads=8 +wsrep-ignore-apply-errors=0 + +[ENV] +galera_cluster_size = 3 + diff --git a/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.test b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.test new file mode 100644 index 00000000..7a9c4e83 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.test @@ -0,0 +1,190 @@ +# +# Check that the node can cleanly shutdown in case of inconsistency +# (no locked up threads) +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_2 +SELECT @@wsrep_slave_threads = 8; + +# +# 1. Inconsistency on slave +# +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT); +INSERT INTO t1 VALUES (1, 0),(2, 0),(3, 0),(4, 0),(5, 0),(6, 0),(7, 0),(8, 0); + +--connection node_2 +# Allow 1K slave queue woithout flow control +SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K'; +# Introduce 2 inconsistencies +SET wsrep_on=OFF; +DELETE FROM t1 WHERE f1 = 2; +DELETE FROM t1 WHERE f1 = 4; +SET wsrep_on=ON; + +# Build up slave queue: +# - first 8 events will be picked by slave threads +# - one moreevent will be waiting in slave queue +LOCK TABLES t1 WRITE; +--connection node_1 +UPDATE t1 SET f2 = 1 WHERE f1 = 1; +UPDATE t1 SET f2 = 1 WHERE f1 = 2; +UPDATE t1 SET f2 = 1 WHERE f1 = 3; +UPDATE t1 SET f2 = 1 WHERE f1 = 4; +UPDATE t1 SET f2 = 2 WHERE f1 = 4; /* dependent applier */ +UPDATE t1 SET f2 = 3 WHERE f1 = 4; /* dependent applier */ +UPDATE t1 SET f2 = 1 WHERE f1 = 5; +UPDATE t1 SET f2 = 1 WHERE f1 = 6; +UPDATE t1 SET f2 = 1 WHERE f1 = 7; +UPDATE t1 SET f2 = 1 WHERE f1 = 8; + +--connection node_2 +# make sure all events landed to slave queue +SET wsrep_on=OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_recv_queue'; +--source include/wait_condition.inc +SET wsrep_on=ON; +UNLOCK TABLES; +--source include/wsrep_wait_disconnect.inc +# Wait for the node to shutdown replication +--let $members=0 +--source include/wsrep_wait_membership.inc + +--connection node_1 +--let $members=2 +--source include/wsrep_wait_membership.inc +--source include/wait_until_ready.inc +SHOW STATUS LIKE 'wsrep_cluster_size'; +SELECT * FROM t1; + +--connection node_2 +#Gracefully restart the node +SET GLOBAL wsrep_on=OFF; +--source include/shutdown_mysqld.inc +--source include/start_mysqld.inc +--source include/galera_wait_ready.inc + +--let $wait_condition = SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc +DROP TABLE t1; + +# +# 2. Inconsistency on master +# +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT); +START TRANSACTION; +INSERT INTO t1 VALUES (1, 0); +INSERT INTO t1 VALUES (2, 0); +INSERT INTO t1 VALUES (3, 0); +INSERT INTO t1 VALUES (4, 0); +INSERT INTO t1 VALUES (5, 0); +INSERT INTO t1 VALUES (6, 0); +INSERT INTO t1 VALUES (7, 0); +INSERT INTO t1 VALUES (8, 0); +COMMIT; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INT); + +--connection node_2 +# Allow 1K slave queue without flow control +SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K'; +# Introduce inconsistency +SET wsrep_on=OFF; +--let $wait_condition = SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +--source include/wait_condition.inc +DROP TABLE t2; +SET wsrep_on=ON; + +# set up sync point to ensure DROP TABLE replication order below +--let galera_sync_point = after_replicate_sync +--source include/galera_set_sync_point.inc + +# Build up slave queue: +# - first 8 events will be picked by slave threads +# - one more event will be waiting in slave queue +LOCK TABLES t1 READ; + +--connection node_1 +UPDATE t1 SET f2 = 1 WHERE f1 = 1; +UPDATE t1 SET f2 = 1 WHERE f1 = 2; +UPDATE t1 SET f2 = 1 WHERE f1 = 3; +UPDATE t1 SET f2 = 1 WHERE f1 = 4; +UPDATE t1 SET f2 = 2 WHERE f1 = 4; /* dependent applier */; + +# interleave a failing statement +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +--send DROP TABLE t2; + +# make sure DROP TABLE from above has replicated +--connection node_2 +SET wsrep_on=OFF; +--echo "Wait for DROP TABLE to replicate" +--source include/galera_wait_sync_point.inc +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc +--echo "DROP TABLE replicated" +SET wsrep_on=ON; + +--connection node_1 +UPDATE t1 SET f2 = 3 WHERE f1 = 4; /* dependent applier */ +UPDATE t1 SET f2 = 1 WHERE f1 = 5; +UPDATE t1 SET f2 = 1 WHERE f1 = 6; +UPDATE t1 SET f2 = 1 WHERE f1 = 7; +UPDATE t1 SET f2 = 1 WHERE f1 = 8; + +--connection node_2 +# make sure all events landed to slave queue +SET wsrep_on=OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_recv_queue'; +--source include/wait_condition.inc +SET wsrep_on=ON; +UNLOCK TABLES; + +--connection node_2a +--error ER_BAD_TABLE_ERROR +--reap + +--connection node_1 +--let $members=2 +--source include/wsrep_wait_membership.inc +--source include/wait_until_ready.inc +SHOW STATUS LIKE 'wsrep_cluster_size'; +SELECT * FROM t1; + +--connection node_2 +--source include/wsrep_wait_disconnect.inc +# Wait for the node to shutdown replication +--let $members=0 +--source include/wsrep_wait_membership.inc +# Gracefully restart the node +SET GLOBAL wsrep_on=OFF; +--source include/shutdown_mysqld.inc +--source include/start_mysqld.inc +--source include/galera_wait_ready.inc + +--let $wait_condition = SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +DROP TABLE t1; + +CALL mtr.add_suppression('Can\'t find record in \'t1\''); +CALL mtr.add_suppression('Update_rows_v1 apply failed'); +CALL mtr.add_suppression('Inconsistency detected: Inconsistent by consensus on'); +CALL mtr.add_suppression('last left .* greater than drain seqno'); +CALL mtr.add_suppression('WSREP: Failed to apply write set:'); + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc |