diff options
Diffstat (limited to 'mysql-test/suite/galera')
110 files changed, 2594 insertions, 93 deletions
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 9c38c1296fe..85d8614c91f 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -19,3 +19,11 @@ galera_var_auto_inc_control_on : Failing sporadically with content mismatch galera_parallel_simple : Failing sporadically galera_bf_abort : Failing sporadically galera_log_output_csv : Failing sporadically +galera_as_slave_preordered : wsrep-preordered is not available in MariaDB Galera cluster +galera_forced_binlog_format : TODO: investigate +galera_gra_log : TODO: investigate +galera_as_slave_replication_bundle : TODO: investigate +galera_ssl_upgrade : TODO: investigate +mysql-wsrep#90 : TODO: investigate +galera_flush : mysql-wsrep/issues/229 +galera_transaction_read_only : mysql-wsrep/issues/229 diff --git a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf index 4017f69b02f..6d71649c274 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf @@ -18,6 +18,10 @@ server-id=1 #sst_port=@OPT.port wsrep-on=1 + +log-bin +log-slave-updates + innodb-autoinc-lock-mode=2 default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER @@ -38,6 +42,10 @@ server-id=2 #sst_port=@OPT.port wsrep-on=1 + +log-bin +log-slave-updates + innodb-autoinc-lock-mode=2 default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER @@ -59,8 +67,8 @@ NODE_MYSOCK_1= @mysqld.1.socket NODE_MYPORT_2= @mysqld.2.port NODE_MYSOCK_2= @mysqld.2.socket -NODE_MYPORT_3= @mysqld.2.port -NODE_MYSOCK_3= @mysqld.2.socket +NODE_MYPORT_3= @mysqld.3.port +NODE_MYSOCK_3= @mysqld.3.socket NODE_GALERAPORT_2= @mysqld.2.#galera_port NODE_GALERAPORT_3= @mysqld.3.#galera_port diff --git a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf new file mode 100644 index 00000000000..4f3fdb02045 --- /dev/null +++ b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf @@ -0,0 +1,91 @@ +# +# This .cnf file creates a setup with 1 standard MySQL server, followed by a 2-node Galera cluster +# + +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld] +log-slave-updates +log-bin=mysqld-bin +binlog-format=row + +[mysqld.1] +server-id=1 + +[mysqld.2] +server-id=2 + +wsrep_provider=@ENV.WSREP_PROVIDER +wsrep_cluster_address='gcomm://' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts=1;' + +# enforce read-committed characteristics across the cluster +wsrep_causal_reads=ON +wsrep_sync_wait = 7 + +wsrep_node_address=127.0.0.1 +wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port + +# Required for Galera +innodb_autoinc_lock_mode=2 + +innodb_flush_log_at_trx_commit=2 + +[mysqld.3] +wsrep_provider=@ENV.WSREP_PROVIDER +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port' +wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts = 1;' + +# enforce read-committed characteristics across the cluster +wsrep_causal_reads=ON +wsrep_sync_wait = 7 + +wsrep_node_address=127.0.0.1 +wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port + +# Required for Galera +innodb_autoinc_lock_mode=2 + +innodb_flush_log_at_trx_commit=2 + +[mysqld.4] +wsrep_provider=@ENV.WSREP_PROVIDER +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port' +wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts = 1;' + +# enforce read-committed characteristics across the cluster +wsrep_causal_reads=ON +wsrep_sync_wait = 7 + +wsrep_node_address=127.0.0.1 +wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port + +# Required for Galera +innodb_autoinc_lock_mode=2 + +innodb_flush_log_at_trx_commit=2 + +[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_3= @mysqld.4.port +NODE_MYSOCK_3= @mysqld.4.socket + +NODE_GALERAPORT_2= @mysqld.2.#galera_port +NODE_GALERAPORT_3= @mysqld.3.#galera_port +NODE_GALERAPORT_4= @mysqld.4.#galera_port + +NODE_SSTPORT_2= @mysqld.2.#sst_port +NODE_SSTPORT_3= @mysqld.3.#sst_port +NODE_SSTPORT_4= @mysqld.4.#sst_port diff --git a/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc b/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc index 405c16ce4f1..5f87d23dcc1 100644 --- a/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc +++ b/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc @@ -6,12 +6,13 @@ --connection node_1 # We need a user with a password to perform SST, otherwise we hit LP #1378253 -GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; --let $wsrep_sst_auth_orig = `SELECT @@wsrep_sst_auth` -SET GLOBAL wsrep_sst_auth = 'sst:sst'; +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` diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc index d7f665df6c7..c61bad8e19d 100644 --- a/mysql-test/suite/galera/include/kill_galera.inc +++ b/mysql-test/suite/galera/include/kill_galera.inc @@ -1,6 +1,7 @@ --echo Killing server ... # Write file to make mysql-test-run.pl expect the crash, but don't start it +--source include/wait_until_connected_again.inc --let $_server_id= `SELECT @@server_id` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect --exec echo "wait" > $_expect_file_name diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result new file mode 100644 index 00000000000..cecbfc1f3cf --- /dev/null +++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result @@ -0,0 +1,15 @@ +SET SESSION wsrep_sync_wait = 0; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +FLUSH TABLE t1 WITH READ LOCK; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +UNLOCK TABLES; +SET SESSION wsrep_sync_wait = 7; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result new file mode 100644 index 00000000000..ee967356c85 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result @@ -0,0 +1,26 @@ +SET SESSION wsrep_sync_wait = 0; +SET SESSION lock_wait_timeout = 60; +SET SESSION innodb_lock_wait_timeout=60; +SET SESSION wait_timeout=60; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +FLUSH TABLE t1 WITH READ LOCK; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +SELECT 1 FROM DUAL; +1 +1 +SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +COUNT(*) = 1 +1 +UNLOCK TABLES; +SET SESSION wsrep_sync_wait = 7; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) DEFAULT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_as_slave.result b/mysql-test/suite/galera/r/galera_as_slave.result index 1e86afa35b7..2d7d689aa36 100644 --- a/mysql-test/suite/galera/r/galera_as_slave.result +++ b/mysql-test/suite/galera/r/galera_as_slave.result @@ -12,3 +12,4 @@ COUNT(*) = 3 DROP TABLE t1; STOP SLAVE; RESET SLAVE ALL; +RESET MASTER; diff --git a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result new file mode 100644 index 00000000000..ded3caecf89 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result @@ -0,0 +1,20 @@ +START SLAVE USER='root'; +Warnings: +Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. +SET SESSION wsrep_sync_wait = 0; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +expected_error +1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +START SLAVE; +DROP TABLE t1; +STOP SLAVE; +RESET SLAVE ALL; +CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query"); +CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047"); +CALL mtr.add_suppression("Send action {\\(nil\\), 328, TORDERED} returned -107 \\(Transport endpoint is not connected\\)"); +CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); +CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); +RESET MASTER; diff --git a/mysql-test/suite/galera/r/galera_as_slave_preordered.result b/mysql-test/suite/galera/r/galera_as_slave_preordered.result new file mode 100644 index 00000000000..27a08e73491 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_as_slave_preordered.result @@ -0,0 +1,19 @@ +START SLAVE USER='root'; +Warnings: +Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB; +SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1; +COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 +1 +SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1; +COUNT(*) = 2 * 100 * 10 * 10 +1 +SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1; +COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 +1 +DROP TABLE t1; +DROP TABLE ten; +STOP SLAVE; +RESET SLAVE ALL; diff --git a/mysql-test/suite/galera/r/galera_as_slave_replication_bundle.result b/mysql-test/suite/galera/r/galera_as_slave_replication_bundle.result new file mode 100644 index 00000000000..a86bfd20e2f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_as_slave_replication_bundle.result @@ -0,0 +1,15 @@ +START SLAVE USER='root'; +Warnings: +Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +INSERT INTO t1 VALUES(2); +INSERT INTO t1 VALUES(3); +INSERT INTO t1 VALUES(4); +INSERT INTO t1 VALUES(5); +SELECT COUNT(*) = 4 FROM t1; +COUNT(*) = 4 +1 +DROP TABLE t1; +STOP SLAVE; +RESET SLAVE ALL; diff --git a/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result b/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result new file mode 100644 index 00000000000..228d7c6f041 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result @@ -0,0 +1,36 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +CREATE PROCEDURE p1 () +BEGIN +DECLARE x INT DEFAULT 1; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; +WHILE 1 DO +INSERT INTO t1 VALUES (DEFAULT); +COMMIT; +END WHILE; +END| +CALL p1();; +CALL p1();; +Killing server ... +INSERT INTO t1 VALUES (DEFAULT); +INSERT INTO t1 VALUES (DEFAULT); +Got one of the listed errors +Got one of the listed errors +count_equal +1 +CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0"); +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE +2 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE +2 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +DROP PROCEDURE p1; +DROP TABLE t1; +CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)"); +CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0"); diff --git a/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result b/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result new file mode 100644 index 00000000000..8c07d87eec3 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result @@ -0,0 +1,14 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +FLUSH TABLES t1 FOR EXPORT; +INSERT INTO t1 VALUES (2); +SET SESSION wsrep_sync_wait = 0; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=ON; +SELECT * FROM t1; +f1 +2 +wsrep_local_aborts_increment +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result index e657e724a8b..7510e48ee83 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result +++ b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result @@ -1,8 +1,12 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; LOCK TABLE t1 WRITE; -INSERT INTO t1 VALUES (1);; INSERT INTO t1 VALUES (2); +UNLOCK TABLES; +COMMIT; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 wsrep_local_aborts_increment 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_drop_multi.result b/mysql-test/suite/galera/r/galera_drop_multi.result new file mode 100644 index 00000000000..d82ae3bec1a --- /dev/null +++ b/mysql-test/suite/galera/r/galera_drop_multi.result @@ -0,0 +1,20 @@ +CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; +CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=MyISAM; +CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t4 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t5 (f1 INTEGER); +SET AUTOCOMMIT=OFF; +START TRANSACTION; +DROP TABLE t1, t2, t3, t4; +INSERT INTO t5 VALUES (1); +COMMIT; +SHOW CREATE TABLE t1; +ERROR 42S02: Table 'test.t1' doesn't exist +SHOW CREATE TABLE t2; +ERROR 42S02: Table 'test.t2' doesn't exist +SHOW CREATE TABLE t3; +ERROR 42S02: Table 'test.t3' doesn't exist +SHOW CREATE TABLE t4; +ERROR 42S02: Table 'test.t4' doesn't exist +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t2,test.t4'' on query\. Default database: 'test'\. Query: 'DROP TABLE t1, t2, t3, t4', Error_code: 1051"); +DROP TABLE t5; diff --git a/mysql-test/suite/galera/r/galera_flush.result b/mysql-test/suite/galera/r/galera_flush.result index c5e47c29324..8ff32fdfff4 100644 --- a/mysql-test/suite/galera/r/galera_flush.result +++ b/mysql-test/suite/galera/r/galera_flush.result @@ -19,6 +19,13 @@ wsrep_last_committed_diff FLUSH USER_RESOURCES; wsrep_last_committed_diff 1 +FLUSH TABLES; +wsrep_last_committed_diff +1 +CREATE TABLE t2 (f1 INTEGER); +FLUSH TABLES t2; +wsrep_last_committed_diff +1 CREATE TABLE t1 (f1 INTEGER); FLUSH LOGS; FLUSH TABLES WITH READ LOCK; @@ -29,4 +36,19 @@ FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; wsrep_last_committed_diff 1 +LOCK TABLES t1 WRITE; +FLUSH TABLES t1; +UNLOCK TABLES; +wsrep_last_committed_diff +1 +LOCK TABLES t1 READ; +FLUSH TABLES t1; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +UNLOCK TABLES; +wsrep_last_committed_diff +1 +FLUSH TABLES t1; +wsrep_last_committed_diff +1 DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_forced_binlog_format.result b/mysql-test/suite/galera/r/galera_forced_binlog_format.result new file mode 100644 index 00000000000..857e44d2dfc --- /dev/null +++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result @@ -0,0 +1,18 @@ +RESET MASTER; +SET SESSION binlog_format = 'STATEMENT'; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET SESSION binlog_format = 'MIXED'; +INSERT INTO t1 VALUES (2); +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB +mysqld-bin.000001 <Pos> Query 1 <End_log_pos> BEGIN +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Query 1 <End_log_pos> BEGIN +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ftwrl_drain.result b/mysql-test/suite/galera/r/galera_ftwrl_drain.result new file mode 100644 index 00000000000..a4879838d11 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ftwrl_drain.result @@ -0,0 +1,24 @@ +CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +INSERT INTO t1 VALUES (1); +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +FLUSH TABLES WITH READ LOCK;; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION lock_wait_timeout = 1; +SET SESSION innodb_lock_wait_timeout=1; +SET SESSION wait_timeout=1; +INSERT INTO t2 VALUES (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UNLOCK TABLES; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +INSERT INTO t1 VALUES (3); +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result index 72577695202..84ae0a116a1 100644 --- a/mysql-test/suite/galera/r/galera_fulltext.result +++ b/mysql-test/suite/galera/r/galera_fulltext.result @@ -4,13 +4,13 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%'; COUNT(*) = 13 1 -INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; -SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); -COUNT(f2) = 10000 +INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; +SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); +COUNT(f2) = 1000 1 UPDATE t1 SET f2 = 'abcdefjhk'; -SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); -COUNT(f2) = 10000 +SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); +COUNT(f2) = 1000 1 DROP TABLE t1; CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result index 99c710f25a5..ad60ead4b8a 100644 --- a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result +++ b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result @@ -1,14 +1,14 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; FLUSH TABLES WITH READ LOCK; INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (5); -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'query end' AND INFO = 'INSERT INTO t1 VALUES (5)'; -COUNT(*) = 1 -1 UNLOCK TABLES; INSERT INTO t1 VALUES (6); SELECT COUNT(*) = 6 FROM t1; diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result new file mode 100644 index 00000000000..9f5cbdd75fc --- /dev/null +++ b/mysql-test/suite/galera/r/galera_gra_log.result @@ -0,0 +1,41 @@ +SET SESSION wsrep_on=OFF; +CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER); +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*/; +DELIMITER /*!*/; +# at 4 +<ISO TIMESTAMP> server id 2 end_log_pos 120 Start: binlog v 4, server v 5.6.24-debug-log created 150804 11:37:14 at startup +# Warning: this binlog is either in use or was not closed properly. +ROLLBACK/*!*/; +BINLOG ' +unnAVQ8CAAAAdAAAAHgAAAABAAQANS42LjI0LWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAC6ecBVEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAKNu +Jfk= +'/*!*/; +# at 120 +<ISO TIMESTAMP> server id 1 end_log_pos 91 Query thread_id=<QUERY_THREAD_ID> exec_time=0 error_code=0 +use `test`/*!*/; +SET TIMESTAMP=<TIMESTAMP>/*!*/; +SET @@session.pseudo_thread_id=<PSEUDO_THREAD_ID>/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; +SET @@session.sql_mode=1073741824/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE TABLE t1 (f1 INTEGER) +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +SET SESSION wsrep_on=ON; +CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query"); +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result index 4b5a8fe948a..9a5b4e8a76f 100644 --- a/mysql-test/suite/galera/r/galera_ist_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result @@ -1,6 +1,6 @@ Setting SST method to mysqldump ... -GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; -SET GLOBAL wsrep_sst_auth = 'sst:sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; SET GLOBAL wsrep_sst_method = 'mysqldump'; Performing State Transfer on a server that has been shut down cleanly and restarted CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/r/galera_kill_applier.result b/mysql-test/suite/galera/r/galera_kill_applier.result new file mode 100644 index 00000000000..fe4911639ed --- /dev/null +++ b/mysql-test/suite/galera/r/galera_kill_applier.result @@ -0,0 +1,4 @@ +Got one of the listed errors +Got one of the listed errors +Got one of the listed errors +Got one of the listed errors diff --git a/mysql-test/suite/galera/r/galera_many_rows.result b/mysql-test/suite/galera/r/galera_many_rows.result index 6ec0add8ba8..a34367d6e46 100644 --- a/mysql-test/suite/galera/r/galera_many_rows.result +++ b/mysql-test/suite/galera/r/galera_many_rows.result @@ -1,7 +1,12 @@ +SET SESSION innodb_lock_wait_timeout=600; +SET SESSION lock_wait_timeout=600; CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_sync_wait = 7; +SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT1H'; SELECT COUNT(*) = 100000 FROM t1; COUNT(*) = 100000 1 @@ -13,20 +18,6 @@ UPDATE t1 SET f2 = 1; SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1; COUNT(*) = 200000 1 -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; -ROLLBACK; -SELECT COUNT(*) = 200000 FROM t1; -COUNT(*) = 200000 -1 -SELECT COUNT(*) = 200000 FROM t1; -COUNT(*) = 200000 -1 -SET AUTOCOMMIT=OFF; -START TRANSACTION; -UPDATE t1 SET f2 = 2; -ROLLBACK; START TRANSACTION; SELECT COUNT(*) = 200000 FROM t1; COUNT(*) = 200000 diff --git a/mysql-test/suite/galera/r/galera_migrate.result b/mysql-test/suite/galera/r/galera_migrate.result index 7c92d66ff97..aab3ffbd6b6 100644 --- a/mysql-test/suite/galera/r/galera_migrate.result +++ b/mysql-test/suite/galera/r/galera_migrate.result @@ -21,9 +21,9 @@ SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N VARIABLE_VALUE = 1 1 INSERT INTO t1 VALUES (6); -GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; -SET GLOBAL wsrep_sst_auth = 'sst:sst'; -GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE = 'Synced' 1 diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result index 880d4e8ae3d..294a94baed3 100644 --- a/mysql-test/suite/galera/r/galera_parallel_simple.result +++ b/mysql-test/suite/galera/r/galera_parallel_simple.result @@ -13,13 +13,13 @@ INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); -SELECT COUNT(*) = 6 FROM t1; -COUNT(*) = 6 -1 -SELECT COUNT(*) = 6 FROM t2; -COUNT(*) = 6 -1 -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'closing tables'; +SELECT COUNT(*) = 10 FROM t1; +COUNT(*) = 10 +0 +SELECT COUNT(*) = 10 FROM t2; +COUNT(*) = 10 +0 +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%'; COUNT(*) = 2 1 SET GLOBAL wsrep_slave_threads = 1;; diff --git a/mysql-test/suite/galera/r/galera_prepared_statement.result b/mysql-test/suite/galera/r/galera_prepared_statement.result new file mode 100644 index 00000000000..de5ac9c760a --- /dev/null +++ b/mysql-test/suite/galera/r/galera_prepared_statement.result @@ -0,0 +1,33 @@ +CREATE TABLE t1 (f1 CHAR(5)) ENGINE=InnoDB; +CREATE TABLE t2 (f1 CHAR(5)) ENGINE=InnoDB; +CREATE TABLE t3 (f1 CHAR(5)) ENGINE=InnoDB; +CREATE TABLE t4 (f1 CHAR(5)) ENGINE=InnoDB; +SET SESSION sql_mode='STRICT_ALL_TABLES'; +PREPARE st1 FROM 'INSERT INTO t1 VALUES ("abc")'; +PREPARE st2 FROM 'INSERT INTO t2 VALUES ("abc")'; +PREPARE st3 FROM 'INSERT INTO t3 VALUES ("abc")'; +PREPARE st4 FROM 'INSERT INTO t4 VALUES ("abc")'; +EXECUTE st1; +EXECUTE st2; +EXECUTE st3; +EXECUTE st4; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t2; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t3; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t4; +COUNT(*) = 1 +1 +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +ALTER TABLE t1 DROP COLUMN f1; +EXECUTE st1; +ERROR 22007: Incorrect integer value: 'abc' for column 'f2' at row 1 +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; diff --git a/mysql-test/suite/galera/r/galera_read_only.result b/mysql-test/suite/galera/r/galera_read_only.result index d2af3867fe7..82736c5f4ba 100644 --- a/mysql-test/suite/galera/r/galera_read_only.result +++ b/mysql-test/suite/galera/r/galera_read_only.result @@ -4,5 +4,15 @@ INSERT INTO t1 VALUES (1); SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 +CREATE USER foo@localhost; +# Open connection to node 2 using 'foo' user. + +# Connect with foo_node_2 +INSERT INTO t1 VALUES (2); +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 SET GLOBAL read_only=FALSE; DROP TABLE t1; +DROP USER foo@localhost; diff --git a/mysql-test/suite/galera/r/galera_serializable.result b/mysql-test/suite/galera/r/galera_serializable.result new file mode 100644 index 00000000000..90fe628e505 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_serializable.result @@ -0,0 +1,27 @@ +CREATE TABLE t1 (id INT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +START TRANSACTION; +SELECT * FROM t1; +id f2 +INSERT INTO t1 VALUES (1,1); +SELECT * FROM t1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +DELETE FROM t1; +INSERT INTO t1 VALUES (1,1); +START TRANSACTION; +SELECT * FROM t1; +id f2 +1 1 +UPDATE t1 SET f2 = 2; +UPDATE t1 SET f2 = 3; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +DELETE FROM t1; +START TRANSACTION; +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (1,2); +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ssl_compression.result b/mysql-test/suite/galera/r/galera_ssl_compression.result new file mode 100644 index 00000000000..f25b614d139 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ssl_compression.result @@ -0,0 +1,22 @@ +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE = 'Synced' +1 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE = 'Synced' +1 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +SET GLOBAL wsrep_provider_options = "socket.ssl_compression=No"; +ERROR HY000: Incorrect arguments to SET +CREATE TABLE t1 (f1 VARCHAR(333) PRIMARY KEY, f2 BLOB) Engine=InnoDB; +INSERT INTO t1 VALUES (REPEAT('a', 333), REPEAT('b', 65535)); +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('a', 333) AND f2 = REPEAT('b', 65535); +COUNT(*) = 1 +1 +DROP TABLE t1; +CALL mtr.add_suppression("Unknown parameter 'socket\.ssl_compression'"); +CALL mtr.add_suppression("Set options returned 7"); diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result new file mode 100644 index 00000000000..c0f2e84dc6f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result @@ -0,0 +1,24 @@ +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE = 'Synced' +1 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE = 'Synced' +1 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE = 'Synced' +1 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE = 'Synced' +1 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result index 1be2002001b..e35c4055f45 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result @@ -1,6 +1,6 @@ Setting SST method to mysqldump ... -GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; -SET GLOBAL wsrep_sst_auth = 'sst:sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; SET GLOBAL wsrep_sst_method = 'mysqldump'; Performing State Transfer on a server that has been temporarily disconnected CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result new file mode 100644 index 00000000000..93557cc91d4 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result @@ -0,0 +1,106 @@ +Setting SST method to mysqldump ... +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; +SET GLOBAL wsrep_sst_method = 'mysqldump'; +CREATE USER sslsst; +GRANT ALL PRIVILEGES ON *.* TO sslsst; +GRANT USAGE ON *.* TO sslsst REQUIRE SSL; +SET GLOBAL wsrep_sst_auth = 'sslsst:'; +Performing State Transfer on a server that has been temporarily disconnected +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +Unloading wsrep provider ... +SET GLOBAL wsrep_provider = 'none'; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +Loading wsrep provider ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +COMMIT; +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +COMMIT; +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +ROLLBACK; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +SET AUTOCOMMIT=ON; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +SET AUTOCOMMIT=ON; +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; +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("InnoDB: New log files created"); +CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables"); +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"); +DROP USER sslsst; diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2-options.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2-options.result new file mode 100644 index 00000000000..990e0a29506 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2-options.result @@ -0,0 +1,3 @@ +SELECT 1; +1 +1 diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_encrypt_with_key.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_encrypt_with_key.result new file mode 100644 index 00000000000..990e0a29506 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_encrypt_with_key.result @@ -0,0 +1,3 @@ +SELECT 1; +1 +1 diff --git a/mysql-test/suite/galera/r/galera_status_local_index.result b/mysql-test/suite/galera/r/galera_status_local_index.result new file mode 100644 index 00000000000..4e886ac8921 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_status_local_index.result @@ -0,0 +1,13 @@ +CREATE TABLE wsrep_local_indexes (wsrep_local_index INTEGER); +INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index')); +INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index')); +SELECT COUNT(*) = 2 FROM wsrep_local_indexes; +COUNT(*) = 2 +1 +SELECT COUNT(DISTINCT wsrep_local_index) = 2 FROM wsrep_local_indexes; +COUNT(DISTINCT wsrep_local_index) = 2 +1 +SELECT COUNT(*) = 0 FROM wsrep_local_indexes WHERE wsrep_local_index NOT IN (0, 1); +COUNT(*) = 0 +1 +DROP TABLE wsrep_local_indexes; diff --git a/mysql-test/suite/galera/r/galera_transaction_replay.result b/mysql-test/suite/galera/r/galera_transaction_replay.result index 23ed87ffe22..54ea8db699d 100644 --- a/mysql-test/suite/galera/r/galera_transaction_replay.result +++ b/mysql-test/suite/galera/r/galera_transaction_replay.result @@ -7,12 +7,12 @@ UPDATE t1 SET f2 = 'b' WHERE f1 = 1; SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; f1 f2 2 a -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; COMMIT;; SET SESSION wsrep_sync_wait = 0; UPDATE t1 SET f2 = 'c' WHERE f1 = 2; SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; COUNT(*) = 1 1 diff --git a/mysql-test/suite/galera/r/galera_var_log_bin.result b/mysql-test/suite/galera/r/galera_var_log_bin.result new file mode 100644 index 00000000000..a6ab62350b1 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_var_log_bin.result @@ -0,0 +1,10 @@ +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +UPDATE t1 SET f1 = 2 WHERE f1 = 1; +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_node_address.result b/mysql-test/suite/galera/r/galera_var_node_address.result new file mode 100644 index 00000000000..fa88f4b3128 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_var_node_address.result @@ -0,0 +1,9 @@ +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1); +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result index 6b84f03737b..603dfaeacc7 100644 --- a/mysql-test/suite/galera/r/galera_var_slave_threads.result +++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result @@ -104,3 +104,11 @@ COUNT(*) = 1 SET GLOBAL wsrep_slave_threads = 1; DROP TABLE t1; DROP TABLE t2; +# +# lp:1372840 - Changing wsrep_slave_threads causes future connections to hang +# +CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB; +SET GLOBAL wsrep_slave_threads = 4; +SET GLOBAL wsrep_slave_threads = 1; +DROP TABLE t1; +# End of tests diff --git a/mysql-test/suite/galera/r/galera_wan_restart_ist.result b/mysql-test/suite/galera/r/galera_wan_restart_ist.result new file mode 100644 index 00000000000..e58bff34e54 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_wan_restart_ist.result @@ -0,0 +1,53 @@ +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (13); +Shutting down server ... +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (131); +INSERT INTO t1 VALUES (22); +Shutting down server ... +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (23); +INSERT INTO t1 VALUES (24); +INSERT INTO t1 VALUES (221); +INSERT INTO t1 VALUES (34); +Shutting down server ... +INSERT INTO t1 VALUES (31); +INSERT INTO t1 VALUES (32); +INSERT INTO t1 VALUES (33); +INSERT INTO t1 VALUES (341); +SELECT COUNT(*) = 19 FROM t1; +COUNT(*) = 19 +1 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +SELECT COUNT(*) = 19 FROM t1; +COUNT(*) = 19 +1 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +SELECT COUNT(*) = 19 FROM t1; +COUNT(*) = 19 +1 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +SELECT COUNT(*) = 19 FROM t1; +COUNT(*) = 19 +1 +DROP TABLE t1; +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); diff --git a/mysql-test/suite/galera/r/galera_wan_restart_sst.result b/mysql-test/suite/galera/r/galera_wan_restart_sst.result new file mode 100644 index 00000000000..15de0fab342 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_wan_restart_sst.result @@ -0,0 +1,54 @@ +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (13); +Killing server ... +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (131); +INSERT INTO t1 VALUES (22); +Killing server ... +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (23); +INSERT INTO t1 VALUES (24); +INSERT INTO t1 VALUES (221); +INSERT INTO t1 VALUES (34); +Killing server ... +INSERT INTO t1 VALUES (31); +INSERT INTO t1 VALUES (32); +INSERT INTO t1 VALUES (33); +INSERT INTO t1 VALUES (341); +SELECT COUNT(*) = 19 FROM t1; +COUNT(*) = 19 +1 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +SELECT COUNT(*) = 19 FROM t1; +COUNT(*) = 19 +1 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +SELECT COUNT(*) = 19 FROM t1; +COUNT(*) = 19 +1 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 4 +1 +SELECT COUNT(*) = 19 FROM t1; +COUNT(*) = 19 +1 +DROP TABLE t1; +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("WSREP: gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)"); +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); diff --git a/mysql-test/suite/galera/r/lp1438990.result b/mysql-test/suite/galera/r/lp1438990.result new file mode 100644 index 00000000000..b53bc186953 --- /dev/null +++ b/mysql-test/suite/galera/r/lp1438990.result @@ -0,0 +1,21 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t3 (f1 INTEGER PRIMARY KEY); +CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CALL p1(NEW.f1); +CREATE PROCEDURE p1 (IN x INT) +BEGIN +DECLARE EXIT HANDLER FOR SQLEXCEPTION +BEGIN +ROLLBACK TO event_logging; +INSERT t3 VALUES (x); +END; +SAVEPOINT event_logging; +INSERT INTO t2 VALUES (x); +RELEASE SAVEPOINT event_logging; +END| +INSERT INTO t2 VALUES (1); +INSERT INTO t1 VALUES (1); +DROP PROCEDURE p1; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; diff --git a/mysql-test/suite/galera/r/mysql-wsrep#110.result b/mysql-test/suite/galera/r/mysql-wsrep#110.result new file mode 100644 index 00000000000..551c3666fb4 --- /dev/null +++ b/mysql-test/suite/galera/r/mysql-wsrep#110.result @@ -0,0 +1,38 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t3 (f1 INTEGER PRIMARY KEY); +CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CALL p1(NEW.f1); +CREATE PROCEDURE p1 (IN x INT) +BEGIN +DECLARE EXIT HANDLER FOR SQLEXCEPTION +BEGIN +ROLLBACK TO event_logging; +INSERT t3 VALUES (x); +END; +SAVEPOINT event_logging; +INSERT INTO t2 VALUES (x); +END| +INSERT INTO t2 VALUES (1); +INSERT INTO t1 VALUES (1); +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t2; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t3; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t2; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t3; +COUNT(*) = 1 +1 +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP PROCEDURE p1; diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result index 153d8084bec..62af519ad32 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result @@ -1,6 +1,6 @@ Setting SST method to mysqldump ... -GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; -SET GLOBAL wsrep_sst_auth = 'sst:sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; SET GLOBAL wsrep_sst_method = 'mysqldump'; Performing State Transfer on a server that has been temporarily disconnected CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/r/mysql-wsrep#90.result b/mysql-test/suite/galera/r/mysql-wsrep#90.result new file mode 100644 index 00000000000..da57b9d0068 --- /dev/null +++ b/mysql-test/suite/galera/r/mysql-wsrep#90.result @@ -0,0 +1,31 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; +SET GLOBAL wsrep_OSU_method = "RSU"; +SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; +ALTER TABLE t1 ADD COLUMN f2 INTEGER;; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_OSU_method = "TOI"; +SET DEBUG_SYNC= 'now SIGNAL continue'; +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +COUNT(*) = 2 +1 +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +COUNT(*) = 2 +1 +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; +SET GLOBAL wsrep_OSU_method = "TOI"; +SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; +ALTER TABLE t1 ADD COLUMN f2 INTEGER;; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_OSU_method = "RSU"; +SET DEBUG_SYNC= 'now SIGNAL continue'; +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +COUNT(*) = 2 +1 +INSERT INTO t1 VALUES (1,2); +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +COUNT(*) = 2 +1 +INSERT INTO t1 VALUES (3,4); +DROP TABLE t1; +SET GLOBAL WSREP_OSU_METHOD = TOI; diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index c44aece09e3..2da2b3ad503 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -60,8 +60,8 @@ push @::global_suppressions, 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 [0-9]* in non-primary configuration. Ignored.), + 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 .*|, diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test b/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test new file mode 100644 index 00000000000..6747977812b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test @@ -0,0 +1,34 @@ +# +# Test that applying plays well with FLUSH TABLE table_name WITH READ LOCK. The applier +# thread should block until UNLOCK TABLEs. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +FLUSH TABLE t1 WITH READ LOCK; + +--connection node_2 +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait = 0; + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--source include/wait_condition.inc + +SELECT COUNT(*) = 0 FROM t1; + +--connection node_1 +UNLOCK TABLES; + +SET SESSION wsrep_sync_wait = 7; +SELECT COUNT(*) = 2 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt new file mode 100644 index 00000000000..d8ecaacaa4c --- /dev/null +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt @@ -0,0 +1 @@ +--lock_wait_timeout=5 --innodb_lock_wait_timeout=5 --wait_timeout=5 diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test new file mode 100644 index 00000000000..99c45c04ba0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test @@ -0,0 +1,37 @@ +# +# Test that applying a DDL plays well with FLUSH TABLE table_name WITH READ LOCK. The applier +# thread should block until UNLOCK TABLEs. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; + +# Those values are valid only for connection node_1. The global values from the -master.opt file apply to applier threads. +SET SESSION lock_wait_timeout = 60; +SET SESSION innodb_lock_wait_timeout=60; +SET SESSION wait_timeout=60; + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +FLUSH TABLE t1 WITH READ LOCK; + +--connection node_2 +ALTER TABLE t1 ADD COLUMN f2 INTEGER; + +--connection node_1 +SELECT 1 FROM DUAL; +# Sleep for longer than the global timeout ... +--sleep 6 +SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; + +UNLOCK TABLES; + +SET SESSION wsrep_sync_wait = 7; + +SHOW CREATE TABLE t1; +SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_as_slave.test b/mysql-test/suite/galera/t/galera_as_slave.test index 79b9e5071a3..849b75eadd1 100644 --- a/mysql-test/suite/galera/t/galera_as_slave.test +++ b/mysql-test/suite/galera/t/galera_as_slave.test @@ -45,3 +45,6 @@ DROP TABLE t1; STOP SLAVE; RESET SLAVE ALL; + +--connection node_1 +RESET MASTER; diff --git a/mysql-test/suite/galera/t/galera_as_slave_nonprim.cnf b/mysql-test/suite/galera/t/galera_as_slave_nonprim.cnf new file mode 100644 index 00000000000..5a44e5664b5 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_nonprim.cnf @@ -0,0 +1 @@ +!include ../galera_3nodes_as_slave.cnf diff --git a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test new file mode 100644 index 00000000000..5c53ff79cc1 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test @@ -0,0 +1,96 @@ +# +# Test the behavior of a Galera async slave if it goes non-prim. Async replication +# should abort with an error but it should be possible to restart it. +# +# The galera/galera_2node_slave.cnf describes the setup of the nodes +# + +--source include/have_innodb.inc +--source include/have_log_bin.inc +--source include/big_test.inc + +# Step #1. Establish replication +# +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +# +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE USER='root'; +SET SESSION wsrep_sync_wait = 0; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +# Step #2. Force async slave to go non-primary + +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +--source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# Step #3. Force async replication to fail by creating a replication event while the slave is non-prim + +--connection node_1 +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); + +--connection node_2 +--sleep 5 + +--let $value = query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1) +--connection node_3 +--disable_query_log +--eval SELECT "$value" IN ("Error 'Unknown command' on query. Default database: 'test'. Query: 'BEGIN'", "Node has dropped from cluster") AS expected_error +--enable_query_log + +# Step #4. Bring back the async slave and restart replication +--connection node_2 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; + +--connection node_3 +--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 + +--connection node_2 +--source include/galera_wait_ready.inc +--source include/wait_until_connected_again.inc + +START SLAVE; + +# Confirm that the replication events have arrived + +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +DROP TABLE t1; + +--sleep 2 +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +STOP SLAVE; +RESET SLAVE ALL; + +CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query"); +CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047"); +CALL mtr.add_suppression("Send action {\\(nil\\), 328, TORDERED} returned -107 \\(Transport endpoint is not connected\\)"); +CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); +CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); + + +--connection node_1 +RESET MASTER; diff --git a/mysql-test/suite/galera/t/galera_as_slave_preordered.cnf b/mysql-test/suite/galera/t/galera_as_slave_preordered.cnf new file mode 100644 index 00000000000..d1a0fb15ff3 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_preordered.cnf @@ -0,0 +1,3 @@ +!include ../galera_2nodes_as_slave.cnf +[mysqld] +wsrep-preordered=TRUE diff --git a/mysql-test/suite/galera/t/galera_as_slave_preordered.test b/mysql-test/suite/galera/t/galera_as_slave_preordered.test new file mode 100644 index 00000000000..6f221f83b3a --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_preordered.test @@ -0,0 +1,84 @@ +# +# Test Galera as a slave to a MySQL master with --wsrep-preordered=TRUE +# +# The galera/galera_2node_slave.cnf describes the setup of the nodes +# + +--source include/have_innodb.inc +--source include/have_log_bin.inc + +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE USER='root'; + +# +# Issue many large-ish transaction on the async master +# + +--connection node_1 +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB; + +--disable_query_log +--let $count = 100 +while ($count) +{ + --eval INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2; + --dec $count +} +--enable_query_log + +# +# While the async transactions are being applied, issue another set of transactions +# on the Galera node. +# + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--let $count = 100 +--disable_query_log +while ($count) +{ + --eval INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2; + --dec $count +} +--enable_query_log + +# +# Confirm that all transactions successfully committed +# + +--let $wait_condition = SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1; +--source include/wait_condition.inc + +SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1; +SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1; + +# +# Cleanup +# + +--connection node_1 +DROP TABLE t1; +DROP TABLE ten; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +STOP SLAVE; +RESET SLAVE ALL; diff --git a/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.cnf b/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.cnf new file mode 100644 index 00000000000..d092d88bfaf --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.cnf @@ -0,0 +1,4 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +wsrep-mysql-replication-bundle=2 diff --git a/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.test b/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.test new file mode 100644 index 00000000000..460e040c010 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.test @@ -0,0 +1,48 @@ +# +# Test the wsrep_replication_bundle variable. We expect that multiple async replication events +# will be grouped together and thus a smaller number of wsrep_last_committed transactions will +# be reported. +# + +--source include/have_innodb.inc + +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +INSERT INTO t1 VALUES(2); +INSERT INTO t1 VALUES(3); +INSERT INTO t1 VALUES(4); +INSERT INTO t1 VALUES(5); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +# With wsrep_mysql_replication_bundle = 2, the last insert is not delivered +# because there are not enough events remaining to complete an entire bundle +SELECT COUNT(*) = 4 FROM t1; + +# Bundle is now complete, the last INSERT and the DROP are delivered +--connection node_1 +DROP TABLE t1; + +--connection node_2 +--sleep 1 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +STOP SLAVE; +RESET SLAVE ALL; diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf b/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf new file mode 100644 index 00000000000..7d684cef67d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld] +#wsrep_sst_method=xtrabackup-v2 +#wsrep_sst_auth="root:" +#wsrep_debug=ON + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' + diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test b/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test new file mode 100644 index 00000000000..251450f7099 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test @@ -0,0 +1,95 @@ +# +# Test that autoincrement works correctly while the cluster membership +# is changing and IST takes place. +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +--let $connection_id = `SELECT CONNECTION_ID()` + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; + +# Issue an endless stream of autoincrement inserts + +DELIMITER |; +CREATE PROCEDURE p1 () +BEGIN + DECLARE x INT DEFAULT 1; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; + + WHILE 1 DO + INSERT INTO t1 VALUES (DEFAULT); + COMMIT; + END WHILE; +END| +DELIMITER ;| + +--send CALL p1(); +--sleep 2 + +--connection node_2 +--send CALL p1(); +--sleep 2 + +# Kill and restart node #2 + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +--source include/kill_galera.inc + +--sleep 10 +--source include/start_mysqld.inc +--sleep 25 +--source include/wait_until_connected_again.inc + +INSERT INTO t1 VALUES (DEFAULT); + +# Terminate the stored procedure + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +--disable_query_log +--eval KILL CONNECTION $connection_id +--enable_query_log + +INSERT INTO t1 VALUES (DEFAULT); + +--connection node_1 +# CR_SERVER_LOST +--error 2013,2006 +--reap + +--connection node_2 +# CR_SERVER_LOST +--error 2013,2006 +--reap + +--sleep 10 + +# Confirm that the count is correct and that the cluster is intact + +--connection node_1a +--let $count = `SELECT COUNT(*) FROM t1` + +--connection node_2a +--disable_query_log +--eval SELECT COUNT(*) = $count AS count_equal FROM t1 +--enable_query_log + +CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0"); + +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +--connection node_1a +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +DROP PROCEDURE p1; +DROP TABLE t1; + +CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)"); +CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0"); diff --git a/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test b/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test new file mode 100644 index 00000000000..dbbe3b3c483 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test @@ -0,0 +1,40 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test that a local FLUSH TABLES FOR EXPORT will NOT be broken by an incoming remote transaction against that table +# + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--connection node_2 +SET AUTOCOMMIT=OFF; +--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` +FLUSH TABLES t1 FOR EXPORT; + +--connection node_1 +INSERT INTO t1 VALUES (2); + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--source include/wait_condition.inc + +UNLOCK TABLES; + +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--source include/wait_condition.inc + +COMMIT; +SET AUTOCOMMIT=ON; +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 +--source include/wait_condition.inc +SELECT * FROM t1; + +--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` + +--disable_query_log +--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 0 AS wsrep_local_aborts_increment; +--enable_query_log + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test index 788427103a5..4582f3f972d 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test @@ -2,7 +2,7 @@ --source include/have_innodb.inc # -# Test that a local LOCK TABLE will be broken by an incoming remote transaction against that table +# Test that a local LOCK TABLE will NOT be broken by an incoming remote transaction against that table # CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; @@ -12,22 +12,25 @@ SET AUTOCOMMIT=OFF; --let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` LOCK TABLE t1 WRITE; -# Issue a concurrent INSERT against the lock table that will block ---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ---send INSERT INTO t1 VALUES (1); - --connection node_1 INSERT INTO t1 VALUES (2); -# The concurent insert is allowed to complete because the LOCK TABLE is now broken ---connection node_2a ---error 0 ---reap +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--source include/wait_condition.inc + +UNLOCK TABLES; + +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--source include/wait_condition.inc + +COMMIT; +SELECT COUNT(*) = 1 FROM t1; --let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` --disable_query_log ---eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; +--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 0 AS wsrep_local_aborts_increment; --enable_query_log DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test index 600432ce0ca..d0cc23446b2 100644 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test @@ -4,6 +4,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/big_test.inc CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); diff --git a/mysql-test/suite/galera/t/galera_drop_multi.test b/mysql-test/suite/galera/t/galera_drop_multi.test new file mode 100644 index 00000000000..44b1b619b2b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_drop_multi.test @@ -0,0 +1,41 @@ +# +# Test that multi-table DROP TABLE statements are properly replicated +# See http://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-20.html +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; +CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=MyISAM; +CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t4 (f1 INTEGER) ENGINE=InnoDB; + +CREATE TABLE t5 (f1 INTEGER); + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +DROP TABLE t1, t2, t3, t4; + +INSERT INTO t5 VALUES (1); + +COMMIT; + +--connection node_2 +--error ER_NO_SUCH_TABLE +SHOW CREATE TABLE t1; + +--error ER_NO_SUCH_TABLE +SHOW CREATE TABLE t2; + +--error ER_NO_SUCH_TABLE +SHOW CREATE TABLE t3; + +--error ER_NO_SUCH_TABLE +SHOW CREATE TABLE t4; + +CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t2,test.t4'' on query\. Default database: 'test'\. Query: 'DROP TABLE t1, t2, t3, t4', Error_code: 1051"); + +--connection node_1 +DROP TABLE t5; diff --git a/mysql-test/suite/galera/t/galera_flush.test b/mysql-test/suite/galera/t/galera_flush.test index 5845fadd562..3ba5edbae6f 100644 --- a/mysql-test/suite/galera/t/galera_flush.test +++ b/mysql-test/suite/galera/t/galera_flush.test @@ -77,8 +77,32 @@ FLUSH USER_RESOURCES; --enable_query_log +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH TABLES; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + +--connection node_1 +CREATE TABLE t2 (f1 INTEGER); + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH TABLES t2; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + + # -# The following statements should not be replicated: FLUSH LOGS, FLUSH TABLES +# The following statements should not be replicated: FLUSH LOGS, FLUSH TABLES WITH LOCKS # @@ -103,5 +127,47 @@ UNLOCK TABLES; --eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff; --enable_query_log + +## Test LOCK TABLES with FLUSH TABLES +## LOCK TABLES t1 write followed by flush tables t1 should succeed due to MDL upgrade. +## LOCK tables t2 read followed by flush tables t2 should fail with ER_TABLE_NOT_LOCKED_FOR_WRITE + + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +LOCK TABLES t1 WRITE; +FLUSH TABLES t1; +UNLOCK TABLES; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +LOCK TABLES t1 READ; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +FLUSH TABLES t1; +UNLOCK TABLES; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff; +--enable_query_log +--connection node_1 +FLUSH TABLES t1; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + + + --connection node_1 DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format-master.opt b/mysql-test/suite/galera/t/galera_forced_binlog_format-master.opt new file mode 100644 index 00000000000..8c58b59b45d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_forced_binlog_format-master.opt @@ -0,0 +1 @@ +--log-bin --wsrep_forced_binlog_format=ROW diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format.test b/mysql-test/suite/galera/t/galera_forced_binlog_format.test new file mode 100644 index 00000000000..934c15399e0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test @@ -0,0 +1,25 @@ +# +# Test that wsrep_forced_binlog_format=ROW indeed prevents the log to be switched to STATEMENT format on a per-connection basis +# + +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/galera_cluster.inc + +--connection node_1 +RESET MASTER; + +SET SESSION binlog_format = 'STATEMENT'; + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +SET SESSION binlog_format = 'MIXED'; + +INSERT INTO t1 VALUES (2); + +--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ +--replace_column 2 <Pos> 5 <End_log_pos> +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_ftwrl.test b/mysql-test/suite/galera/t/galera_ftwrl.test index db9bd132566..de8310e52d2 100644 --- a/mysql-test/suite/galera/t/galera_ftwrl.test +++ b/mysql-test/suite/galera/t/galera_ftwrl.test @@ -2,9 +2,10 @@ --source include/have_innodb.inc # -# At this time, issing a FLUSH TABLES WITH READ LOCK causes SELECT and SHOW to hang if -# casuality can not be ensured because another node issued a statement in the meantime -# which could not be applied because FTWRL blocks the applier as well +# At this time, issing a FLUSH TABLES WITH READ LOCK causes SELECT and SHOW to +# hang if causality can not be ensured because another node issued a statement +# in the meantime which could not be applied because FTWRL blocks the applier +# as well # # See LP bug 1271177 # diff --git a/mysql-test/suite/galera/t/galera_ftwrl_drain.test b/mysql-test/suite/galera/t/galera_ftwrl_drain.test new file mode 100644 index 00000000000..f022a9437c2 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ftwrl_drain.test @@ -0,0 +1,68 @@ +# +# Test the following sequence of events: +# +# 1. issue a remote transaction +# 2. applier is blocked from applying the transaction locally using apply_monitor_slave_enter_sync +# 3. FTWRL is issued and blocks in ApplyOrder>::drain_common +# 4. applier is unblocked +# 5. remote transaction is applied +# 6. FTWRL is granted +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source suite/galera/include/galera_have_debug_sync.inc + +--connection node_1 +CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; + +--connection node_2 +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; + +--connection node_1 +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; + +# Wait until applier has blocked +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters' AND VARIABLE_VALUE = 'apply_monitor_slave_enter_sync' +--source include/wait_condition.inc + +SELECT COUNT(*) = 0 FROM t1; + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +--send FLUSH TABLES WITH READ LOCK; + +--connection node_2 +--sleep 1 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Init' AND INFO = 'FLUSH TABLES WITH READ LOCK' +--source include/wait_condition.inc + +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; + +--connection node_2a +--reap + +--connection node_2 + +SET SESSION lock_wait_timeout = 1; +SET SESSION innodb_lock_wait_timeout=1; +SET SESSION wait_timeout=1; + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t2 VALUES (2); + +--connection node_2a +UNLOCK TABLES; + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; +INSERT INTO t1 VALUES (3); + +--connection node_1 +SELECT COUNT(*) = 2 FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_fulltext.test b/mysql-test/suite/galera/t/galera_fulltext.test index aa93a336f92..a90cab1aa1a 100644 --- a/mysql-test/suite/galera/t/galera_fulltext.test +++ b/mysql-test/suite/galera/t/galera_fulltext.test @@ -24,16 +24,16 @@ SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE ' # --connection node_1 -# Insert 10K rows -INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +# Insert 1K rows +INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; --connection node_2 -SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); +SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); UPDATE t1 SET f2 = 'abcdefjhk'; --connection node_1 -SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); +SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); --connection node_2 diff --git a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test index e15da0e35ad..fd77ec0a0eb 100644 --- a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test +++ b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test @@ -9,6 +9,9 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --connection node_2 +SELECT COUNT(*) = 1 FROM t1; +--sleep 1 + --let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; @@ -24,13 +27,14 @@ INSERT INTO t1 VALUES (4); # This query will hang because flow control will kick in --send INSERT INTO t1 VALUES (5); ---sleep 1 +--sleep 2 --let $galera_connection_name = node_1a --let $galera_server_number = 1 --source include/galera_connect.inc --connection node_1a -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'query end' AND INFO = 'INSERT INTO t1 VALUES (5)'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'query end' AND INFO = 'INSERT INTO t1 VALUES (5)'; +--source include/wait_condition.inc --connection node_2 # Unblock the slave applier thread diff --git a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test index cafd8acfdd9..98be4f6a300 100644 --- a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test +++ b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test @@ -6,6 +6,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/big_test.inc CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); diff --git a/mysql-test/suite/galera/t/galera_gra_log.test b/mysql-test/suite/galera/t/galera_gra_log.test new file mode 100644 index 00000000000..5329dc24546 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gra_log.test @@ -0,0 +1,38 @@ +# +# Test that GRA_* files are generated on applier failure and are readable. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_2 +--exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log + +# Create applier failure + +SET SESSION wsrep_on=OFF; +CREATE TABLE t1 (f1 INTEGER); + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); + +--connection node_2 +SELECT COUNT(*) = 0 FROM t1; + +# Compose a valid binlog from a header file and the GRA file + +--let $gra_binlog_file = $MYSQLTEST_VARDIR/tmp/gra.log +--exec rm -rf $gra_binlog_file + +--exec cp std_data/binlog-header.log $gra_binlog_file +--exec cat $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log >> $gra_binlog_file + +# Make sure the binlog thus produced is readable and contains the failure +--replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMP>/ /#[0-9]+ +[0-9]+:[0-9]+:[0-9]+/<ISO TIMESTAMP>/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=<PSEUDO_THREAD_ID>/ /thread_id=[0-9]+/thread_id=<QUERY_THREAD_ID>/ +--exec $MYSQL_BINLOG $gra_binlog_file + +SET SESSION wsrep_on=ON; + +CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query"); + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf index 85245ff464a..41a1aab382b 100644 --- a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf +++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf @@ -2,6 +2,8 @@ [mysqld] wsrep_sst_method=xtrabackup-v2 +wsrep_sst_auth=root: + innodb_flush_log_at_trx_commit=0 [mysqld.1] diff --git a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf index 21e597445a8..a762b939f69 100644 --- a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf +++ b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf @@ -2,6 +2,7 @@ [mysqld] wsrep_sst_method=xtrabackup-v2 +wsrep_sst_auth=root: [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test new file mode 100644 index 00000000000..e14a8b9af23 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_kill_applier.test @@ -0,0 +1,26 @@ +# +# This test checks that applier threads are immune to KILL QUERY and KILL STATEMENT +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 + +--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE != 'wsrep aborter idle' OR STATE IS NULL LIMIT 1` + +--disable_query_log +--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR +--eval KILL $applier_thread + +--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR +--eval KILL QUERY $applier_thread + +--let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` + +--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR +--eval KILL $aborter_thread + +--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR +--eval KILL QUERY $aborter_thread +--enable_query_log diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test index 0f4c4c0db78..653dc2dd75a 100644 --- a/mysql-test/suite/galera/t/galera_many_rows.test +++ b/mysql-test/suite/galera/t/galera_many_rows.test @@ -3,6 +3,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--connection node_1 +SET SESSION innodb_lock_wait_timeout=600; +SET SESSION lock_wait_timeout=600; + CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); @@ -10,6 +14,12 @@ CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoD INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; --connection node_2 +SET SESSION wsrep_sync_wait = 0; +--let $wsrep_provider_options_node2 = `SELECT @@wsrep_provider_options` +SET SESSION wsrep_sync_wait = 7; + +SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT1H'; + SELECT COUNT(*) = 100000 FROM t1; INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; @@ -20,21 +30,6 @@ UPDATE t1 SET f2 = 1; --connection node_2 SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1; -# Rollback ---connection node_1 -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; -ROLLBACK; -SELECT COUNT(*) = 200000 FROM t1; - ---connection node_2 -SELECT COUNT(*) = 200000 FROM t1; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -UPDATE t1 SET f2 = 2; -ROLLBACK; - --connection node_1 START TRANSACTION; SELECT COUNT(*) = 200000 FROM t1; @@ -51,5 +46,9 @@ COMMIT; --error ER_LOCK_DEADLOCK COMMIT; +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node2'; +--enable_query_log + DROP TABLE t1; DROP TABLE ten; diff --git a/mysql-test/suite/galera/t/galera_migrate.test b/mysql-test/suite/galera/t/galera_migrate.test index 873640b88d4..84897b66c6d 100644 --- a/mysql-test/suite/galera/t/galera_migrate.test +++ b/mysql-test/suite/galera/t/galera_migrate.test @@ -104,11 +104,11 @@ INSERT INTO t1 VALUES (6); --connection node_3 # We need a user with a password for mysqldump SST -GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; -SET GLOBAL wsrep_sst_auth = 'sst:sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 -GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; --disable_query_log --eval SET GLOBAL wsrep_sst_method = 'mysqldump'; diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test index a192044754d..f280e49d206 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test @@ -4,6 +4,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/big_test.inc # Create a second connection to node1 so that we can run transactions concurrently --let $galera_connection_name = node_1a diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test index cf984f92b2f..8680d62a36d 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test @@ -4,6 +4,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/big_test.inc # Create a second connection to node1 so that we can run transactions concurrently --let $galera_connection_name = node_1a diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test index a1429954980..b1dc14deb5b 100644 --- a/mysql-test/suite/galera/t/galera_parallel_simple.test +++ b/mysql-test/suite/galera/t/galera_parallel_simple.test @@ -35,9 +35,9 @@ INSERT INTO t2 VALUES (1); --connection node_2 -SELECT COUNT(*) = 6 FROM t1; -SELECT COUNT(*) = 6 FROM t2; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'closing tables'; +SELECT COUNT(*) = 10 FROM t1; +SELECT COUNT(*) = 10 FROM t2; +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%'; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; diff --git a/mysql-test/suite/galera/t/galera_prepared_statement.test b/mysql-test/suite/galera/t/galera_prepared_statement.test new file mode 100644 index 00000000000..3bee097ff39 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_prepared_statement.test @@ -0,0 +1,45 @@ +# +# A simple test for PREPARE / EXECUTE -style prepared statements with Galera +# +# C-API-level prepared-statements can not be triggered from inside mysqltest, however +# can be exercised when running an MTR test suite with the --ps-protocol switch. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 CHAR(5)) ENGINE=InnoDB; +CREATE TABLE t2 (f1 CHAR(5)) ENGINE=InnoDB; +CREATE TABLE t3 (f1 CHAR(5)) ENGINE=InnoDB; +CREATE TABLE t4 (f1 CHAR(5)) ENGINE=InnoDB; + +SET SESSION sql_mode='STRICT_ALL_TABLES'; + +PREPARE st1 FROM 'INSERT INTO t1 VALUES ("abc")'; +PREPARE st2 FROM 'INSERT INTO t2 VALUES ("abc")'; +PREPARE st3 FROM 'INSERT INTO t3 VALUES ("abc")'; +PREPARE st4 FROM 'INSERT INTO t4 VALUES ("abc")'; + +EXECUTE st1; +EXECUTE st2; +EXECUTE st3; +EXECUTE st4; + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) = 1 FROM t2; +SELECT COUNT(*) = 1 FROM t3; +SELECT COUNT(*) = 1 FROM t4; + +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +ALTER TABLE t1 DROP COLUMN f1; + +--connection node_1 +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +EXECUTE st1; + +--connection node_1 +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; diff --git a/mysql-test/suite/galera/t/galera_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test index 828f35d2ba3..c0fa4af07e0 100644 --- a/mysql-test/suite/galera/t/galera_read_only.test +++ b/mysql-test/suite/galera/t/galera_read_only.test @@ -17,7 +17,23 @@ INSERT INTO t1 VALUES (1); --connection node_2 SELECT COUNT(*) = 1 FROM t1; -SET GLOBAL read_only=FALSE; +CREATE USER foo@localhost; + +--echo # Open connection to node 2 using 'foo' user. +--let $port_2= \$NODE_MYPORT_2 +--connect(foo_node_2,127.0.0.1,foo,,test,$port_2,) +--echo +--echo # Connect with foo_node_2 +--connection foo_node_2 +--error ER_OPTION_PREVENTS_STATEMENT +INSERT INTO t1 VALUES (2); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; + +# Cleanup +SET GLOBAL read_only=FALSE; DROP TABLE t1; +DROP USER foo@localhost; diff --git a/mysql-test/suite/galera/t/galera_restart_nochanges.test b/mysql-test/suite/galera/t/galera_restart_nochanges.test index 4021ab39cc0..a61332cefd6 100644 --- a/mysql-test/suite/galera/t/galera_restart_nochanges.test +++ b/mysql-test/suite/galera/t/galera_restart_nochanges.test @@ -22,6 +22,7 @@ INSERT INTO t1 VALUES (1); --let $galera_server_number = 2 --source include/galera_connect.inc --connection node_2a +--source include/wait_until_ready.inc SELECT COUNT(*) = 1 FROM t1; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/galera_serializable.test b/mysql-test/suite/galera/t/galera_serializable.test new file mode 100644 index 00000000000..b12d57fd488 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_serializable.test @@ -0,0 +1,76 @@ +# +# Test that the SERIALIZABLE isolation level behaves as expected. +# A local serializable transaction is aborted by an incoming remote update +# +# wsrep_sync_wait does not work well with serializable, see mysql-wsrep#130 +# hence the need to use --sleep . +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 + +CREATE TABLE t1 (id INT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; + +# +# Read (local transaction) / Write (remote transaction) conflict +# + +SET AUTOCOMMIT=OFF; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +START TRANSACTION; + +SELECT * FROM t1; + +--connection node_2 +INSERT INTO t1 VALUES (1,1); + +--sleep 2 +--connection node_1 +--error ER_LOCK_DEADLOCK +SELECT * FROM t1; + +ROLLBACK; +DELETE FROM t1; + +# +# Write (local transaction) / Write (remote transaction) conflict +# + +--connection node_1 +INSERT INTO t1 VALUES (1,1); +START TRANSACTION; +SELECT * FROM t1; + +--connection node_2 +UPDATE t1 SET f2 = 2; + +--sleep 2 +--connection node_1 +--error ER_LOCK_DEADLOCK +UPDATE t1 SET f2 = 3; + +ROLLBACK; +DELETE FROM t1; + +# +# Write (local transaction) / Write (remote transaction) conflict +# Local transaction writes before remote one. +# Nothing special happens here - ordinary deadlock on COMMIT +# + +--connection node_1 +START TRANSACTION; + +--connection node_1 +INSERT INTO t1 VALUES (1,1); + +--connection node_2 +INSERT INTO t1 VALUES (1,2); + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test index c3e779618df..e0298e55422 100644 --- a/mysql-test/suite/galera/t/galera_split_brain.test +++ b/mysql-test/suite/galera/t/galera_split_brain.test @@ -38,7 +38,7 @@ SET GLOBAL wsrep_cluster_address = ''; --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc ---sleep 5 +--sleep 10 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/galera/t/galera_ssl_compression.cnf b/mysql-test/suite/galera/t/galera_ssl_compression.cnf new file mode 100644 index 00000000000..d6fd2c4d510 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ssl_compression.cnf @@ -0,0 +1,7 @@ +!include ../galera_2nodes.cnf + +[mysqld.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.ssl_compression=YES' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#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.ssl_compression=YES' diff --git a/mysql-test/suite/galera/t/galera_ssl_compression.test b/mysql-test/suite/galera/t/galera_ssl_compression.test new file mode 100644 index 00000000000..cdecf4807d4 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ssl_compression.test @@ -0,0 +1,34 @@ +# +# Test SSL compression. The accompanying galera_ssl_compression.cnf has a customized wsrep_provider_options setting that enables SSL and compression. +# +# Unfortunately there is no wire-level traffic bytes counter that would allow us to determine that compression kicked in, so we can only +# perform a most basic replication check. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +--connection node_2 +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +--connection node_1 + +# Check that the socket.ssl_compression provider option is not dynamic +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_provider_options = "socket.ssl_compression=No"; + +CREATE TABLE t1 (f1 VARCHAR(333) PRIMARY KEY, f2 BLOB) Engine=InnoDB; +INSERT INTO t1 VALUES (REPEAT('a', 333), REPEAT('b', 65535)); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('a', 333) AND f2 = REPEAT('b', 65535); + +--connection node_1 +DROP TABLE t1; + +CALL mtr.add_suppression("Unknown parameter 'socket\.ssl_compression'"); +CALL mtr.add_suppression("Set options returned 7"); diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf new file mode 100644 index 00000000000..2954ae0f4cb --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -0,0 +1,7 @@ +!include ../galera_2nodes.cnf + +[mysqld.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' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#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' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test new file mode 100644 index 00000000000..07aac0fbe92 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -0,0 +1,46 @@ +# +# Test upgrading the SSL certificates in a rolling fashion. +# +# 1. The starting state with the old key and cert is is described in galera_ssl_upgrade.cnf +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# 2. Restart node #1 with a socket.ssl_ca that includes both the new and the old certificate + +--connection node_1 +--source include/shutdown_mysqld.inc +--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-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/wait_until_connected_again.inc + +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# 3. Restart node #2 with the new socket.ssl_ca , socket.ssl_cert and socket.ssl_key + +--connection node_2 +--source include/shutdown_mysqld.inc +--let $start_mysqld_params = --wsrep_provider_options=base_port=$NODE_GALERAPORT_2;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-upgrade-server-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-upgrade-server-key.pem +--source include/start_mysqld.inc +--source include/wait_until_connected_again.inc + +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# 4. Restart node #1 with the new socket.ssl_ca , socket.ssl_cert and socket.ssl_key + +--connection node_1 +--source include/shutdown_mysqld.inc +--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-upgrade-server-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-upgrade-server-key.pem +--source include/start_mysqld.inc +--source include/wait_until_connected_again.inc + +SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Upgrade complete. Both nodes now use the new key and certificate diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf new file mode 100644 index 00000000000..e108484b248 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf @@ -0,0 +1,22 @@ +!include ../galera_2nodes.cnf + +# We do not set mysqldump-related SST options here because doing so on startup +# causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld] +wsrep_debug=ON + +ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem +ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem +ssl-key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem + +[client] +ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem +ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem +ssl-key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.test b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.test new file mode 100644 index 00000000000..0b3edeb75ff --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.test @@ -0,0 +1,22 @@ +# +# Test mysqldump SST with client SSL key. See galera_sst_mysqldump_with_key.cnf for the configuration on the client side. +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_openssl.inc + +--source suite/galera/include/galera_sst_set_mysqldump.inc + +--connection node_1 +CREATE USER sslsst; +GRANT ALL PRIVILEGES ON *.* TO sslsst; +GRANT USAGE ON *.* TO sslsst REQUIRE SSL; + +SET GLOBAL wsrep_sst_auth = 'sslsst:'; + +--source suite/galera/include/galera_st_disconnect_slave.inc + +--source suite/galera/include/galera_sst_restore.inc +DROP USER sslsst; diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.cnf b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.cnf new file mode 100644 index 00000000000..31bd1af07c2 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.cnf @@ -0,0 +1,24 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=xtrabackup-v2 +wsrep_sst_auth="root:" +wsrep_debug=ON + +[xtrabackup] +backup-locks +close-files +compact +# compression requires qpress from the Percona repositories +# compress +# compress-threads=2 +encryption=AES256 +encrypt-key=4FA92C5873672E20FB163A0BCB2BB4A4 +galera-info +history=backup +parallel=2 + +[SST] +encrypt=1 +encrypt-algo=AES256 +encrypt-key=4FA92C5873672E20FB163A0BCB2BB4A4 diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.test new file mode 100644 index 00000000000..4573f176482 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.test @@ -0,0 +1,13 @@ +# +# This test checks that various options can be passed to xtrabackup via the my.cnf file +# Initial SST happens via xtrabackup, so there is not much to do in the body of the test +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +SELECT 1; + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.cnf new file mode 100644 index 00000000000..969516f5f3b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.cnf @@ -0,0 +1,11 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=xtrabackup-v2 +wsrep_sst_auth="root:" +wsrep_debug=ON + +[SST] +tkey=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem +tcert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem +encrypt=3 diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.test new file mode 100644 index 00000000000..24d9589d111 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.test @@ -0,0 +1,13 @@ +# +# This test checks that key and cert encryption options can be passed to xtrabackup via the my.cnf file +# Initial SST happens via xtrabackup, so there is not much to do in the body of the test +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +SELECT 1; + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc diff --git a/mysql-test/suite/galera/t/galera_status_local_index.test b/mysql-test/suite/galera/t/galera_status_local_index.test new file mode 100644 index 00000000000..b61b8ced863 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_status_local_index.test @@ -0,0 +1,21 @@ +# +# Test that a two-node cluster has distinct values for wsrep_local_index for its nodes +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE wsrep_local_indexes (wsrep_local_index INTEGER); +INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index')); + +--connection node_2 +INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index')); + + +--connection node_1 +SELECT COUNT(*) = 2 FROM wsrep_local_indexes; +SELECT COUNT(DISTINCT wsrep_local_index) = 2 FROM wsrep_local_indexes; +SELECT COUNT(*) = 0 FROM wsrep_local_indexes WHERE wsrep_local_index NOT IN (0, 1); + +DROP TABLE wsrep_local_indexes; diff --git a/mysql-test/suite/galera/t/galera_transaction_replay.test b/mysql-test/suite/galera/t/galera_transaction_replay.test index d2c74ab192b..632aa5cc0d5 100644 --- a/mysql-test/suite/galera/t/galera_transaction_replay.test +++ b/mysql-test/suite/galera/t/galera_transaction_replay.test @@ -23,7 +23,7 @@ SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; # Block the commit --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; --connection node_1 --send COMMIT; @@ -31,17 +31,25 @@ SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_enter_sync'; # Wait until commit is blocked --connection node_1a SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters' AND VARIABLE_VALUE = 'apply_monitor_enter_sync' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters' AND VARIABLE_VALUE = 'commit_monitor_enter_sync' --source include/wait_condition.inc # Issue a conflicting update on node #2 --connection node_2 UPDATE t1 SET f2 = 'c' WHERE f1 = 2; +# Wait for both transactions to be blocked +--connection node_1a +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'System lock'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'init' AND INFO = 'COMMIT'; +--source include/wait_condition.inc + # Unblock the commit --connection node_1a SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; # Commit succeeds --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_var_load_data_splitting.test b/mysql-test/suite/galera/t/galera_var_load_data_splitting.test index 0783dc897f8..38dab0a981b 100644 --- a/mysql-test/suite/galera/t/galera_var_load_data_splitting.test +++ b/mysql-test/suite/galera/t/galera_var_load_data_splitting.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/big_test.inc --let $wsrep_load_data_splitting_orig = `SELECT @@wsrep_load_data_splitting` diff --git a/mysql-test/suite/galera/t/galera_var_log_bin.cnf b/mysql-test/suite/galera/t/galera_var_log_bin.cnf new file mode 100644 index 00000000000..f7f17e3720a --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_log_bin.cnf @@ -0,0 +1,5 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin + diff --git a/mysql-test/suite/galera/t/galera_var_log_bin.test b/mysql-test/suite/galera/t/galera_var_log_bin.test new file mode 100644 index 00000000000..1b1886b996d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_log_bin.test @@ -0,0 +1,22 @@ +# +# A simple test that confirms that Galera works with log-bin enabled, that is +# when MySQL's binlog is in effect rather than the Galera 'dummy' implementation. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (1); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; + +--connection node_1 +UPDATE t1 SET f1 = 2 WHERE f1 = 1; + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_var_node_address.cnf b/mysql-test/suite/galera/t/galera_var_node_address.cnf new file mode 100644 index 00000000000..0de0edaa396 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_node_address.cnf @@ -0,0 +1,10 @@ +!include ../galera_4nodes.cnf + +[mysqld.2] +wsrep_node_address=127.0.0.1 + +[mysqld.3] +wsrep_node_address=localhost + +[mysqld.4] +wsrep_node_address=lo diff --git a/mysql-test/suite/galera/t/galera_var_node_address.test b/mysql-test/suite/galera/t/galera_var_node_address.test new file mode 100644 index 00000000000..cf118cf9934 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_node_address.test @@ -0,0 +1,22 @@ +# +# Test wsrep_node_address . The galera_var_node_address.cnf contains various settings for +# wsrep_node_address, so in this test we simply confirm that the cluster has started up correctly. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); + +--connection node_2 +INSERT INTO t1 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 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test index a83924c13ce..50e22fbef66 100644 --- a/mysql-test/suite/galera/t/galera_var_slave_threads.test +++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test @@ -68,3 +68,17 @@ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system use DROP TABLE t1; DROP TABLE t2; + +--echo # +--echo # lp:1372840 - Changing wsrep_slave_threads causes future connections to hang +--echo # + +--connection node_1 +CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB; + +--connection node_2 +SET GLOBAL wsrep_slave_threads = 4; +SET GLOBAL wsrep_slave_threads = 1; +DROP TABLE t1; + +--echo # End of tests diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf new file mode 100644 index 00000000000..3f7d2a2448f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf @@ -0,0 +1,14 @@ +!include ../galera_4nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' + +[mysqld.3] +wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' + +[mysqld.4] +wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=2' + diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.test b/mysql-test/suite/galera/t/galera_wan_restart_ist.test new file mode 100644 index 00000000000..42f63df3acc --- /dev/null +++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.test @@ -0,0 +1,148 @@ +# +# Test that even after multiple restarts in a WAN context with two segments, the cluster continues to operate correctly. +# +# We can not easily restart the first node, so instead we restart all the other nodes. MTR does not allow multiple nodes +# to be down at the same time, so restarts are sequential. +# +# We can not test any of the actual WAN optimizations from inside MTR and no +# status variables are provided. So we only check that simple replication works. +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1); + +--connection node_2 +INSERT INTO t1 VALUES (2); + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +INSERT INTO t1 VALUES (3); + +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--connection node_4 +INSERT INTO t1 VALUES (4); + +# +# Restart node #3 +# + +--connection node_3 +INSERT INTO t1 VALUES (13); + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc +--sleep 5 + +--connection node_1 +INSERT INTO t1 VALUES (11); + +--connection node_2 +INSERT INTO t1 VALUES (12); + +--connection node_4 +INSERT INTO t1 VALUES (14); + +--connection node_3 +--source include/start_mysqld.inc +--sleep 5 +--source include/wait_until_connected_again.inc + +INSERT INTO t1 VALUES (131); + +# +# Restart node #2 +# + +--connection node_2 +INSERT INTO t1 VALUES (22); + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc +--sleep 5 + +--connection node_1 +INSERT INTO t1 VALUES (21); + +--connection node_3 +INSERT INTO t1 VALUES (23); + +--connection node_4 +INSERT INTO t1 VALUES (24); + +--connection node_2 +--source include/start_mysqld.inc +--sleep 5 +--source include/wait_until_connected_again.inc + +INSERT INTO t1 VALUES (221); + +# +# Restart node #4 +# + +--connection node_4 +INSERT INTO t1 VALUES (34); + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc +--sleep 5 + +--connection node_1 +INSERT INTO t1 VALUES (31); + +--connection node_2 +INSERT INTO t1 VALUES (32); + +--connection node_3 +INSERT INTO t1 VALUES (33); + +--connection node_4 +--source include/start_mysqld.inc +--sleep 5 +--source include/wait_until_connected_again.inc + +INSERT INTO t1 VALUES (341); + + +# +# Check all nodes +# + +--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 + +SELECT COUNT(*) = 19 FROM t1; + +--connection node_2 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT COUNT(*) = 19 FROM t1; + +--connection node_3 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT COUNT(*) = 19 FROM t1; + +--connection node_4 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT COUNT(*) = 19 FROM t1; + +--connection node_1 +DROP TABLE t1; +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); + +--connection node_2 +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); + +--connection node_3 +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); + +--connection node_4 +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf new file mode 100644 index 00000000000..3f7d2a2448f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf @@ -0,0 +1,14 @@ +!include ../galera_4nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' + +[mysqld.3] +wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' + +[mysqld.4] +wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=2' + diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.test b/mysql-test/suite/galera/t/galera_wan_restart_sst.test new file mode 100644 index 00000000000..9b12eeed1ac --- /dev/null +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.test @@ -0,0 +1,149 @@ +# +# Test that even after multiple restarts in a WAN context with two segments, the cluster continues to operate correctly. +# +# We can not easily restart the first node, so instead we restart all the other nodes. MTR does not allow multiple nodes +# to be down at the same time, so restarts are sequential. +# +# We can not test any of the actual WAN optimizations from inside MTR and no +# status variables are provided. So we only check that simple replication works. +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1); + +--connection node_2 +INSERT INTO t1 VALUES (2); + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +INSERT INTO t1 VALUES (3); + +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--connection node_4 +INSERT INTO t1 VALUES (4); + +# +# Restart node #3 +# + +--connection node_3 +INSERT INTO t1 VALUES (13); + +--source include/kill_galera.inc +--sleep 5 + +--connection node_1 +--source include/wait_until_connected_again.inc +INSERT INTO t1 VALUES (11); + +--connection node_2 +INSERT INTO t1 VALUES (12); + +--connection node_4 +INSERT INTO t1 VALUES (14); + +--connection node_3 +--source include/start_mysqld.inc +--sleep 5 +--source include/wait_until_connected_again.inc + +INSERT INTO t1 VALUES (131); + +# +# Restart node #2 +# + +--connection node_2 +INSERT INTO t1 VALUES (22); + +--source include/kill_galera.inc +--sleep 5 + +--connection node_1 +--source include/wait_until_connected_again.inc +INSERT INTO t1 VALUES (21); + +--connection node_3 +INSERT INTO t1 VALUES (23); + +--connection node_4 +INSERT INTO t1 VALUES (24); + +--connection node_2 +--source include/start_mysqld.inc +--sleep 5 +--source include/wait_until_connected_again.inc + +INSERT INTO t1 VALUES (221); + +# +# Restart node #4 +# + +--connection node_4 +INSERT INTO t1 VALUES (34); + +--source include/kill_galera.inc +--sleep 5 + +--connection node_1 +--source include/wait_until_connected_again.inc +INSERT INTO t1 VALUES (31); + +--connection node_2 +INSERT INTO t1 VALUES (32); + +--connection node_3 +INSERT INTO t1 VALUES (33); + +--connection node_4 +--source include/start_mysqld.inc +--sleep 5 +--source include/wait_until_connected_again.inc + +INSERT INTO t1 VALUES (341); + + +# +# Check all nodes +# + +--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 + +SELECT COUNT(*) = 19 FROM t1; + +--connection node_2 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT COUNT(*) = 19 FROM t1; + +--connection node_3 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT COUNT(*) = 19 FROM t1; + +--connection node_4 +SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT COUNT(*) = 19 FROM t1; + +--connection node_1 +DROP TABLE t1; +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("WSREP: gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)"); + +--connection node_2 +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); + +--connection node_3 +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); + +--connection node_4 +CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); diff --git a/mysql-test/suite/galera/t/lp1438990.test b/mysql-test/suite/galera/t/lp1438990.test new file mode 100644 index 00000000000..5d54c3338e5 --- /dev/null +++ b/mysql-test/suite/galera/t/lp1438990.test @@ -0,0 +1,38 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t3 (f1 INTEGER PRIMARY KEY); + +CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CALL p1(NEW.f1); + + +DELIMITER |; + +CREATE PROCEDURE p1 (IN x INT) +BEGIN + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK TO event_logging; + INSERT t3 VALUES (x); + END; + SAVEPOINT event_logging; + + INSERT INTO t2 VALUES (x); + + RELEASE SAVEPOINT event_logging; +END| +DELIMITER ;| + + +INSERT INTO t2 VALUES (1); +INSERT INTO t1 VALUES (1); + +DROP PROCEDURE p1; + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; diff --git a/mysql-test/suite/galera/t/mysql-wsrep#110.test b/mysql-test/suite/galera/t/mysql-wsrep#110.test new file mode 100644 index 00000000000..43520f257a1 --- /dev/null +++ b/mysql-test/suite/galera/t/mysql-wsrep#110.test @@ -0,0 +1,51 @@ +# +# codership/mysql-wsrep/110 - Assertion `table_found' failed in unpack_row() with SAVEPOINT, trigger, error handler +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t3 (f1 INTEGER PRIMARY KEY); + +CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CALL p1(NEW.f1); + + +DELIMITER |; + +CREATE PROCEDURE p1 (IN x INT) +BEGIN + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK TO event_logging; + INSERT t3 VALUES (x); + END; + SAVEPOINT event_logging; + + INSERT INTO t2 VALUES (x); +END| +DELIMITER ;| + + +INSERT INTO t2 VALUES (1); +INSERT INTO t1 VALUES (1); + +SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) = 1 FROM t2; +SELECT COUNT(*) = 1 FROM t3; + +--connection node_2 + +SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) = 1 FROM t2; +SELECT COUNT(*) = 1 FROM t3; + +--connection node_1 + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP PROCEDURE p1; diff --git a/mysql-test/suite/galera/t/mysql-wsrep#90.test b/mysql-test/suite/galera/t/mysql-wsrep#90.test new file mode 100644 index 00000000000..5af86fb2872 --- /dev/null +++ b/mysql-test/suite/galera/t/mysql-wsrep#90.test @@ -0,0 +1,65 @@ +# Crash in galera_to_execute_end when wsrep_OSU_method is changed from RSU to TOI during a DDL + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; + +--connection node_1 +SET GLOBAL wsrep_OSU_method = "RSU"; +SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; +--send ALTER TABLE t1 ADD COLUMN f2 INTEGER; + + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_before_open_tables' +--source include/wait_condition.inc + +SET GLOBAL wsrep_OSU_method = "TOI"; +SET DEBUG_SYNC= 'now SIGNAL continue'; + +--connection node_1 +--reap + +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; + +--connection node_2 +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; + +--connection node_1 +DROP TABLE t1; + + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; + +--connection node_1 +SET GLOBAL wsrep_OSU_method = "TOI"; +SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; +--send ALTER TABLE t1 ADD COLUMN f2 INTEGER; + +--connection node_1a +SET SESSION wsrep_sync_wait = 0; + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_before_open_tables' +--source include/wait_condition.inc + +SET GLOBAL wsrep_OSU_method = "RSU"; +SET DEBUG_SYNC= 'now SIGNAL continue'; + +--connection node_1 +--reap + +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +INSERT INTO t1 VALUES (1,2); + +--connection node_2 +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +INSERT INTO t1 VALUES (3,4); + +--connection node_1 +DROP TABLE t1; + +SET GLOBAL WSREP_OSU_METHOD = TOI; |