diff options
author | Philip Stoev <philip.stoev@galeracluster.com> | 2015-08-03 03:20:52 -0700 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-09-09 22:42:31 -0400 |
commit | a1a7414b1d448be38463d23c5f91b0280e603e09 (patch) | |
tree | e41d13062d1890ea1e42e59546dadd0883f01428 /mysql-test/suite/galera_3nodes | |
parent | 1e2906892a1403734c246082cc90ac2cf9d91053 (diff) | |
download | mariadb-git-a1a7414b1d448be38463d23c5f91b0280e603e09.tar.gz |
Galera MTR Tests: An end-to-end test with restoring a node from xtrabackup; a test for restoring the primary component via pc.bootstrap
Diffstat (limited to 'mysql-test/suite/galera_3nodes')
4 files changed, 186 insertions, 0 deletions
diff --git a/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result b/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result new file mode 100644 index 00000000000..85000db8e77 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result @@ -0,0 +1,11 @@ +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SELECT COUNT(*) = 10 FROM t1; +COUNT(*) = 10 +1 +Killing server ... +INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); +SELECT COUNT(*) = 20 FROM t1; +COUNT(*) = 20 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result new file mode 100644 index 00000000000..f5a4cad4a23 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result @@ -0,0 +1,29 @@ +CREATE TABLE t1 (f1 INTEGER); +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait = 0; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status non-Primary +SET GLOBAL wsrep_provider_options = 'pc.bootstrap=1'; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 1 +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status Primary +INSERT INTO t1 VALUES (1); +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test new file mode 100644 index 00000000000..2003aaa1b4e --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test @@ -0,0 +1,56 @@ +# +# This test uses innobackupex to take a backup on node #2 and then restores that node from backup +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +--connection node_2 +SELECT COUNT(*) = 10 FROM t1; + +--exec innobackupex $MYSQL_TMP_DIR/innobackupex_backup --galera-info --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-backup.log +--exec innobackupex $MYSQL_TMP_DIR/innobackupex_backup --apply-log --galera-info --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-apply.log + +--source include/kill_galera.inc +--sleep 1 + +--connection node_1 +INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); + +--exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/* +--exec innobackupex --copy-back $MYSQL_TMP_DIR/innobackupex_backup --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --port=$NODE_MYPORT_2 --host=127.0.0.1 > $MYSQL_TMP_DIR/innobackupex-restore.log + +# +# Convert the xtrabackup_galera_info into a grastate.dat file +# + +--perl + use strict; + my $xtrabackup_galera_info_file = $ENV{'MYSQL_TMP_DIR'}.'/innobackupex_backup/xtrabackup_galera_info'; + open(XTRABACKUP_GALERA_INFO, $xtrabackup_galera_info_file) or die "Can not open $xtrabackup_galera_info_file: $!"; + my $xtrabackup_galera_info = <XTRABACKUP_GALERA_INFO>; + my ($uuid, $seqno) = split(':', $xtrabackup_galera_info); + + my $grastate_dat_file = $ENV{'MYSQLTEST_VARDIR'}.'/mysqld.2/data/grastate.dat'; + die "grastate.dat already exists" if -e $grastate_dat_file; + + open(GRASTATE_DAT, ">$grastate_dat_file") or die "Can not write to $grastate_dat_file: $!"; + print GRASTATE_DAT "version: 2.1\n"; + print GRASTATE_DAT "uuid: $uuid\n"; + print GRASTATE_DAT "seqno: $seqno\n"; + print GRASTATE_DAT "cert_index:\n"; + exit(0); +EOF + +--source include/start_mysqld.inc + +--source include/wait_until_connected_again.inc +SELECT COUNT(*) = 20 FROM t1; + +DROP TABLE t1; + +--sleep 10 diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test new file mode 100644 index 00000000000..6172ffcc743 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test @@ -0,0 +1,90 @@ +# +# Test the operation of pc.bootstrap +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER); + +# Force all nodes to become non-primary +--connection node_1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--connection node_2 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +--sleep 10 + +# Node #2 should be non-primary +SET SESSION wsrep_sync_wait = 0; +SHOW STATUS LIKE 'wsrep_cluster_status'; + +# Signal node #2 to bootstrap +--connection node_2 +SET GLOBAL wsrep_provider_options = 'pc.bootstrap=1'; + +# Wait until node becomes available for queries again +--source include/wait_until_connected_again.inc + +# Node #2 should now be a primary of a 1-node cluster + +SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_status'; + +# Perform an insert on node #2 +INSERT INTO t1 VALUES (1); + +# Reconnect all nodes +--connection node_2 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +--sleep 10 +--source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + + +--connection node_1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +--source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + + +--connection node_3 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +--sleep 10 +--source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Check that all nodes have the same view of the database + +--connection node_1 +SELECT COUNT(*) FROM t1; + +--connection node_2 +SELECT COUNT(*) FROM t1; + +--connection node_3 +SELECT COUNT(*) FROM t1; + +# Test cleanup +DROP TABLE t1; |