mariadb/mysql-test/suite/galera/t/galera_admin.test
Sachin Setiya e757e02417 Galera MTR Tests: Copy over some MTR tests from PXC
Signed-off-by: Sachin Setiya <sachin.setiya@mariadb.com>
2017-04-06 15:41:54 +05:30

86 lines
2.9 KiB
Text

#
# Test that various admin commands from sql_admin.cc
# Currently, REPAIR, OPTIMIZE and ANALYZE are tested.
# Jira: PXC-390
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP TABLE IF EXISTS x1, x2;
--enable_warnings
--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;
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);
# 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;
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;
SET GLOBAL wsrep_replicate_myisam = FALSE;