Commit 27d66d64 authored by Jan Lindström's avatar Jan Lindström

MENT-411 : Implement wsrep_replicate_aria

Introduced two new wsrep_mode options
* REPLICATE_MYISAM
* REPLICATE_ARIA

Depracated wsrep_replicate_myisam parameter and we use
wsrep_mode = REPLICATE_MYISAM instead.

This required small refactoring of wsrep_check_mode_after_open_table
so that both MyISAM and Aria are handled on required DML cases.
Similarly, added Aria to wsrep_should_replicate_ddl to handle DDL
for Aria tables using TOI. Added test cases and improved MyISAM testing.
Changed use of wsrep_replicate_myisam to wsrep_mode = REPLICATE_MYISAM
parent 74281fe1
......@@ -5,7 +5,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);
......@@ -57,4 +57,61 @@ COUNT(*) = 10
connection node_1;
DROP TABLE t1, t2;
DROP TABLE x1, x2;
SET GLOBAL wsrep_replicate_myisam = FALSE;
#
# ARIA
#
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);
connection node_2;
# ANALYZE test
connection node_2;
connection node_1;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
connection node_2;
# OPTIMIZE test
connection node_2;
connection node_1;
OPTIMIZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
test.t2 optimize status OK
connection node_2;
# REPAIR test
connection node_2;
connection node_1;
REPAIR TABLE x1, x2;
Table Op Msg_type Msg_text
test.x1 repair status OK
test.x2 repair status OK
connection node_2;
connection node_2;
SELECT COUNT(*) = 10 FROM t1;
COUNT(*) = 10
1
SELECT COUNT(*) = 10 FROM x1;
COUNT(*) = 10
1
SELECT COUNT(*) = 10000 FROM t2;
COUNT(*) = 10000
1
SELECT COUNT(*) = 10 FROM x2;
COUNT(*) = 10
1
connection node_1;
DROP TABLE t1, t2;
DROP TABLE x1, x2;
connection node_2;
connection node_1;
SET GLOBAL wsrep_replicate_myisam = TRUE;
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
ALTER TABLE t1 ENGINE=InnoDB;
......@@ -11,5 +11,18 @@ ENGINE = 'InnoDB'
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
DROP TABLE t1;
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';
ENGINE = 'InnoDB'
1
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
DROP TABLE t1;
connection node_1;
......@@ -18,8 +18,8 @@ DROP TABLE t1;
# enabled
#
connection node_1;
SET @@global.wsrep_replicate_myisam=1;
CREATE TABLE t1 (i INT) ENGINE=MYISAM;
SET @@global.wsrep_mode = REPLICATE_MYISAM;
CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=MYISAM;
INSERT INTO t1 VALUES(1);
connection node_2;
SELECT * FROM t1;
......@@ -27,5 +27,4 @@ i
1
connection node_1;
DROP TABLE t1;
SET @@global.wsrep_replicate_myisam=0;
# End of tests.
......@@ -25,7 +25,6 @@ SET SESSION default_storage_engine=MyISAM;
SELECT @@default_storage_engine;
@@default_storage_engine
MyISAM
SET GLOBAL wsrep_replicate_myisam=OFF;
SET GLOBAL wsrep_mode=STRICT_REPLICATION;
CREATE TABLE t3 (c1 VARCHAR(10)) ENGINE=InnoDB;
ALTER TABLE t3 ENGINE=NonExistentEngine;
......
connection node_2;
connection node_1;
# Correct Galera library found
SELECT COUNT(*) `expect 49` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
expect 49
50
SELECT COUNT(*) `expect 51` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
expect 51
51
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_%'
......@@ -40,6 +40,7 @@ WSREP_LOAD_DATA_SPLITTING OFF
WSREP_LOG_CONFLICTS OFF
WSREP_MAX_WS_ROWS 0
WSREP_MAX_WS_SIZE 2147483647
WSREP_MODE
WSREP_MYSQL_REPLICATION_BUNDLE 0
WSREP_NOTIFY_CMD
WSREP_ON ON
......
......@@ -2,6 +2,7 @@ connection node_2;
connection node_1;
DROP TABLE IF EXISTS t1, t2, x1, x2;
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;
......@@ -64,18 +65,18 @@ test.x2 repair status OK
connection node_2;
wsrep_last_committed_diff
1
SELECT COUNT(*) = 10 FROM t1;
COUNT(*) = 10
1
SELECT COUNT(*) = 10 FROM x1;
COUNT(*) = 10
1
SELECT COUNT(*) = 10000 FROM t2;
COUNT(*) = 10000
1
SELECT COUNT(*) = 10 FROM x2;
COUNT(*) = 10
1
SELECT COUNT(*) AS EXPECT_10 FROM t1;
EXPECT_10
10
SELECT COUNT(*) AS EXPECT_10 FROM x1;
EXPECT_10
10
SELECT COUNT(*) AS EXPECT_10000 FROM t2;
EXPECT_10000
10000
SELECT COUNT(*) AS EXPECT_10 FROM x2;
EXPECT_10
10
connection node_1;
DROP TABLE t1, t2, x1, x2;
CREATE TABLE t1 (f1 INTEGER);
......@@ -143,18 +144,18 @@ wsrep_last_committed_diff
1
wsrep_last_committed_diff2
1
SELECT COUNT(*) = 10 FROM t1;
COUNT(*) = 10
1
SELECT COUNT(*) = 10 FROM x1;
COUNT(*) = 10
1
SELECT COUNT(*) = 10000 FROM t2;
COUNT(*) = 10000
1
SELECT COUNT(*) = 10 FROM x2;
COUNT(*) = 10
1
SELECT COUNT(*) AS EXPECT_10 FROM t1;
EXPECT_10
10
SELECT COUNT(*) AS EXPECT_10 FROM x1;
EXPECT_10
10
SELECT COUNT(*) AS EXPECT_10000 FROM t2;
EXPECT_10000
10000
SELECT COUNT(*) AS EXPECT_10 FROM x2;
EXPECT_10
10
connection node_1;
set wsrep_on=1;
DROP TABLE t1, t2, x1, x2;
......@@ -5,37 +5,34 @@ CREATE TABLE t1(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=INNODB;
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');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (1,'memory1');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
SET GLOBAL wsrep_replicate_myisam=OFF;
SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_ARIA";
INSERT INTO t2 values (2,'myisam2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_MYISAM";
INSERT INTO t3 values (2,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
SET GLOBAL log_warnings=1;
INSERT INTO t1 values (2,'innodb2');
INSERT INTO t1 values (3,'innodb3');
INSERT INTO t2 values (3,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (2,'aria2');
INSERT INTO t3 values (3,'aria3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (2,'memory2');
INSERT INTO t4 values (3,'memory3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
include/assert_grep.inc [WSREP: wsrep_mode = STRICT_REPLICATION enabled.]
SET GLOBAL log_warnings=2;
INSERT INTO t2 values (4,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (4,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
......@@ -43,8 +40,6 @@ INSERT INTO t4 values (4,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (5,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (5,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
......@@ -52,36 +47,69 @@ INSERT INTO t4 values (5,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (6,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (6,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (6,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (7,'myisam3');
INSERT INTO t3 values (7,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (7,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (8,'myisam3');
INSERT INTO t3 values (8,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (8,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (9,'myisam3');
INSERT INTO t3 values (9,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (9,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (10,'myisam3');
INSERT INTO t3 values (10,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (10,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (11,'myisam3');
INSERT INTO t3 values (11,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (11,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
SELECT COUNT(*) AS EXPECT_2 FROM t1;
EXPECT_2
2
SELECT COUNT(*) AS EXPECT_6 FROM t2;
EXPECT_6
6
SELECT COUNT(*) AS EXPECT_5 FROM t3;
EXPECT_5
5
SELECT COUNT(*) AS EXPECT_5 FROM t4;
EXPECT_5
5
SELECT COUNT(*) AS EXPECT_10 FROM t2;
EXPECT_10
11
SELECT COUNT(*) AS EXPECT_10 FROM t3;
EXPECT_10
11
SELECT COUNT(*) AS EXPECT_10 FROM t4;
EXPECT_10
10
connection node_2;
SELECT COUNT(*) AS EXPECT_2 FROM t1;
EXPECT_2
2
SELECT COUNT(*) AS EXPECT_1 FROM t2;
SELECT COUNT(*) AS EXPECT_10 FROM t2;
EXPECT_10
10
SELECT COUNT(*) AS EXPECT_1 FROM t3;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_0 FROM t3;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_0 FROM t4;
EXPECT_0
0
......
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=Aria;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
f1
1
connection node_2;
# Only DDL is replicated
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
SELECT * FROM t1;
f1
DROP TABLE t1;
connection node_2;
connection node_1;
connection node_1;
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
connection node_2;
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
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;
EXPECT_5
5
connection node_1;
DROP TABLE t1;
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;
f1 f2
1 klm
2 xyz
3 yyy
connection node_2;
SELECT COUNT(*) AS EXPECT_3 FROM t1;
EXPECT_3
3
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
EXPECT_1
1
SELECT * FROM t1;
f1 f2
1 klm
2 xyz
3 yyy
connection node_1;
UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy';
SELECT * FROM t1;
f1 f2
1 klm
2 xyz
3 zzz
connection node_2;
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz';
EXPECT_1
1
SELECT * FROM t1;
f1 f2
1 klm
2 xyz
3 zzz
connection node_1;
DELETE FROM t1 WHERE f2 = 'zzz';
SELECT * FROM t1;
f1 f2
1 klm
2 xyz
connection node_2;
SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz';
EXPECT_0
0
SELECT * FROM t1;
f1 f2
1 klm
2 xyz
connection node_1;
TRUNCATE TABLE t1;
SELECT * FROM t1;
f1 f2
connection node_2;
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
SELECT * FROM t1;
f1 f2
connection node_1;
DROP TABLE t1;
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;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_1 FROM t2;
EXPECT_1
1
connection node_1;
START TRANSACTION;
INSERT INTO t1 VALUES (2);
INSERT INTO t2 VALUES (2);
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
connection node_2;
SELECT COUNT(*) AS EXPECT_2 FROM t1;
EXPECT_2
2
SELECT COUNT(*) AS EXPECT_1 FROM t2;
EXPECT_1
1
connection node_1;
DROP TABLE t1,t2;
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;
INSERT INTO t1 VALUES (1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
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);
SELECT * FROM t1;
i
1
DROP TABLE t1;
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;
id b
1 1
2 2
3 3
5 100
6 600
7 7
8 8
9 9
10 10
11 11
12 12
connection node_2;
SELECT * FROM t1 ORDER BY id;
id b
1 1
2 2
3 3
5 100
6 600
7 7
8 8
9 9
10 10
11 11
12 12
connection node_1;
DROP TABLE t1;
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);
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|
CALL proc();
SELECT * FROM t1 ORDER BY id;
id b
1 1
2 2
3 3
5 100
6 600
7 7
8 8
9 9
10 10
11 11
12 12
connection node_2;
SELECT * FROM t1 ORDER BY id;
id b
1 1
2 2
3 3
5 100
6 600
7 7
8 8
9 9
10 10
11 11
12 12
connection node_1;
DROP PROCEDURE proc;
DROP TABLE t1;
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;
id b
1 1
2 200
3 3
4 4
6 6
7 7
8 8
9 9
10 10
11 11
SELECT * FROM t2 ORDER BY id;
id b
1 11
2 2
3 200
4 5
connection node_2;
SELECT * FROM t1 ORDER BY id;
id b
1 1
2 200
3 3
4 4
6 6
7 7
8 8
9 9
10 10
11 11
SELECT * FROM t2 ORDER BY id;
id b
1 11
2 2
3 200
4 5
connection node_1;
DROP TRIGGER tr1;
DROP TRIGGER tr2;
DROP TRIGGER tr3;
DROP TABLE t1,t2;
connection node_2;
connection node_1;
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;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
connection node_1;
SET GLOBAL wsrep_replicate_myisam = 0;
DROP TABLE t1;
connection node_2;
connection node_1;
connection node_1;
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;
connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
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(*) = 5 FROM t1;
COUNT(*) = 5
1
SELECT COUNT(*) AS EXPECT_5 FROM t1;
EXPECT_5
5
DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=MyISAM;
......@@ -21,36 +20,36 @@ 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;
connection node_2;
SELECT COUNT(*) = 3 FROM t1;
COUNT(*) = 3
SELECT COUNT(*) AS EXPECT_3 FROM t1;
EXPECT_3
3
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
EXPECT_1
1
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
EXPECT_1
1
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
COUNT(*) = 1
1
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
EXPECT_1
1
connection node_1;
UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy';
connection node_2;
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz';
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz';
EXPECT_1
1
connection node_1;
DELETE FROM t1 WHERE f2 = 'zzz';
connection node_2;
SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz';
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz';
EXPECT_0
0
connection node_1;
TRUNCATE TABLE t1;
connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
......@@ -61,11 +60,11 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
COMMIT;
connection node_2;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
SELECT COUNT(*) = 1 FROM t2;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t2;
EXPECT_1
1
connection node_1;
START TRANSACTION;
......@@ -75,11 +74,11 @@ ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
connection node_2;
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
SELECT COUNT(*) = 1 FROM t2;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_2 FROM t1;
EXPECT_2
2
SELECT COUNT(*) AS EXPECT_1 FROM t2;
EXPECT_1
1
DROP TABLE t1;
DROP TABLE t2;
......@@ -94,18 +93,7 @@ INSERT INTO t1 VALUES (1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
connection node_1;
COMMIT;
DROP TABLE t1;
DROP TABLE t2;
#
# MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO
#
connection node_1;
CREATE TABLE t1 (i INT) ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
SELECT * FROM t1;
i
1
DROP TABLE t1;
DROP TABLE t1, t2;
connection node_1;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
......@@ -237,5 +225,14 @@ DROP TRIGGER tr1;
DROP TRIGGER tr2;
DROP TRIGGER tr3;
DROP TABLE t1,t2;
#
# MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO
#
connection node_1;
CREATE TABLE t1 (i INT) ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
SELECT * FROM t1;
i
1
DROP TABLE t1;
connection node_1;
connection node_2;
--source include/galera_cluster.inc
--source include/have_innodb.inc
--echo # On node_1
--connection node_1
......
......@@ -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
--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;
......@@ -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.
......@@ -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
......@@ -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
......
......@@ -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
......@@ -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
......
......@@ -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
......
#
# 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;
#
# 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
#
# 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;
#
# 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
......@@ -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
......@@ -3,11 +3,11 @@ connection node_1;
connection node_1;
CREATE TABLE t1 (f1 TEXT) ENGINE=MyISAM;
SET SESSION wsrep_trx_fragment_size = 1;
SET GLOBAL wsrep_replicate_myisam = TRUE;
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
INSERT INTO t1 VALUES (REPEAT('x', 65535));
connection node_2;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
SELECT LENGTH(f1) = 65535 FROM t1;
LENGTH(f1) = 65535
......
......@@ -10,20 +10,18 @@
--connection node_1
CREATE TABLE t1 (f1 TEXT) ENGINE=MyISAM;
--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam`
SET SESSION wsrep_trx_fragment_size = 1;
SET GLOBAL wsrep_replicate_myisam = TRUE;
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
INSERT INTO t1 VALUES (REPEAT('x', 65535));
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
SELECT LENGTH(f1) = 65535 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
......@@ -342,7 +342,7 @@ VARIABLE_COMMENT Set of WSREP features that are enabled.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY,REQUIRED_PRIMARY_KEY
ENUM_VALUE_LIST STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY,REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
......
#
# wsrep_replicate_myisam
#
# save the initial value
SET @wsrep_replicate_myisam_global_saved = @@global.wsrep_replicate_myisam;
# default
SELECT @@global.wsrep_replicate_myisam;
@@global.wsrep_replicate_myisam
0
SELECT @@session.wsrep_replicate_myisam;
ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable
# scope and valid values
SET @@global.wsrep_replicate_myisam=OFF;
SELECT @@global.wsrep_replicate_myisam;
@@global.wsrep_replicate_myisam
0
SET @@global.wsrep_replicate_myisam=ON;
SELECT @@global.wsrep_replicate_myisam;
@@global.wsrep_replicate_myisam
1
# invalid values
SET @@global.wsrep_replicate_myisam=NULL;
ERROR 42000: Variable 'wsrep_replicate_myisam' can't be set to the value of 'NULL'
SET @@global.wsrep_replicate_myisam='junk';
ERROR 42000: Variable 'wsrep_replicate_myisam' can't be set to the value of 'junk'
# restore the initial value
SET @@global.wsrep_replicate_myisam = @wsrep_replicate_myisam_global_saved;
# End of test
--source include/have_wsrep.inc
--echo #
--echo # wsrep_replicate_myisam
--echo #
--echo # save the initial value
SET @wsrep_replicate_myisam_global_saved = @@global.wsrep_replicate_myisam;
--echo # default
SELECT @@global.wsrep_replicate_myisam;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_replicate_myisam;
--echo
--echo # scope and valid values
#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
#TODO: check if it is expected for variable to be dynamic?
SET @@global.wsrep_replicate_myisam=OFF;
SELECT @@global.wsrep_replicate_myisam;
#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.wsrep_replicate_myisam=ON;
SELECT @@global.wsrep_replicate_myisam;
--echo
--echo # invalid values
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_replicate_myisam=NULL;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_replicate_myisam='junk';
--echo
--echo # restore the initial value
SET @@global.wsrep_replicate_myisam = @wsrep_replicate_myisam_global_saved;
--echo # End of test
call mtr.add_suppression("WSREP: Initial position was provided by configuration or SST, avoiding override");
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
# MDEV#5534: mysql_tzinfo_to_sql generates wrong query
#
# Testing wsrep_replicate_myisam variable.
SELECT @@session.wsrep_replicate_myisam;
ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable
SELECT @@global.wsrep_replicate_myisam;
@@global.wsrep_replicate_myisam
0
SET SESSION wsrep_replicate_myisam= ON;
ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL wsrep_replicate_myisam= ON;
SET GLOBAL wsrep_replicate_myisam= OFF;
#
# MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
# variables when using "_"
......
......@@ -7,23 +7,6 @@ call mtr.add_suppression("WSREP: Initial position was provided by configuration
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
--echo
--echo # MDEV#5534: mysql_tzinfo_to_sql generates wrong query
--echo #
--echo # Testing wsrep_replicate_myisam variable.
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_replicate_myisam;
SELECT @@global.wsrep_replicate_myisam;
--error ER_GLOBAL_VARIABLE
SET SESSION wsrep_replicate_myisam= ON;
SET GLOBAL wsrep_replicate_myisam= ON;
# Reset it back.
SET GLOBAL wsrep_replicate_myisam= OFF;
#SET GLOBAL wsrep_provider=none;
--echo #
--echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
--echo # variables when using "_"
......
......@@ -1473,7 +1473,9 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
WSREP_DEBUG("MUST_REPLAY set after SP, err_status %d trx state: %d",
err_status, thd->wsrep_trx().state());
}
(void) wsrep_after_statement(thd);
if (wsrep_thd_is_local(thd))
(void) wsrep_after_statement(thd);
/*
Reset the return code to zero if the transaction was
......
......@@ -5926,11 +5926,13 @@ static Sys_var_uint Sys_wsrep_sync_wait(
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(wsrep_sync_wait_update));
static const char *wsrep_mode_names[]=
static const char *wsrep_mode_names[]=
{
"STRICT_REPLICATION",
"BINLOG_ROW_FORMAT_ONLY",
"REQUIRED_PRIMARY_KEY",
"REPLICATE_MYISAM",
"REPLICATE_ARIA",
NullS
};
static Sys_var_set Sys_wsrep_mode(
......@@ -5989,7 +5991,10 @@ static Sys_var_mybool Sys_wsrep_recover_datadir(
static Sys_var_mybool Sys_wsrep_replicate_myisam(
"wsrep_replicate_myisam", "To enable myisam replication",
GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(wsrep_replicate_myisam_update),
DEPRECATED("'@@wsrep_mode=REPLICATE_MYISAM'")); // since 10.6.0
static Sys_var_mybool Sys_wsrep_log_conflicts(
"wsrep_log_conflicts", "To log multi-master conflicts",
......
......@@ -1216,7 +1216,7 @@ static const char* wsrep_warning_name(const enum wsrep_warning_type type)
return "WSREP_REQUIRE_PRIMARY_KEY"; break;
case WSREP_REQUIRE_INNODB:
return "WSREP_REQUIRE_INNODB"; break;
default: assert(0);
default: assert(0); return " "; break; // for compiler
}
}
/**
......@@ -1373,7 +1373,8 @@ bool wsrep_check_mode_after_open_table (THD *thd,
return true;
const legacy_db_type db_type= hton->db_type;
bool replicate= (wsrep_replicate_myisam && db_type == DB_TYPE_MYISAM);
bool replicate= ((db_type == DB_TYPE_MYISAM && wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) ||
(db_type == DB_TYPE_ARIA && wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)));
TABLE *tbl= tables->table;
if (replicate)
......@@ -1383,7 +1384,7 @@ bool wsrep_check_mode_after_open_table (THD *thd,
Following code will kick-start the TOI but this has to be done only once
per statement.
Note: kick-start will take-care of creating isolation key for all tables
involved in the list (provided all of them are MYISAM tables). */
involved in the list (provided all of them are MYISAM or Aria tables). */
if (!is_stat_table(&tables->db, &tables->alias))
{
if (tbl->s->primary_key == MAX_KEY &&
......@@ -2183,14 +2184,17 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton)
return true;
break;
case DB_TYPE_MYISAM:
if (wsrep_replicate_myisam)
if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM))
return true;
else
WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd));
break;
case DB_TYPE_ARIA:
/* if (wsrep_replicate_aria) */
/* fallthrough */
if (wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))
return true;
else
WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd));
break;
default:
WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd));
break;
......
......@@ -134,10 +134,13 @@ enum enum_wsrep_ignore_apply_error {
WSREP_IGNORE_ERRORS_MAX= 0x7
};
/* wsrep_mode features */
enum enum_wsrep_mode {
WSREP_MODE_STRICT_REPLICATION= (1ULL << 0),
WSREP_MODE_BINLOG_ROW_FORMAT_ONLY= (1ULL << 1),
WSREP_MODE_REQUIRED_PRIMARY_KEY= (1ULL << 2)
WSREP_MODE_REQUIRED_PRIMARY_KEY= (1ULL << 2),
WSREP_MODE_REPLICATE_MYISAM= (1ULL << 3),
WSREP_MODE_REPLICATE_ARIA= (1ULL << 4)
};
// Streaming Replication
......
......@@ -1047,3 +1047,14 @@ bool wsrep_strict_ddl_update(sys_var *self, THD* thd, enum_var_type var_type)
wsrep_mode&= (~WSREP_MODE_STRICT_REPLICATION);
return false;
}
bool wsrep_replicate_myisam_update(sys_var *self, THD* thd, enum_var_type var_type)
{
// In case user still sets wsrep_replicate_myisam we set new
// option to wsrep_mode
if (wsrep_replicate_myisam)
wsrep_mode|= WSREP_MODE_REPLICATE_MYISAM;
else
wsrep_mode&= (~WSREP_MODE_REPLICATE_MYISAM);
return false;
}
......@@ -109,6 +109,7 @@ extern bool wsrep_gtid_domain_id_update UPDATE_ARGS;
extern bool wsrep_mode_check CHECK_ARGS;
extern bool wsrep_strict_ddl_update UPDATE_ARGS;
extern bool wsrep_replicate_myisam_update UPDATE_ARGS;
#else /* WITH_WSREP */
#define wsrep_provider_init(X)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment