diff options
Diffstat (limited to 'mysql-test/suite/galera')
18 files changed, 671 insertions, 85 deletions
diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc index d7f665df6c7..98ebf4ff35d 100644 --- a/mysql-test/suite/galera/include/kill_galera.inc +++ b/mysql-test/suite/galera/include/kill_galera.inc @@ -1,5 +1,10 @@ --echo Killing server ... +if (!$kill_signal) +{ +--let $kill_signal = 9 +} + # Write file to make mysql-test-run.pl expect the crash, but don't start it --let $_server_id= `SELECT @@server_id` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect @@ -7,13 +12,15 @@ # Kill the connected server --disable_reconnect +--let KILL_SIGNAL_VALUE = $kill_signal --let KILL_NODE_PIDFILE = `SELECT @@pid_file` --perl + my $kill_sig = $ENV{'KILL_SIGNAL_VALUE'}; my $pid_filename = $ENV{'KILL_NODE_PIDFILE'}; my $mysqld_pid = `cat $pid_filename`; chomp($mysqld_pid); - system("kill -9 $mysqld_pid"); + system("kill -s $kill_sig $mysqld_pid"); exit(0); EOF diff --git a/mysql-test/suite/galera/r/GCF-360.result b/mysql-test/suite/galera/r/GCF-360.result new file mode 100644 index 00000000000..8c1ba193c1f --- /dev/null +++ b/mysql-test/suite/galera/r/GCF-360.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_1; +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_4 +4 +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); +connection node_2; +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_4 +4 +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); +connection node_3; +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_4 +4 +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); +connection node_4; +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_4 +4 +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); diff --git a/mysql-test/suite/galera/r/galera-features#117.result b/mysql-test/suite/galera/r/galera-features#117.result new file mode 100644 index 00000000000..583f3c74a8b --- /dev/null +++ b/mysql-test/suite/galera/r/galera-features#117.result @@ -0,0 +1,37 @@ +connection node_2; +connection node_1; +connection node_2; +SET SESSION wsrep_on=OFF; +CREATE TABLE test.t1 (f2 INTEGER); +SET SESSION wsrep_on=ON; +CREATE TABLE test.t1 (f1 INTEGER); +ERROR 42S01: Table 't1' already exists +connection node_1; +SHOW CREATE TABLE test.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +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 CREATE TABLE test.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f2` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Disconnected +CREATE TABLE test.t2 (f1 INTEGER); +ERROR 08S01: WSREP has not yet prepared node for application use +SHOW TABLES IN test; +Tables_in_test +t1 +Killing server ... +CALL mtr.add_suppression("Inconsistent by consensus."); +CALL mtr.add_suppression("WSREP: Failed to execute TOI action"); +CALL mtr.add_suppression("WSREP: TO isolation end failed"); diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result index 33853188965..3b133b2732e 100644 --- a/mysql-test/suite/galera/r/galera_gra_log.result +++ b/mysql-test/suite/galera/r/galera_gra_log.result @@ -1,15 +1,12 @@ connection node_2; connection node_1; connection node_2; +SET GLOBAL wsrep_ignore_apply_errors=0; SET SESSION wsrep_on=OFF; CREATE TABLE t1 (f1 INTEGER); connection node_1; CREATE TABLE t1 (f1 INTEGER); connection node_2; -SET SESSION wsrep_on=ON; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; @@ -33,5 +30,7 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; -CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query"); +Killing server ... +SET GLOBAL wsrep_ignore_apply_errors = 7; DROP TABLE t1; +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on"); diff --git a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result index 48c845a4c2b..3173369386d 100644 --- a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result +++ b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result @@ -7,27 +7,60 @@ SET GLOBAL wsrep_on = OFF; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; DROP TABLE t1; +connection node_2; +SHOW TABLES; +Tables_in_test +connection node_1; SET GLOBAL wsrep_on = OFF; CREATE SCHEMA s1; SET GLOBAL wsrep_on = ON; DROP SCHEMA s1; +connection node_2; +SHOW SCHEMAS; +Database +information_schema +mtr +mysql +performance_schema +test +connection node_1; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; DROP INDEX idx1 ON t1; +connection node_2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; +connection node_1; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; ALTER TABLE t1 DROP INDEX idx1; +connection node_2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; +connection node_1; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET GLOBAL wsrep_on = ON; ALTER TABLE t1 DROP COLUMN f2; +connection node_2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; connection node_2; SET GLOBAL wsrep_ignore_apply_errors = 2; @@ -37,14 +70,13 @@ SET GLOBAL wsrep_on = OFF; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_on = ON; DELETE FROM t1 WHERE f1 = 1; -connection node_1; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 connection node_2; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 DROP TABLE t1; connection node_1; CREATE TABLE t1 (f1 INTEGER); @@ -57,13 +89,12 @@ INSERT INTO t1 VALUES (3); DELETE FROM t1 WHERE f1 = 1; DELETE FROM t1 WHERE f1 = 2; COMMIT; -connection node_1; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) AS expect_1 FROM t1; +expect_1 1 connection node_2; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) AS expect_1 FROM t1; +expect_1 1 DROP TABLE t1; connection node_1; @@ -75,16 +106,16 @@ DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; connection node_1; DELETE FROM t1; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 -connection node_2; -SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; -VARIABLE_VALUE = 'Primary' -1 -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT VARIABLE_VALUE expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 DROP TABLE t1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; @@ -103,16 +134,16 @@ DELETE FROM t1 WHERE f1 = 4; DELETE FROM t1 WHERE f1 = 5; COMMIT; SET AUTOCOMMIT=ON; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 -connection node_2; -SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; -VARIABLE_VALUE = 'Primary' -1 -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT VARIABLE_VALUE expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +expect_Primary +Primary +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 DROP TABLE t1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; @@ -126,16 +157,16 @@ DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; connection node_1; DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) expect_0 FROM t1; +expect_0 +0 connection node_2; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE = 'Primary' 1 -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) expect_0 FROM t1; +expect_0 +0 DROP TABLE t1,t2; connection node_1; CREATE TABLE parent (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; @@ -148,22 +179,22 @@ DELETE FROM child WHERE parent_id = 2; SET SESSION wsrep_on = ON; connection node_1; DELETE FROM parent; -SELECT COUNT(*) = 0 FROM parent; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM child; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS expect_0 FROM parent; +expect_0 +0 +SELECT COUNT(*) AS expect_0 FROM child; +expect_0 +0 connection node_2; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE = 'Primary' 1 -SELECT COUNT(*) = 0 FROM parent; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM child; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS expect_0 FROM parent; +expect_0 +0 +SELECT COUNT(*) AS expect_0 FROM child; +expect_0 +0 DROP TABLE child, parent; connection node_2; SET GLOBAL wsrep_ignore_apply_errors = 4; @@ -175,6 +206,8 @@ connection node_1; CREATE TABLE t1 (f1 INTEGER, f2 INTEGER); DROP TABLE t1; connection node_2; +SELECT * FROM t1; +ERROR 42S02: Table 'test.t1' doesn't exist SET GLOBAL wsrep_ignore_apply_errors = 7; CALL mtr.add_suppression("Can't find record in 't.*'"); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); diff --git a/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result b/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result new file mode 100644 index 00000000000..fe98d403e13 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result @@ -0,0 +1,60 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +connection node_1; +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_4; +SET SESSION wsrep_on=OFF; +CREATE TABLE t1 (f1 INTEGER); +SET SESSION wsrep_on=ON; +DROP TABLE t1; +connection node_1; +CREATE TABLE t2 (f1 INTEGER); +connection node_3; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +connection node_1; +connection node_3; +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +expect_0 +0 +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +expect_1 +1 +connection node_4; +SET SESSION wsrep_on=OFF; +Killing server ... +Starting mysqld +connection node_1; +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +expect_0 +0 +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +expect_1 +1 +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); +connection node_2; +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +expect_0 +0 +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +expect_1 +1 +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); +connection node_3; +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +expect_0 +0 +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +expect_1 +1 +connection node_4; +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +expect_0 +0 +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +expect_1 +1 +CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster."); +DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result b/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result new file mode 100644 index 00000000000..f451555e000 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result @@ -0,0 +1,73 @@ +connection node_4; +connection node_3; +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_4; +connection node_3; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'A'); +connection node_4; +SET SESSION wsrep_on=OFF; +INSERT INTO t1 VALUES (2, 'B'); +SET SESSION wsrep_on=ON; +DELETE FROM t1 WHERE f1 = 2; +connection node_1; +connection node_3; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +connection node_1; +connection node_3; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; +COUNT(*) = 0 +1 +connection node_4; +SET SESSION wsrep_on=OFF; +Killing server ... +Starting mysqld +connection node_1; +connection node_1; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; +COUNT(*) = 0 +1 +CALL mtr.add_suppression("mysqld: Can't find record in 't1'"); +CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows"); +CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*"); +connection node_2; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; +COUNT(*) = 0 +1 +CALL mtr.add_suppression("mysqld: Can't find record in 't1'"); +CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows"); +CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*"); +connection node_3; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; +COUNT(*) = 0 +1 +connection node_4; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; +COUNT(*) = 0 +1 +CALL mtr.add_suppression("inconsistent with group"); +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/GCF-360.cnf b/mysql-test/suite/galera/t/GCF-360.cnf new file mode 100644 index 00000000000..28e51f87e8e --- /dev/null +++ b/mysql-test/suite/galera/t/GCF-360.cnf @@ -0,0 +1,17 @@ +!include ../galera_4nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port' +wsrep_ignore_apply_errors=0 + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port' +wsrep_ignore_apply_errors=0 + +[mysqld.3] +wsrep_provider_options='base_port=@mysqld.3.#galera_port' +wsrep_ignore_apply_errors=0 + +[mysqld.4] +wsrep_provider_options='base_port=@mysqld.4.#galera_port' +wsrep_ignore_apply_errors=0 diff --git a/mysql-test/suite/galera/t/GCF-360.test b/mysql-test/suite/galera/t/GCF-360.test new file mode 100644 index 00000000000..f1a511177f6 --- /dev/null +++ b/mysql-test/suite/galera/t/GCF-360.test @@ -0,0 +1,65 @@ +# +# GCF-360 Inconsistency voting: node goes non-prim on DDL that fails everywhere +# +# We issue 400 DDLs in total to make this test more stressful# +# + +--source include/galera_cluster.inc + +--let $count = 100 + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 + +--disable_query_log +--disable_result_log +while ($count) +{ + --connection node_1 + --send DROP TABLE nonexisting_table; + + --connection node_2 + --send DROP TABLE nonexisting_table; + + --connection node_3 + --send DROP TABLE nonexisting_table; + + --connection node_4 + --send DROP TABLE nonexisting_table; + + --connection node_1 + --error ER_BAD_TABLE_ERROR + --reap + + --connection node_2 + --error ER_BAD_TABLE_ERROR + --reap + + --connection node_3 + --error ER_BAD_TABLE_ERROR + --reap + + --connection node_4 + --error ER_BAD_TABLE_ERROR + --reap + + --dec $count +} +--enable_result_log +--enable_query_log + +--connection node_1 +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); + +--connection node_2 +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); + +--connection node_3 +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); + +--connection node_4 +SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); diff --git a/mysql-test/suite/galera/t/galera-features#117.cnf b/mysql-test/suite/galera/t/galera-features#117.cnf new file mode 100644 index 00000000000..8eaed546ad8 --- /dev/null +++ b/mysql-test/suite/galera/t/galera-features#117.cnf @@ -0,0 +1,5 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 +wsrep-sync-wait=0 diff --git a/mysql-test/suite/galera/t/galera-features#117.test b/mysql-test/suite/galera/t/galera-features#117.test new file mode 100644 index 00000000000..0436b201a09 --- /dev/null +++ b/mysql-test/suite/galera/t/galera-features#117.test @@ -0,0 +1,38 @@ +# +# This test tests voting for DDLs (TOI events) +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_2 +SET SESSION wsrep_on=OFF; +CREATE TABLE test.t1 (f2 INTEGER); +SET SESSION wsrep_on=ON; + +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE test.t1 (f1 INTEGER); + +--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 +SHOW CREATE TABLE test.t1; +SHOW STATUS LIKE 'wsrep_cluster_status'; +DROP TABLE test.t1; + +--connection node_2 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +SHOW CREATE TABLE test.t1; +SHOW STATUS LIKE 'wsrep_cluster_status'; +--error ER_UNKNOWN_COM_ERROR +CREATE TABLE test.t2 (f1 INTEGER); +SHOW TABLES IN test; + +--source include/kill_galera.inc +--source include/wait_until_disconnected.inc +--source include/start_mysqld.inc + +CALL mtr.add_suppression("Inconsistent by consensus."); +CALL mtr.add_suppression("WSREP: Failed to execute TOI action"); +CALL mtr.add_suppression("WSREP: TO isolation end failed"); diff --git a/mysql-test/suite/galera/t/galera_gra_log.test b/mysql-test/suite/galera/t/galera_gra_log.test index 8b5aaaae5bd..aeadafad969 100644 --- a/mysql-test/suite/galera/t/galera_gra_log.test +++ b/mysql-test/suite/galera/t/galera_gra_log.test @@ -7,24 +7,35 @@ --connection node_2 --exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log +let $restore_wsrep_ignore_apply_errors = `SELECT @@GLOBAL.wsrep_ignore_apply_errors`; +SET GLOBAL wsrep_ignore_apply_errors=0; # Create applier failure - SET SESSION wsrep_on=OFF; CREATE TABLE t1 (f1 INTEGER); --connection node_1 CREATE TABLE t1 (f1 INTEGER); +# node 2 should detect an error and leave the cluster +--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 -SET SESSION wsrep_on=ON; -SELECT COUNT(*) = 0 FROM t1; +--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc # Make sure the GRA file produced is readable and contains the failure --replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMP>/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=<PSEUDO_THREAD_ID>/ --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log -CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query"); +# restart and reconnect node_2 +--source include/kill_galera.inc +--source include/wait_until_disconnected.inc +--source include/start_mysqld.inc +--eval SET GLOBAL wsrep_ignore_apply_errors = $restore_wsrep_ignore_apply_errors DROP TABLE t1; + +CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on"); diff --git a/mysql-test/suite/galera/t/galera_load_data.cnf b/mysql-test/suite/galera/t/galera_load_data.cnf index fd0327e0ecb..5c56c92c571 100644 --- a/mysql-test/suite/galera/t/galera_load_data.cnf +++ b/mysql-test/suite/galera/t/galera_load_data.cnf @@ -2,9 +2,8 @@ [mysqld] secure-file-priv = "" -innodb_file_format ='Barracuda' innodb_file_per_table = ON innodb_stats_persistent=ON innodb_stats_auto_recalc=ON innodb_stats_persistent_sample_pages=20 -innodb_stats_sample_pages=8 +innodb_stats_transient_sample_pages=8 diff --git a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test index ddf561c8784..c6928cddb0f 100644 --- a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test +++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test @@ -5,7 +5,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc - # # Ignore reconciling DDL errors on node_2 # @@ -20,34 +19,53 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; DROP TABLE t1; +--connection node_2 +SHOW TABLES; + # Drop schema that does not exist +--connection node_1 SET GLOBAL wsrep_on = OFF; CREATE SCHEMA s1; SET GLOBAL wsrep_on = ON; DROP SCHEMA s1; +--connection node_2 +SHOW SCHEMAS; + # Drop index that does not exist using DROP INDEX +--connection node_1 CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; DROP INDEX idx1 ON t1; + +--connection node_2 +SHOW CREATE TABLE t1; DROP TABLE t1; # Drop index that does not exist using ALTER TABLE +--connection node_1 CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; ALTER TABLE t1 DROP INDEX idx1; + +--connection node_2 +SHOW CREATE TABLE t1; DROP TABLE t1; # Drop column that does not exist +--connection node_1 CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET GLOBAL wsrep_on = ON; ALTER TABLE t1 DROP COLUMN f2; + +--connection node_2 +SHOW CREATE TABLE t1; DROP TABLE t1; @@ -65,12 +83,10 @@ SET GLOBAL wsrep_on = OFF; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_on = ON; DELETE FROM t1 WHERE f1 = 1; +SELECT COUNT(*) AS expect_0 FROM t1; ---connection node_1 -SELECT COUNT(*) = 0 FROM t1; --connection node_2 -SELECT COUNT(*) = 0 FROM t1; - +SELECT COUNT(*) AS expect_0 FROM t1; DROP TABLE t1; # Delete row that does not exist in a multi statement transaction @@ -85,12 +101,10 @@ INSERT INTO t1 VALUES (3); DELETE FROM t1 WHERE f1 = 1; DELETE FROM t1 WHERE f1 = 2; COMMIT; +SELECT COUNT(*) AS expect_1 FROM t1; ---connection node_1 -SELECT COUNT(*) = 1 FROM t1; --connection node_2 -SELECT COUNT(*) = 1 FROM t1; - +SELECT COUNT(*) AS expect_1 FROM t1; DROP TABLE t1; # @@ -107,13 +121,16 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET SESSION wsrep_on = OFF; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; + --connection node_1 DELETE FROM t1; +SELECT COUNT(*) AS expect_0 FROM t1; -SELECT COUNT(*) = 0 FROM t1; --connection node_2 -SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; -SELECT COUNT(*) = 0 FROM t1; +--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; +--source include/wait_condition.inc +SELECT VARIABLE_VALUE expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT COUNT(*) AS expect_0 FROM t1; DROP TABLE t1; # @@ -130,8 +147,8 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET SESSION wsrep_on = OFF; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; ---connection node_1 +--connection node_1 SET AUTOCOMMIT=OFF; START TRANSACTION; DELETE FROM t1 WHERE f1 = 1; @@ -141,11 +158,13 @@ DELETE FROM t1 WHERE f1 = 4; DELETE FROM t1 WHERE f1 = 5; COMMIT; SET AUTOCOMMIT=ON; +SELECT COUNT(*) AS expect_0 FROM t1; -SELECT COUNT(*) = 0 FROM t1; --connection node_2 -SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; -SELECT COUNT(*) = 0 FROM t1; +--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; +--source include/wait_condition.inc +SELECT VARIABLE_VALUE expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT COUNT(*) AS expect_0 FROM t1; DROP TABLE t1; # @@ -169,11 +188,13 @@ SET SESSION wsrep_on = ON; --connection node_1 DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1; -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) expect_0 FROM t1; --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; +--source include/wait_condition.inc SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) expect_0 FROM t1; DROP TABLE t1,t2; # @@ -196,13 +217,15 @@ SET SESSION wsrep_on = ON; --connection node_1 DELETE FROM parent; -SELECT COUNT(*) = 0 FROM parent; -SELECT COUNT(*) = 0 FROM child; +SELECT COUNT(*) AS expect_0 FROM parent; +SELECT COUNT(*) AS expect_0 FROM child; --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM child; +--source include/wait_condition.inc SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; -SELECT COUNT(*) = 0 FROM parent; -SELECT COUNT(*) = 0 FROM child; +SELECT COUNT(*) AS expect_0 FROM parent; +SELECT COUNT(*) AS expect_0 FROM child; DROP TABLE child, parent; # @@ -217,12 +240,14 @@ SET GLOBAL wsrep_ignore_apply_errors = 4; SET GLOBAL wsrep_on = OFF; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; + --connection node_1 CREATE TABLE t1 (f1 INTEGER, f2 INTEGER); DROP TABLE t1; - --connection node_2 +--error ER_NO_SUCH_TABLE +SELECT * FROM t1; SET GLOBAL wsrep_ignore_apply_errors = 7; CALL mtr.add_suppression("Can't find record in 't.*'"); diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf new file mode 100644 index 00000000000..b2cba42c0bd --- /dev/null +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf @@ -0,0 +1,4 @@ +!include ../galera_4nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test new file mode 100644 index 00000000000..ce87c728b8c --- /dev/null +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test @@ -0,0 +1,83 @@ +# +# Test the case where a node that dropped prior to an inconsistency vote is +# able to rejoin via IST after the vote is complete +# + +--source include/galera_cluster.inc +--source include/big_test.inc + +# Isolate node #3 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; + +# Wait for node #3 to leave cluster +--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 + +# Introduce inconsistency on node #4 +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--connection node_4 +SET SESSION wsrep_on=OFF; +CREATE TABLE t1 (f1 INTEGER); +SET SESSION wsrep_on=ON; +DROP TABLE t1; + +# Wait for node #4 to be voted out +--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 +# Do some more stuff on the cluster to add to the IST stream +CREATE TABLE t2 (f1 INTEGER); + +# Rejoin node #3 +--connection node_3 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +--source include/galera_wait_ready.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_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Confirm that all is good +--connection node_3 +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; + +# Rejoin node #4 +--connection node_4 +SET SESSION wsrep_on=OFF; +--source include/kill_galera.inc +--sleep 1 +--echo Starting mysqld +--source include/start_mysqld.inc + +--connection node_1 +# Confirm node #4 has rejoined +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Confirm that all is good and all nodes have identical data +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); + +--connection node_3 +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; + +--connection node_4 +SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster."); + +DROP TABLE t2; diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf new file mode 100644 index 00000000000..af445b25372 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf @@ -0,0 +1,7 @@ +!include ../galera_4nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 + +[ENV] +galera_cluster_size=4 diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test new file mode 100644 index 00000000000..e65c067304e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test @@ -0,0 +1,99 @@ +# +# Test the case where a node that dropped prior to an inconsistency vote is +# able to rejoin via IST after the vote is complete +# + +--source include/galera_cluster.inc +--source include/big_test.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--let $node_4=node_4 +--source include/auto_increment_offset_save.inc + +# Isolate node #3 +--connection node_3 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; + +# Wait for node #3 to leave cluster +--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_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'A'); + +# Introduce inconsistency on node #4 +--connection node_4 +SET SESSION wsrep_on=OFF; +INSERT INTO t1 VALUES (2, 'B'); +SET SESSION wsrep_on=ON; +DELETE FROM t1 WHERE f1 = 2; + +# Wait for node #4 to be voted out +--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 + +# Rejoin node #3 +--connection node_3 +--source include/wsrep_wait_disconnect.inc +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +--source include/galera_wait_ready.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_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Confirm that all is good +--connection node_3 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; + +# Rejoin node #4 +--connection node_4 +SET SESSION wsrep_on=OFF; +--source include/kill_galera.inc +--sleep 1 +--echo Starting mysqld +--source include/start_mysqld.inc + +# Confirm node #4 has rejoined +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Confirm that all is good and all nodes have identical data + +--connection node_1 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; +CALL mtr.add_suppression("mysqld: Can't find record in 't1'"); +CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows"); +CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*"); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; +CALL mtr.add_suppression("mysqld: Can't find record in 't1'"); +CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows"); +CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*"); + +--connection node_3 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; + +--connection node_4 +--source include/galera_wait_ready.inc +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; +CALL mtr.add_suppression("inconsistent with group"); + +DROP TABLE t1; + +--source include/auto_increment_offset_restore.inc |