1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-27 05:41:41 +03:00
Files
mariadb/mysql-test/suite/galera/t/galera_as_slave_preordered.test
Brave Galera Crew 36a2a185fe Galera4
2019-01-23 15:30:00 +04:00

88 lines
2.1 KiB
Plaintext

#
# Test Galera as a slave to a MySQL master with --wsrep-preordered=TRUE
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
#
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/galera_cluster.inc
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE USER='root';
#
# Issue many large-ish transaction on the async master
#
--connection node_3
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
--disable_query_log
--let $count = 100
while ($count)
{
--eval INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
--dec $count
}
--enable_query_log
#
# While the async transactions are being applied, issue another set of transactions
# on the Galera node.
#
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $count = 100
--disable_query_log
while ($count)
{
--eval INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
--dec $count
}
--enable_query_log
#
# Confirm that all transactions successfully committed
#
--let $wait_condition = SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
--connection node_1
SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
#
# Cleanup
#
--connection node_3
DROP TABLE t1;
DROP TABLE ten;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ten';
--source include/wait_condition.inc
STOP SLAVE;
RESET SLAVE ALL;