mariadb/mysql-test/suite/galera/t/galera_flush_local.test
Nirbhay Choubey 17ac959716 Bug#1421360: Add Percona Server specific FLUSH statements.
- Restore FLUSH commands supported by MariaDB (removed in
the previous commit)
- Adjust test case
2016-02-22 22:07:59 -05:00

142 lines
4.4 KiB
Text

#
# Test that various FLUSH LOCAL commands are replicated. Whenever possible, check the slave for the effects.
# PXC-391
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_query_cache.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2, x1, x2;
--enable_warnings
#
# The following FLUSH LOCAL statements should *not* be replicated
#
--connection node_1
CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
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);
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
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--connection node_1
FLUSH LOCAL DES_KEY_FILE;
FLUSH LOCAL HOSTS;
FLUSH LOCAL QUERY CACHE;
FLUSH LOCAL STATUS;
FLUSH LOCAL PRIVILEGES;
FLUSH LOCAL USER_RESOURCES;
FLUSH LOCAL TABLES;
FLUSH LOCAL TABLES t2;
FLUSH LOCAL ERROR LOGS;
FLUSH LOCAL SLOW LOGS;
FLUSH LOCAL GENERAL LOGS;
FLUSH LOCAL ENGINE LOGS;
FLUSH LOCAL RELAY LOGS;
FLUSH LOCAL CLIENT_STATISTICS;
FLUSH LOCAL INDEX_STATISTICS;
FLUSH LOCAL TABLE_STATISTICS;
FLUSH LOCAL USER_STATISTICS;
FLUSH LOCAL LOGS;
FLUSH LOCAL BINARY LOGS;
FLUSH LOCAL TABLES WITH READ LOCK;
UNLOCK TABLES;
FLUSH LOCAL TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
FLUSH LOCAL TABLES t1 FOR EXPORT;
UNLOCK TABLES;
LOCK TABLES t1 WRITE;
FLUSH LOCAL TABLES t1;
UNLOCK TABLES;
LOCK TABLES t1 READ;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
FLUSH LOCAL TABLES t1;
UNLOCK TABLES;
FLUSH LOCAL TABLES t1;
ANALYZE LOCAL TABLE t1, t2;
OPTIMIZE LOCAL TABLE t1, t2;
REPAIR LOCAL TABLE x1, x2;
--connection node_2
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--disable_query_log
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff;
--enable_query_log
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, x1, x2;
CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
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);
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
--let $wsrep_last_committed_before2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--connection node_1
set wsrep_on=0;
FLUSH DES_KEY_FILE;
FLUSH HOSTS;
FLUSH QUERY CACHE;
FLUSH STATUS;
FLUSH PRIVILEGES;
FLUSH USER_RESOURCES;
FLUSH TABLES;
FLUSH TABLES t2;
FLUSH ERROR LOGS;
FLUSH SLOW LOGS;
FLUSH GENERAL LOGS;
FLUSH ENGINE LOGS;
FLUSH RELAY LOGS;
FLUSH CLIENT_STATISTICS;
FLUSH INDEX_STATISTICS;
FLUSH TABLE_STATISTICS;
FLUSH USER_STATISTICS;
FLUSH LOGS;
FLUSH BINARY LOGS;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
LOCK TABLES t1 WRITE;
FLUSH TABLES t1;
UNLOCK TABLES;
LOCK TABLES t1 READ;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
FLUSH TABLES t1;
UNLOCK TABLES;
FLUSH TABLES t1;
ANALYZE TABLE t1, t2;
OPTIMIZE TABLE t1, t2;
REPAIR TABLE x1, x2;
--connection node_2
--let $wsrep_last_committed_after2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--disable_query_log
--eval SELECT $wsrep_last_committed_after2 = $wsrep_last_committed_before2 AS wsrep_last_committed_diff;
--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;
--connection node_1
set wsrep_on=1;
DROP TABLE t1, t2, x1, x2;