diff options
Diffstat (limited to 'mysql-test/suite/galera/t')
14 files changed, 517 insertions, 116 deletions
diff --git a/mysql-test/suite/galera/t/binlog_checksum.test b/mysql-test/suite/galera/t/binlog_checksum.test index 5aab68a7746..8f6091235a1 100644 --- a/mysql-test/suite/galera/t/binlog_checksum.test +++ b/mysql-test/suite/galera/t/binlog_checksum.test @@ -1,5 +1,4 @@ --source include/galera_cluster.inc ---source include/have_innodb.inc --echo # On node_1 --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_admin.test b/mysql-test/suite/galera/t/galera_admin.test index e3c43256ad5..d630af0025b 100644 --- a/mysql-test/suite/galera/t/galera_admin.test +++ b/mysql-test/suite/galera/t/galera_admin.test @@ -5,7 +5,7 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_aria.inc --disable_warnings DROP TABLE IF EXISTS t1, t2; @@ -15,7 +15,7 @@ DROP TABLE IF EXISTS x1, x2; --connection node_1 CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER); -SET GLOBAL wsrep_replicate_myisam = TRUE; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM; CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=MyISAM; INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); @@ -34,7 +34,6 @@ INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); --let $wait_condition = SELECT COUNT(*) = 10000 FROM t2; --source include/wait_condition.inc - --echo # ANALYZE test --connection node_2 --let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` @@ -46,8 +45,6 @@ ANALYZE TABLE t1, t2; --let $wait_condition = SELECT VARIABLE_VALUE = $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc - - --echo # OPTIMIZE test --connection node_2 --let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` @@ -59,8 +56,6 @@ OPTIMIZE TABLE t1, t2; --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc - - --echo # REPAIR test --connection node_2 --let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` @@ -72,7 +67,73 @@ REPAIR TABLE x1, x2; --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc +--connection node_2 +SELECT COUNT(*) = 10 FROM t1; +SELECT COUNT(*) = 10 FROM x1; +SELECT COUNT(*) = 10000 FROM t2; +SELECT COUNT(*) = 10 FROM x2; + +--connection node_1 +DROP TABLE t1, t2; +DROP TABLE x1, x2; + +--echo # +--echo # ARIA +--echo # +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER); +SET GLOBAL wsrep_mode = REPLICATE_ARIA; +CREATE TABLE x1 (f1 INTEGER) ENGINE=ARIA; +CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=ARIA; +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4; +INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +# Wait until all the data from t2 has been replicated +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 10 FROM x1; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 10 FROM x2; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 10 FROM t1; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 10000 FROM t2; +--source include/wait_condition.inc + +--echo # ANALYZE test +--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 +ANALYZE TABLE t1, t2; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +--echo # OPTIMIZE test +--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 +OPTIMIZE TABLE t1, t2; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +--echo # REPAIR test +--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 +REPAIR TABLE x1, x2; +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc --connection node_2 SELECT COUNT(*) = 10 FROM t1; @@ -83,4 +144,7 @@ SELECT COUNT(*) = 10 FROM x2; --connection node_1 DROP TABLE t1, t2; DROP TABLE x1, x2; -SET GLOBAL wsrep_replicate_myisam = FALSE; + +--disable_query_log +SET GLOBAL wsrep_mode = DEFAULT; +--enable_query_log diff --git a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test index 6d41d276a17..57c057f9869 100644 --- a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test +++ b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test @@ -1,12 +1,11 @@ --source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_aria.inc # -# Test ALTER ENGINE from MyISAM to InnoDB under wsrep_replicate_myisam +# Test ALTER ENGINE from MyISAM to InnoDB under REPLICATE_MYISAM # ---let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` -SET GLOBAL wsrep_replicate_myisam = TRUE; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; INSERT INTO t1 VALUES (1); @@ -16,10 +15,27 @@ ALTER TABLE t1 ENGINE=InnoDB; --connection node_2 SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; SELECT COUNT(*) = 1 FROM t1; +DROP TABLE t1; + +# +# Test ALTER ENGINE from Aria to InnoDB under REPLICATE_ARIA +# + +--connection node_1 +SET GLOBAL wsrep_mode = REPLICATE_ARIA; + +CREATE TABLE t1 (f1 INTEGER) ENGINE=ARIA; +INSERT INTO t1 VALUES (1); + +ALTER TABLE t1 ENGINE=InnoDB; + +--connection node_2 +SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +SELECT COUNT(*) = 1 FROM t1; +DROP TABLE t1; --connection node_1 --disable_query_log ---eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig +SET GLOBAL wsrep_mode = DEFAULT; --enable_query_log -DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.test b/mysql-test/suite/galera/t/galera_binlog_checksum.test index 09d7a02f312..12fb87a618c 100644 --- a/mysql-test/suite/galera/t/galera_binlog_checksum.test +++ b/mysql-test/suite/galera/t/galera_binlog_checksum.test @@ -27,10 +27,9 @@ DROP TABLE t1; --echo # --connection node_1 -let $wsrep_replicate_myisam_saved= `SELECT @@wsrep_replicate_myisam`; -SET @@global.wsrep_replicate_myisam=1; +SET @@global.wsrep_mode = REPLICATE_MYISAM; -CREATE TABLE t1 (i INT) ENGINE=MYISAM; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=MYISAM; INSERT INTO t1 VALUES(1); --connection node_2 @@ -38,6 +37,9 @@ SELECT * FROM t1; --connection node_1 DROP TABLE t1; -eval SET @@global.wsrep_replicate_myisam=$wsrep_replicate_myisam_saved; + +--disable_query_log +SET @@global.wsrep_mode=DEFAULT; +--enable_query_log --echo # End of tests. diff --git a/mysql-test/suite/galera/t/galera_can_run_toi.test b/mysql-test/suite/galera/t/galera_can_run_toi.test index 060ea887692..e73eb46c0d7 100644 --- a/mysql-test/suite/galera/t/galera_can_run_toi.test +++ b/mysql-test/suite/galera/t/galera_can_run_toi.test @@ -18,7 +18,6 @@ DROP TABLE t3; SET sql_mode=''; SET SESSION default_storage_engine=MyISAM; SELECT @@default_storage_engine; -SET GLOBAL wsrep_replicate_myisam=OFF; SET GLOBAL wsrep_mode=STRICT_REPLICATION; CREATE TABLE t3 (c1 VARCHAR(10)) ENGINE=InnoDB; --error ER_GALERA_REPLICATION_NOT_SUPPORTED @@ -29,6 +28,5 @@ DROP TABLE t3; --disable_query_log SET GLOBAL sql_mode=default; SET GLOBAL default_storage_engine=default; -SET GLOBAL wsrep_replicate_myisam=default; SET GLOBAL wsrep_mode=default; --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test index 28e6f0cce38..96389e44d3f 100644 --- a/mysql-test/suite/galera/t/galera_defaults.test +++ b/mysql-test/suite/galera/t/galera_defaults.test @@ -13,12 +13,12 @@ --source include/force_restart.inc # Make sure that the test is operating on the right version of galera library. ---let $galera_version=26.4.6 +--let $galera_version=26.4.7 source ../wsrep/include/check_galera_version.inc; # Global Variables -SELECT COUNT(*) `expect 49` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; +SELECT COUNT(*) `expect 51` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; SELECT VARIABLE_NAME, VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES diff --git a/mysql-test/suite/galera/t/galera_flush_local.test b/mysql-test/suite/galera/t/galera_flush_local.test index 24acd9ec4ff..207ce0ceae0 100644 --- a/mysql-test/suite/galera/t/galera_flush_local.test +++ b/mysql-test/suite/galera/t/galera_flush_local.test @@ -3,9 +3,7 @@ # PXC-391 --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_query_cache.inc ---source include/have_wsrep_replicate_myisam.inc --disable_warnings DROP TABLE IF EXISTS t1, t2, x1, x2; @@ -14,6 +12,7 @@ DROP TABLE IF EXISTS t1, t2, x1, x2; # The following FLUSH LOCAL statements should *not* be replicated # --connection node_1 +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER); CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM; @@ -68,10 +67,10 @@ REPAIR LOCAL TABLE x1, x2; --eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff; --enable_query_log -SELECT COUNT(*) = 10 FROM t1; -SELECT COUNT(*) = 10 FROM x1; -SELECT COUNT(*) = 10000 FROM t2; -SELECT COUNT(*) = 10 FROM x2; +SELECT COUNT(*) AS EXPECT_10 FROM t1; +SELECT COUNT(*) AS EXPECT_10 FROM x1; +SELECT COUNT(*) AS EXPECT_10000 FROM t2; +SELECT COUNT(*) AS EXPECT_10 FROM x2; --connection node_1 @@ -133,11 +132,16 @@ REPAIR TABLE x1, x2; --eval SELECT $wsrep_last_committed_after2 = $wsrep_last_committed_before + 9 AS wsrep_last_committed_diff2; --enable_query_log -SELECT COUNT(*) = 10 FROM t1; -SELECT COUNT(*) = 10 FROM x1; -SELECT COUNT(*) = 10000 FROM t2; -SELECT COUNT(*) = 10 FROM x2; +SELECT COUNT(*) AS EXPECT_10 FROM t1; +SELECT COUNT(*) AS EXPECT_10 FROM x1; +SELECT COUNT(*) AS EXPECT_10000 FROM t2; +SELECT COUNT(*) AS EXPECT_10 FROM x2; --connection node_1 set wsrep_on=1; DROP TABLE t1, t2, x1, x2; + +--disable_query_log +SET GLOBAL wsrep_mode = DEFAULT; +--enable_query_log + diff --git a/mysql-test/suite/galera/t/galera_strict_require_innodb.test b/mysql-test/suite/galera/t/galera_strict_require_innodb.test index b4fe74d3406..b627fffe70c 100644 --- a/mysql-test/suite/galera/t/galera_strict_require_innodb.test +++ b/mysql-test/suite/galera/t/galera_strict_require_innodb.test @@ -3,14 +3,16 @@ # not supported by Galera # # For MyISAM -# * push warning to client if wsrep_mode == STRICT_REPLICATION and wsrep_replicate_myisam=off +# * push warning to client if wsrep_mode == STRICT_REPLICATION,REPLICATE_MYISAM +# * push warning to error log if log_warnings > 1 +# For Aria +# * push warning to client if wsrep_mode == STRICT_REPLICATION,REPLICATE_ARIA # * push warning to error log if log_warnings > 1 # For Memory # * push warning to client if wsrep_mode == STRICT_REPLICATION # * push warning to error log if log_warnings > 1 -# ( Note here Aria and case wsrep_replicate_aria=ON) # -# In both cases apply flood control if > 10 same warning +# In both cases apply flood control if >= 10 same warning # --source include/galera_cluster.inc --source include/have_aria.inc @@ -22,31 +24,35 @@ CREATE TABLE t2(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=MYISAM; CREATE TABLE t3(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=ARIA; CREATE TABLE t4(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=MEMORY; -SET GLOBAL wsrep_replicate_myisam=ON; SET GLOBAL log_warnings=2; -SET GLOBAL wsrep_mode= STRICT_REPLICATION; +SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_MYISAM,REPLICATE_ARIA"; INSERT INTO t1 values (1,'innodb1'); INSERT INTO t2 values (1,'myisam1'); INSERT INTO t3 values (1,'aria1'); INSERT INTO t4 values (1,'memory1'); -SET GLOBAL wsrep_replicate_myisam=OFF; +# these should not replicate +SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_ARIA"; INSERT INTO t2 values (2,'myisam2'); +SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_MYISAM"; +INSERT INTO t3 values (2,'aria2'); +# no warning to error log SET GLOBAL log_warnings=1; -INSERT INTO t1 values (2,'innodb2'); +INSERT INTO t1 values (3,'innodb3'); INSERT INTO t2 values (3,'myisam3'); -INSERT INTO t3 values (2,'aria2'); -INSERT INTO t4 values (2,'memory2'); +INSERT INTO t3 values (3,'aria3'); +INSERT INTO t4 values (3,'memory3'); -# test flood control +# test warnings --let $assert_count = 3 --let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err --let $assert_text = WSREP: wsrep_mode = STRICT_REPLICATION enabled. --let $assert_select = WSREP: wsrep_mode = STRICT_REPLICATION enabled. --source include/assert_grep.inc +# force flood SET GLOBAL log_warnings=2; INSERT INTO t2 values (4,'myisam3'); INSERT INTO t3 values (4,'aria2'); @@ -57,16 +63,31 @@ INSERT INTO t4 values (5,'memory2'); INSERT INTO t2 values (6,'myisam3'); INSERT INTO t3 values (6,'aria2'); INSERT INTO t4 values (6,'memory2'); +INSERT INTO t2 values (7,'myisam3'); +INSERT INTO t3 values (7,'aria2'); +INSERT INTO t4 values (7,'memory2'); +INSERT INTO t2 values (8,'myisam3'); +INSERT INTO t3 values (8,'aria2'); +INSERT INTO t4 values (8,'memory2'); +INSERT INTO t2 values (9,'myisam3'); +INSERT INTO t3 values (9,'aria2'); +INSERT INTO t4 values (9,'memory2'); +INSERT INTO t2 values (10,'myisam3'); +INSERT INTO t3 values (10,'aria2'); +INSERT INTO t4 values (10,'memory2'); +INSERT INTO t2 values (11,'myisam3'); +INSERT INTO t3 values (11,'aria2'); +INSERT INTO t4 values (11,'memory2'); SELECT COUNT(*) AS EXPECT_2 FROM t1; -SELECT COUNT(*) AS EXPECT_6 FROM t2; -SELECT COUNT(*) AS EXPECT_5 FROM t3; -SELECT COUNT(*) AS EXPECT_5 FROM t4; +SELECT COUNT(*) AS EXPECT_10 FROM t2; +SELECT COUNT(*) AS EXPECT_10 FROM t3; +SELECT COUNT(*) AS EXPECT_10 FROM t4; --connection node_2 SELECT COUNT(*) AS EXPECT_2 FROM t1; -SELECT COUNT(*) AS EXPECT_1 FROM t2; -SELECT COUNT(*) AS EXPECT_0 FROM t3; +SELECT COUNT(*) AS EXPECT_10 FROM t2; +SELECT COUNT(*) AS EXPECT_1 FROM t3; SELECT COUNT(*) AS EXPECT_0 FROM t4; --connection node_1 @@ -76,19 +97,20 @@ DROP TABLE t1,t2,t3,t4; # # Verify no flood # ---let $assert_count = 10 +--let $assert_count = --let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err --let $assert_text = WSREP: wsrep_mode = STRICT_REPLICATION enabled. --let $assert_select = WSREP: wsrep_mode = STRICT_REPLICATION enabled. +--let $assert_match = WSREP: wsrep_mode = STRICT_REPLICATION enabled. --source include/assert_grep.inc --let $assert_count = 1 --let $assert_text = WSREP: Suppressing warnings of type 'WSREP_REQUIRE_INNODB' for up to 300 seconds because of flooding --let $assert_select = WSREP: Suppressing warnings of type 'WSREP_REQUIRE_INNODB' for up to 300 seconds because of flooding +--let $assert_match = --source include/assert_grep.inc # reset env --disable_query_log -SET GLOBAL wsrep_replicate_myisam=DEFAULT; SET GLOBAL log_warnings=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; --disable_query_log diff --git a/mysql-test/suite/galera/t/galera_strict_require_primary_key.test b/mysql-test/suite/galera/t/galera_strict_require_primary_key.test index 3a94c408fb6..dc5f9910396 100644 --- a/mysql-test/suite/galera/t/galera_strict_require_primary_key.test +++ b/mysql-test/suite/galera/t/galera_strict_require_primary_key.test @@ -5,41 +5,49 @@ # * push warning to client if wsrep_mode == REQUIRED_PRIMARY_KEY # * push warning to error log if log_warnings > 1 # For MyIsam -# * push warning if wsrep_replicate_myisam=ON +# * push warning to client if wsrep_mode == REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM +# * push warning to error log if log_warnings > 1 +# For Aria +# * push warning to client if wsrep_mode == REQUIRED_PRIMARY_KEY,REPLICATE_ARIA +# * push warning to error log if log_warnings > 1 # -# In both cases apply flood control if > 10 same warning +# In both cases apply flood control if >= 10 same warning # --source include/galera_cluster.inc +--source include/have_aria.inc call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table .*"); CREATE TABLE t1(a int, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int, b varchar(50)) ENGINE=MYISAM; CREATE TABLE t3(a int, b varchar(50)) ENGINE=MEMORY; +CREATE TABLE t4(a int, b varchar(50)) ENGINE=ARIA; -SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_mode = "REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA"; SET GLOBAL log_warnings=2; -SET GLOBAL wsrep_mode= REQUIRED_PRIMARY_KEY; INSERT INTO t1 values (1,'test1'); INSERT INTO t2 values (1,'myisam1'); -INSERT INTO t3 values (1,'memory'); +INSERT INTO t3 values (1,'memory1'); +INSERT INTO t4 values (1,'aria1'); -SET GLOBAL wsrep_replicate_myisam=OFF; -INSERT INTO t2 values (2,'mysam2'); - -# test flood control -INSERT INTO t1 values (2,'test2'); -INSERT INTO t1 values (3,'test3'); -INSERT INTO t1 values (4,'test4'); -INSERT INTO t1 values (5,'test5'); +# these will not replicate +SET GLOBAL wsrep_mode = "REQUIRED_PRIMARY_KEY,REPLICATE_ARIA"; +INSERT INTO t2 values (2,'myisam2'); +SET GLOBAL wsrep_mode = "REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM"; +INSERT INTO t4 values (2,'ARIA2'); # these should not write warning to error log +SET GLOBAL wsrep_mode = "REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA"; SET GLOBAL log_warnings=1; INSERT INTO t1 values (21,'not1'); INSERT INTO t1 values (22,'not2'); +INSERT INTO t2 values (21,'not1'); +INSERT INTO t2 values (22,'not2'); +INSERT INTO t4 values (21,'not1'); +INSERT INTO t4 values (22,'not2'); ---let $assert_count = 6 +--let $assert_count = 3 --let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err --let $assert_text = WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. --let $assert_select = WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. @@ -56,34 +64,79 @@ INSERT INTO t1 values (11,'test11'); INSERT INTO t1 values (12,'test12'); INSERT INTO t1 values (13,'test13'); -SELECT COUNT(*) AS EXPECT_15 FROM t1; -SELECT COUNT(*) AS EXPECT_2 FROM t2; +INSERT INTO t1 values (33,'test13'); +INSERT INTO t1 values (34,'test13'); +INSERT INTO t1 values (35,'test13'); +INSERT INTO t1 values (36,'test13'); +INSERT INTO t1 values (37,'test13'); +INSERT INTO t1 values (38,'test13'); +INSERT INTO t1 values (39,'test13'); + +INSERT INTO t2 values (6,'test6'); +INSERT INTO t2 values (7,'test7'); +INSERT INTO t2 values (8,'test8'); +INSERT INTO t2 values (9,'test9'); +INSERT INTO t2 values (10,'test10'); +INSERT INTO t2 values (11,'test11'); +INSERT INTO t2 values (12,'test12'); +INSERT INTO t2 values (13,'test13'); + +INSERT INTO t2 values (33,'test13'); +INSERT INTO t2 values (34,'test13'); +INSERT INTO t2 values (35,'test13'); +INSERT INTO t2 values (36,'test13'); +INSERT INTO t2 values (37,'test13'); +INSERT INTO t2 values (38,'test13'); +INSERT INTO t2 values (39,'test13'); + +INSERT INTO t4 values (6,'test6'); +INSERT INTO t4 values (7,'test7'); +INSERT INTO t4 values (8,'test8'); +INSERT INTO t4 values (9,'test9'); +INSERT INTO t4 values (10,'test10'); +INSERT INTO t4 values (11,'test11'); +INSERT INTO t4 values (12,'test12'); +INSERT INTO t4 values (13,'test13'); + +INSERT INTO t4 values (33,'test13'); +INSERT INTO t4 values (34,'test13'); +INSERT INTO t4 values (35,'test13'); +INSERT INTO t4 values (36,'test13'); +INSERT INTO t4 values (37,'test13'); +INSERT INTO t4 values (38,'test13'); +INSERT INTO t4 values (39,'test13'); + +SELECT COUNT(*) AS EXPECT_18 FROM t1; +SELECT COUNT(*) AS EXPECT_19 FROM t2; SELECT COUNT(*) AS EXPECT_1 FROM t3; +SELECT COUNT(*) AS EXPECT_19 FROM t4; --connection node_2 -SELECT COUNT(*) AS EXPECT_15 FROM t1; -SELECT COUNT(*) AS EXPECT_1 FROM t2; +SELECT COUNT(*) AS EXPECT_18 FROM t1; +SELECT COUNT(*) AS EXPECT_18 FROM t2; SELECT COUNT(*) AS EXPECT_0 FROM t3; +SELECT COUNT(*) AS EXPECT_18 FROM t4; --connection node_1 -DROP TABLE t1,t2,t3; +DROP TABLE t1,t2,t3,t4; # # Verify warning is on error log and check that no flood # ---let $assert_count = 9 +--let $assert_count = --let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err --let $assert_text = WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. --let $assert_select = WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. +--let $assert_match = WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. --source include/assert_grep.inc --let $assert_count = 1 --let $assert_text = WSREP: Suppressing warnings of type 'WSREP_REQUIRE_PRIMARY_KEY' for up to 300 seconds because of flooding --let $assert_select = WSREP: Suppressing warnings of type 'WSREP_REQUIRE_PRIMARY_KEY' for up to 300 seconds because of flooding +--let $assert_match = --source include/assert_grep.inc # reset env --disable_query_log -SET GLOBAL wsrep_replicate_myisam=DEFAULT; SET GLOBAL log_warnings=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; --disable_query_log diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test new file mode 100644 index 00000000000..c0d8c5d6b3b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test @@ -0,0 +1,17 @@ +# +# Simple test for wsrep-mode != REPLICATE_ARIA +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_aria.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=Aria; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; + +--connection node_2 +--echo # Only DDL is replicated +SELECT COUNT(*) AS EXPECT_0 FROM t1; +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test new file mode 100644 index 00000000000..c3bc53ee17f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test @@ -0,0 +1,237 @@ +# +# Simple test for wsrep-mode = REPLICATE_ARIA +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_aria.inc + +--connection node_1 +SET GLOBAL wsrep_mode = REPLICATE_ARIA; +--connection node_2 +SET GLOBAL wsrep_mode = REPLICATE_ARIA; + +# +# Simple INSERT +# + +--connection node_1 +CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=Aria; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2), (3); +INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; + +--connection node_2 +SELECT COUNT(*) AS EXPECT_5 FROM t1; + +--connection node_1 +DROP TABLE t1; + +# +# REPLACE +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=Aria; +INSERT INTO t1 VALUES (1, 'abc'),(2,'abc'), (3, 'xxx'); +REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz'); +REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL; +SELECT * FROM t1; + +--connection node_2 +SELECT COUNT(*) AS EXPECT_3 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; +SELECT * FROM t1; + +# +# UPDATE +# + +--connection node_1 +UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy'; +SELECT * FROM t1; + +--connection node_2 +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz'; +SELECT * FROM t1; + +# +# DELETE +# + +--connection node_1 +DELETE FROM t1 WHERE f2 = 'zzz'; +SELECT * FROM t1; + +--connection node_2 +SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz'; +SELECT * FROM t1; + +# +# TRUNCATE +# + +--connection node_1 +TRUNCATE TABLE t1; +SELECT * FROM t1; + +--connection node_2 +SELECT COUNT(*) AS EXPECT_0 FROM t1; +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; + +# +# Transaction +# + +--connection node_1 +SET GLOBAL wsrep_sync_wait=15; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=Aria; +CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +COMMIT; + +--connection node_2 +SET GLOBAL wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t2; + +# +# Transaction rollback +# + +--connection node_1 +START TRANSACTION; +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (2); +ROLLBACK; + +--connection node_2 +SELECT COUNT(*) AS EXPECT_2 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t2; + +--connection node_1 +DROP TABLE t1,t2; + +# +# Transaction conflict +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=Aria; +CREATE TABLE t2 (f2 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); + +--connection node_2 +# The Aria update is replicated immediately, so a duplicate key error happens even before the COMMIT +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (1); + +--connection node_1 +COMMIT; + +DROP TABLE t1,t2; + +--connection node_1 +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +# This command should not get replicated. +SELECT * FROM t1; +DROP TABLE t1; + +# +# Test prepared staments +# +--connection node_1 +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=Aria; +INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10); + +PREPARE upd from 'update t1 set b = 100 where id = 5'; +PREPARE ins from 'insert into t1 values (11,11)'; +PREPARE del from 'delete from t1 where id = 4'; +PREPARE rep from 'replace into t1 values (12,12),(6,600)'; + +EXECUTE upd; +EXECUTE ins; +EXECUTE del; +EXECUTE rep; + +SELECT * FROM t1 ORDER BY id; + +--connection node_2 +SELECT * FROM t1 ORDER BY id; + +--connection node_1 +DROP TABLE t1; + +# +# Test procedure +# +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=Aria; +INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10); + +DELIMITER |; +CREATE PROCEDURE proc() +BEGIN + UPDATE t1 set b = 100 WHERE id = 5; + INSERT INTO t1 VALUES (11,11); + DELETE FROM t1 WHERE id = 4; + REPLACE INTO t1 VALUES (12,12),(6,600); + COMMIT; +END| +DELIMITER ;| + +CALL proc(); +SELECT * FROM t1 ORDER BY id; + +--connection node_2 +SELECT * FROM t1 ORDER BY id; + +--connection node_1 +DROP PROCEDURE proc; +DROP TABLE t1; + +# +# Test trigger +# +--connection node_1 +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=Aria; +CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT) ENGINE=Aria; +INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10); +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.b); +CREATE TRIGGER tr2 BEFORE UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b),(NULL, NEW.b); +CREATE TRIGGER tr3 BEFORE DELETE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b); + +INSERT INTO t1 VALUES (11,11); +UPDATE t1 SET b = 200 WHERE id = 2; +DELETE FROM t1 where id = 5; +SELECT * FROM t1 ORDER BY id; +SELECT * FROM t2 ORDER BY id; + +--connection node_2 +SELECT * FROM t1 ORDER BY id; +SELECT * FROM t2 ORDER BY id; + +--connection node_1 +DROP TRIGGER tr1; +DROP TRIGGER tr2; +DROP TRIGGER tr3; +DROP TABLE t1,t2; + +--disable_query_log +--connection node_1 +SET GLOBAL wsrep_mode = DEFAULT; +--connection node_2 +SET GLOBAL wsrep_mode = DEFAULT; +--enable_query_log + diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test index a9811283918..a556547d990 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test @@ -1,21 +1,15 @@ # -# Simple test for wsrep-replicate-myisam = FALSE +# Simple test for wsrep_mode != REPLICATE_MYISAM # --source include/galera_cluster.inc --source include/have_innodb.inc ---let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` - -SET GLOBAL wsrep_replicate_myisam = FALSE; - CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM; INSERT INTO t1 VALUES (1); --connection node_2 -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) AS EXPECT_0 FROM t1; --connection node_1 ---eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig - DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test index adb5cb04273..f405ebfdc46 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test @@ -1,17 +1,14 @@ # -# Simple test for wsrep-replicate-myisam = ON +# Simple test for wsrep-mode = REPLICATE_MYISAM # --source include/galera_cluster.inc --source include/have_innodb.inc --connection node_1 ---let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` - ---connection node_1 -SET GLOBAL wsrep_replicate_myisam = TRUE; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; --connection node_2 -SET GLOBAL wsrep_replicate_myisam = TRUE; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; # # Simple INSERT @@ -24,7 +21,7 @@ INSERT INTO t1 VALUES (2), (3); INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; --connection node_2 -SELECT COUNT(*) = 5 FROM t1; +SELECT COUNT(*) AS EXPECT_5 FROM t1; DROP TABLE t1; @@ -39,10 +36,10 @@ REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz'); REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL; --connection node_2 -SELECT COUNT(*) = 3 FROM t1; -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; +SELECT COUNT(*) AS EXPECT_3 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; # # UPDATE @@ -52,7 +49,7 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy'; --connection node_2 -SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz'; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz'; # # DELETE @@ -62,7 +59,7 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz'; DELETE FROM t1 WHERE f2 = 'zzz'; --connection node_2 -SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz'; +SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz'; # # TRUNCATE @@ -72,7 +69,7 @@ SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz'; TRUNCATE TABLE t1; --connection node_2 -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) AS EXPECT_0 FROM t1; DROP TABLE t1; # @@ -89,8 +86,8 @@ INSERT INTO t2 VALUES (1); COMMIT; --connection node_2 -SELECT COUNT(*) = 1 FROM t1; -SELECT COUNT(*) = 1 FROM t2; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t2; # # Transaction rollback @@ -103,8 +100,8 @@ INSERT INTO t2 VALUES (2); ROLLBACK; --connection node_2 -SELECT COUNT(*) = 2 FROM t1; -SELECT COUNT(*) = 1 FROM t2; +SELECT COUNT(*) AS EXPECT_2 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t2; DROP TABLE t1; DROP TABLE t2; @@ -128,20 +125,7 @@ INSERT INTO t1 VALUES (1); --connection node_1 COMMIT; - -DROP TABLE t1; -DROP TABLE t2; - ---echo # ---echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO ---echo # ---connection node_1 -CREATE TABLE t1 (i INT) ENGINE=INNODB; -INSERT INTO t1 VALUES(1); -# This command should not get replicated. -SELECT * FROM t1; -DROP TABLE t1; - +DROP TABLE t1, t2; # # Test prepared staments # @@ -218,12 +202,19 @@ DROP TRIGGER tr2; DROP TRIGGER tr3; DROP TABLE t1,t2; +--echo # +--echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO +--echo # --connection node_1 ---disable_query_log ---eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig ---enable_query_log +CREATE TABLE t1 (i INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +# This command should not get replicated. +SELECT * FROM t1; +DROP TABLE t1; ---connection node_2 +--connection node_1 --disable_query_log ---eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig +SET GLOBAL wsrep_mode = DEFAULT; +--connection node_2 +SET GLOBAL wsrep_mode = DEFAULT; --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test index ca75d33b7d7..0a32a06580b 100644 --- a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test @@ -93,4 +93,8 @@ CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with DROP TABLE t2; +--let $node_3=node_3 +--let $auto_increment_offset_node_3 = 3; +--let $node_4=node_4 +--let $auto_increment_offset_node_4 = 4; --source include/auto_increment_offset_restore.inc |