|
| 1 | +# |
| 2 | +# MDEV-36677 |
| 3 | +# |
| 4 | +# This test checks the rsync SST works also when InnoDB log files |
| 5 | +# reside in a dedicated directory other than the data directory. |
| 6 | + |
| 7 | +# The test comprises of two parts: in Part A the SST donor has InnoDB |
| 8 | +# log files outside the data dictionary and in Part B the SST joiner |
| 9 | +# has log files outside the data dictionary. |
| 10 | +# |
| 11 | + |
| 12 | +--source include/galera_cluster.inc |
| 13 | +--source include/have_innodb.inc |
| 14 | +--source include/big_test.inc |
| 15 | + |
| 16 | +# Set up a 3-node cluster where node_2 has log files outside data dictionary |
| 17 | +--let $galera_connection_name = node_3 |
| 18 | +--let $galera_server_number = 3 |
| 19 | +--source include/galera_connect.inc |
| 20 | + |
| 21 | +--let $node_1=node_1 |
| 22 | +--let $node_2=node_2 |
| 23 | +--let $node_3=node_3 |
| 24 | +--source ../galera/include/auto_increment_offset_save.inc |
| 25 | + |
| 26 | +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size' |
| 27 | +--connection node_1 |
| 28 | +--source include/wait_condition.inc |
| 29 | +--connection node_2 |
| 30 | +--source include/wait_condition.inc |
| 31 | +--connection node_3 |
| 32 | +--source include/wait_condition.inc |
| 33 | + |
| 34 | +--connection node_1 |
| 35 | +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; |
| 36 | +SET AUTOCOMMIT=OFF; |
| 37 | +START TRANSACTION; |
| 38 | +INSERT INTO t1 VALUES (1,'node1_committed_at_start'); |
| 39 | +INSERT INTO t1 VALUES (2,'node1_committed_at_start'); |
| 40 | +INSERT INTO t1 VALUES (3,'node1_committed_at_start'); |
| 41 | +INSERT INTO t1 VALUES (4,'node1_committed_at_start'); |
| 42 | +INSERT INTO t1 VALUES (5,'node1_committed_at_start'); |
| 43 | +COMMIT; |
| 44 | + |
| 45 | + |
| 46 | +--connection node_2 |
| 47 | +--source include/galera_wait_ready.inc |
| 48 | + |
| 49 | +let $MYSQLD2_DATADIR= `SELECT @@datadir`; |
| 50 | +let $MYSQLD2_INNODB_LOGDIR= `SELECT @@innodb_log_group_home_dir`; |
| 51 | +let $MYSQLD2_ARIA_LOGDIR= `SELECT @@aria_log_dir_path`; |
| 52 | + |
| 53 | +# Part A: SST from node_2 to node_3 |
| 54 | +--connection node_3 |
| 55 | +--source include/shutdown_mysqld.inc |
| 56 | +--remove_file $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat |
| 57 | +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.3/data |
| 58 | + |
| 59 | +--connection node_2 |
| 60 | +SET AUTOCOMMIT=OFF; |
| 61 | +START TRANSACTION; |
| 62 | +INSERT INTO t1 VALUES (6,'node2_committed_when_node3_down'); |
| 63 | +INSERT INTO t1 VALUES (7,'node2_committed_when_node3_down'); |
| 64 | +INSERT INTO t1 VALUES (8,'node2_committed_when_node3_down'); |
| 65 | +INSERT INTO t1 VALUES (9,'node2_committed_when_node3_down'); |
| 66 | +INSERT INTO t1 VALUES (10,'node2_committed_when_node3_down'); |
| 67 | +COMMIT; |
| 68 | + |
| 69 | +--connection node_3 |
| 70 | +--let $restart_parameters = --wsrep_sst_donor=node2 |
| 71 | +--source include/start_mysqld.inc |
| 72 | +--source include/galera_wait_ready.inc |
| 73 | + |
| 74 | +--let $wait_condition = SELECT COUNT(*)=10 FROM t1 |
| 75 | +--source include/wait_condition.inc |
| 76 | + |
| 77 | +SET AUTOCOMMIT=ON; |
| 78 | +SET SESSION wsrep_sync_wait=15; |
| 79 | +SELECT COUNT(*) AS EXPECT_10 FROM t1; |
| 80 | +SELECT * from t1; |
| 81 | +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
| 82 | + |
| 83 | +# Part B: SST from node_3 to node_2 |
| 84 | +--connection node_2 |
| 85 | +--source include/shutdown_mysqld.inc |
| 86 | +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data |
| 87 | +--remove_files_wildcard $MYSQL_TMP_DIR/mysqld.2/mdev_36677_log_dir |
| 88 | +--remove_files_wildcard $MYSQL_TMP_DIR/mysqld.2/mdev_36677_aria_log_dir |
| 89 | + |
| 90 | +--connection node_3 |
| 91 | +SET AUTOCOMMIT=OFF; |
| 92 | +START TRANSACTION; |
| 93 | +INSERT INTO t1 VALUES (11,'node2_committed_when_node2_down'); |
| 94 | +INSERT INTO t1 VALUES (12,'node2_committed_when_node2_down'); |
| 95 | +INSERT INTO t1 VALUES (13,'node2_committed_when_node2_down'); |
| 96 | +INSERT INTO t1 VALUES (14,'node2_committed_when_node2_down'); |
| 97 | +INSERT INTO t1 VALUES (15,'node2_committed_when_node2_down'); |
| 98 | +COMMIT; |
| 99 | + |
| 100 | +--connection node_2 |
| 101 | +--let $restart_parameters = --wsrep_sst_donor=node3 |
| 102 | +--source include/start_mysqld.inc |
| 103 | +--source include/galera_wait_ready.inc |
| 104 | + |
| 105 | +--let $wait_condition = SELECT COUNT(*)=15 FROM t1 |
| 106 | +--source include/wait_condition.inc |
| 107 | + |
| 108 | +# check that InnoDB log file was not copied to a data directory, but to a dedicated directory |
| 109 | +--exec if [ -f $MYSQLD2_DATADIR/ib_logfile0 ]; then false; fi |
| 110 | +--exec if [ ! -f $MYSQLD2_INNODB_LOGDIR/ib_logfile0 ]; then false; fi |
| 111 | +# check that Aria log file was not copied to a data directory, but to a dedicated directory |
| 112 | +--exec if [ -f $MYSQLD2_DATADIR/aria_log.00000001 ]; then false; fi |
| 113 | +--exec if [ ! -f $MYSQLD2_ARIA_LOGDIR/aria_log.00000001 ]; then false; fi |
| 114 | + |
| 115 | +SET AUTOCOMMIT=ON; |
| 116 | +SET SESSION wsrep_sync_wait=15; |
| 117 | +SELECT COUNT(*) AS EXPECT_15 FROM t1; |
| 118 | +SELECT * from t1; |
| 119 | +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (10, 15)) AS a1; |
| 120 | + |
| 121 | +# cleanup |
| 122 | +--connection node_1 |
| 123 | +--source ../galera/include/auto_increment_offset_restore.inc |
| 124 | + |
| 125 | +DROP TABLE t1; |
| 126 | +COMMIT; |
0 commit comments