Skip to content

Commit a34b964

Browse files
committed
MDEV-36677 rsync sst fails with different innodb_log_group_home_dir and datadir
Backported the fix done by Pekka Lampio for mariaDB 11.4 in PR mariadb-corporation#543 The PR has a fix for wsrep_sst_rsync script and new mtr test: galera_3nodes.galera_mdev_36677" to check that the rsync SST method of Galera works correctly also when the joiner node store InnoDB log files in a dedicated directory separate from the data dictionary Note: merging this PR to 11.4 may not be fully functional as there are other changes in the rsync SST script. Take a look at the original 11.4 PR when merging.
1 parent 0cb7c2f commit a34b964

4 files changed

Lines changed: 235 additions & 0 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
connection node_2;
2+
connection node_1;
3+
connection node_1;
4+
connection node_2;
5+
connection node_3;
6+
connection node_1;
7+
connection node_2;
8+
connection node_3;
9+
connection node_1;
10+
CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
11+
SET AUTOCOMMIT=OFF;
12+
START TRANSACTION;
13+
INSERT INTO t1 VALUES (1,'node1_committed_at_start');
14+
INSERT INTO t1 VALUES (2,'node1_committed_at_start');
15+
INSERT INTO t1 VALUES (3,'node1_committed_at_start');
16+
INSERT INTO t1 VALUES (4,'node1_committed_at_start');
17+
INSERT INTO t1 VALUES (5,'node1_committed_at_start');
18+
COMMIT;
19+
connection node_2;
20+
connection node_3;
21+
connection node_2;
22+
SET AUTOCOMMIT=OFF;
23+
START TRANSACTION;
24+
INSERT INTO t1 VALUES (6,'node2_committed_when_node3_down');
25+
INSERT INTO t1 VALUES (7,'node2_committed_when_node3_down');
26+
INSERT INTO t1 VALUES (8,'node2_committed_when_node3_down');
27+
INSERT INTO t1 VALUES (9,'node2_committed_when_node3_down');
28+
INSERT INTO t1 VALUES (10,'node2_committed_when_node3_down');
29+
COMMIT;
30+
connection node_3;
31+
# restart: --wsrep_sst_donor=node2
32+
SET AUTOCOMMIT=ON;
33+
SET SESSION wsrep_sync_wait=15;
34+
SELECT COUNT(*) AS EXPECT_10 FROM t1;
35+
EXPECT_10
36+
10
37+
SELECT * from t1;
38+
id f1
39+
1 node1_committed_at_start
40+
2 node1_committed_at_start
41+
3 node1_committed_at_start
42+
4 node1_committed_at_start
43+
5 node1_committed_at_start
44+
6 node2_committed_when_node3_down
45+
7 node2_committed_when_node3_down
46+
8 node2_committed_when_node3_down
47+
9 node2_committed_when_node3_down
48+
10 node2_committed_when_node3_down
49+
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
50+
COUNT(*) = 0
51+
1
52+
connection node_2;
53+
connection node_3;
54+
SET AUTOCOMMIT=OFF;
55+
START TRANSACTION;
56+
INSERT INTO t1 VALUES (11,'node2_committed_when_node2_down');
57+
INSERT INTO t1 VALUES (12,'node2_committed_when_node2_down');
58+
INSERT INTO t1 VALUES (13,'node2_committed_when_node2_down');
59+
INSERT INTO t1 VALUES (14,'node2_committed_when_node2_down');
60+
INSERT INTO t1 VALUES (15,'node2_committed_when_node2_down');
61+
COMMIT;
62+
connection node_2;
63+
# restart: --wsrep_sst_donor=node3
64+
SET AUTOCOMMIT=ON;
65+
SET SESSION wsrep_sync_wait=15;
66+
SELECT COUNT(*) AS EXPECT_15 FROM t1;
67+
EXPECT_15
68+
15
69+
SELECT * from t1;
70+
id f1
71+
1 node1_committed_at_start
72+
2 node1_committed_at_start
73+
3 node1_committed_at_start
74+
4 node1_committed_at_start
75+
5 node1_committed_at_start
76+
6 node2_committed_when_node3_down
77+
7 node2_committed_when_node3_down
78+
8 node2_committed_when_node3_down
79+
9 node2_committed_when_node3_down
80+
10 node2_committed_when_node3_down
81+
11 node2_committed_when_node2_down
82+
12 node2_committed_when_node2_down
83+
13 node2_committed_when_node2_down
84+
14 node2_committed_when_node2_down
85+
15 node2_committed_when_node2_down
86+
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (10, 15)) AS a1;
87+
COUNT(*) = 0
88+
0
89+
connection node_1;
90+
DROP TABLE t1;
91+
COMMIT;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
!include ../galera_3nodes.cnf
2+
3+
[mysqld]
4+
wsrep_sst_method=rsync
5+
6+
[mysqld.1]
7+
wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
8+
9+
[mysqld.2]
10+
wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
11+
innodb_log_group_home_dir=@ENV.MYSQL_TMP_DIR/mysqld.2/mdev_36677_log_dir
12+
aria_log_dir_path=@ENV.MYSQL_TMP_DIR/mysqld.2/mdev_36677_aria_log_dir
13+
14+
[mysqld.3]
15+
wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
16+
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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;

scripts/wsrep_sst_rsync.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ RC=0
324324

325325
if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
326326

327+
create_dirs
328+
327329
if [ -n "$STUNNEL" ]; then
328330
cat << EOF > "$STUNNEL_CONF"
329331
key = $SSTKEY

0 commit comments

Comments
 (0)