mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
204 lines
6.6 KiB
Text
204 lines
6.6 KiB
Text
#
|
|
# Execute a migration from MariaDB replication to Galera replication.
|
|
# The test starts with 4 stand-alone servers defined by galera_migrate.cnf and then
|
|
# performs the following steps:
|
|
#
|
|
# 1. Begin with a single MySQL server
|
|
# 2. Establish traditional MySQL master-slave replication
|
|
# 3. Attach a new sever to serve as a MySQL replication slave
|
|
# 4. Enable Galera on the new slave and create a single-node Galera cluster
|
|
# 5. Attach a second Galera node
|
|
# 6. Turn off the traditional replication parts of the system
|
|
# 7. Continue replicating within Galera only
|
|
#
|
|
|
|
--source include/big_test.inc
|
|
--source include/have_innodb.inc
|
|
--source include/have_log_bin.inc
|
|
|
|
#
|
|
# Step #1 Begin with a single server
|
|
#
|
|
|
|
--connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1
|
|
|
|
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
#
|
|
# Step #2. Establish traditional MySQL replication
|
|
#
|
|
|
|
--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
|
--disable_query_log
|
|
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT = $NODE_MYPORT_1;
|
|
--enable_query_log
|
|
START SLAVE;
|
|
|
|
--connection node_1
|
|
INSERT INTO t1 VALUES (2);
|
|
|
|
--connection node_2
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
|
--source include/wait_condition.inc
|
|
|
|
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
|
|
--source include/wait_condition.inc
|
|
|
|
#
|
|
# Step #3. Attach a second slave, later to be converted to Galera
|
|
#
|
|
|
|
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
|
|
--disable_query_log
|
|
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT = $NODE_MYPORT_1;
|
|
--enable_query_log
|
|
START SLAVE USER='root';
|
|
|
|
--connection node_1
|
|
INSERT INTO t1 VALUES (3);
|
|
|
|
--connection node_3
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
|
--source include/wait_condition.inc
|
|
|
|
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
|
|
--source include/wait_condition.inc
|
|
|
|
#
|
|
# Step #4. Convert this MySQL slave into a Galera node
|
|
#
|
|
|
|
--connection node_1
|
|
INSERT INTO t1 VALUES (4);
|
|
|
|
--connection node_3
|
|
--disable_query_log
|
|
--eval SET GLOBAL wsrep_provider='$WSREP_PROVIDER'
|
|
--eval SET GLOBAL wsrep_provider_options='base_port=$NODE_GALERAPORT_3'
|
|
--enable_query_log
|
|
SET GLOBAL wsrep_cluster_address='gcomm://';
|
|
|
|
--connection node_1
|
|
INSERT INTO t1 VALUES (5);
|
|
|
|
--connection node_3
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
|
--source include/wait_condition.inc
|
|
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
|
|
--source include/wait_condition.inc
|
|
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
|
|
--source include/wait_condition.inc
|
|
|
|
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
|
|
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
|
|
SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
|
|
|
--connection node_1
|
|
INSERT INTO t1 VALUES (6);
|
|
|
|
#
|
|
# Step #5. Attach a second Galera node using mysqldump SST
|
|
#
|
|
|
|
--connection node_3
|
|
# We need a user with a password for mysqldump SST
|
|
GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
|
|
SET GLOBAL wsrep_sst_auth = 'sst:sst';
|
|
|
|
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
|
|
GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst';
|
|
|
|
--disable_query_log
|
|
--eval SET GLOBAL wsrep_sst_method = 'mysqldump';
|
|
--eval SET GLOBAL wsrep_provider='$WSREP_PROVIDER'
|
|
--eval SET GLOBAL wsrep_provider_options='base_port=$NODE_GALERAPORT_4'
|
|
--eval SET GLOBAL wsrep_sst_receive_address = '127.0.0.2:$NODE_MYPORT_4';
|
|
--eval SET GLOBAL wsrep_cluster_address='gcomm://127.0.0.1:$NODE_GALERAPORT_3'
|
|
--enable_query_log
|
|
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
|
--source include/wait_condition.inc
|
|
|
|
--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
|
|
--source include/wait_condition.inc
|
|
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
|
|
--source include/wait_condition.inc
|
|
|
|
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
|
|
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
|
|
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
|
|
|
|
|
#
|
|
# Step #6. Turn off traditional replication
|
|
#
|
|
|
|
--connection node_2
|
|
STOP SLAVE;
|
|
RESET SLAVE ALL;
|
|
|
|
--connection node_3
|
|
STOP SLAVE;
|
|
RESET SLAVE ALL;
|
|
|
|
#
|
|
# Step #7. Continue replicating within Galera only
|
|
#
|
|
|
|
# We need fresh connections due to galera#191
|
|
|
|
--connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3
|
|
INSERT INTO t1 VALUES (7);
|
|
|
|
--connect node_4a, 127.0.0.1, root, , test, $NODE_MYPORT_4
|
|
INSERT INTO t1 VALUES (8);
|
|
|
|
--connection node_4a
|
|
SELECT COUNT(*) = 8 FROM t1;
|
|
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
|
|
--source include/wait_condition.inc
|
|
|
|
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
|
|
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
|
|
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
|
|
|
--connection node_3a
|
|
SELECT COUNT(*) = 8 FROM t1;
|
|
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
|
|
--source include/wait_condition.inc
|
|
|
|
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
|
|
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
|
|
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
|
|
|
#
|
|
# Teardown
|
|
#
|
|
|
|
--connection node_1
|
|
DROP TABLE t1;
|
|
|
|
--connection node_2
|
|
DROP TABLE t1;
|
|
|
|
--connection node_3
|
|
SET GLOBAL wsrep_provider = 'none';
|
|
SET GLOBAL wsrep_sst_auth = '';
|
|
SET GLOBAL wsrep_provider_options = '';
|
|
DROP TABLE t1;
|
|
DROP USER sst;
|
|
|
|
--connection node_4
|
|
SET GLOBAL wsrep_provider = 'none';
|
|
SET GLOBAL wsrep_sst_method = 'rsync';
|
|
SET GLOBAL wsrep_provider_options = '';
|
|
SET GLOBAL wsrep_sst_receive_address = 'AUTO';
|
|
DROP TABLE t1;
|
|
DROP USER sst;
|
|
|
|
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
|