Debian Codegraph @

mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test

raw
1 #
2 # A very basic test for the galera arbitrator. We shut down node #3 and use its port allocation to start garbd.
3 # As MTR does not allow multiple servers to be down at the same time, we are limited as to what we can test.
4 #
5
6 --source include/galera_cluster.inc
7 --source include/have_innodb.inc
8 --source include/have_garbd.inc
9 --source include/big_test.inc
10 --source include/have_debug.inc
11 --source include/have_debug_sync.inc
12
13 # Save galera ports
14 --source suite/galera/include/galera_base_port.inc
15 --let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
16
17 --let $galera_connection_name = node_3
18 --let $galera_server_number = 3
19 --source include/galera_connect.inc
20 --source suite/galera/include/galera_base_port.inc
21 --let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT
22
23 # Save original auto_increment_offset values.
24 --let $node_1=node_1
25 --let $node_2=node_2
26 --let $node_3=node_3
27 --source ../galera/include/auto_increment_offset_save.inc
28
29 --connection node_1
30 --let $datadir= `SELECT @@datadir`
31
32 --let $innodb_max_dirty_pages_pct = `SELECT @@innodb_max_dirty_pages_pct`
33 --let $innodb_max_dirty_pages_pct_lwm = `SELECT @@innodb_max_dirty_pages_pct_lwm`
34
35 SET GLOBAL innodb_max_dirty_pages_pct=0.0;
36 SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
37
38 --let $wait_condition = SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'
39 --source include/wait_condition.inc
40
41 SET GLOBAL innodb_max_dirty_pages_pct=99;
42 SET GLOBAL innodb_max_dirty_pages_pct_lwm=99;
43
44 CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB;
45 CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
46 INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
47 INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
48 FLUSH TABLES WITH READ LOCK;
49 UNLOCK TABLES;
50
51 --connection node_2
52 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
53 --source include/wait_condition.inc
54 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ten'
55 --source include/wait_condition.inc
56 --let $wait_condition = SELECT COUNT(*) = 10 FROM ten
57 --source include/wait_condition.inc
58 --let $wait_condition = SELECT COUNT(*) = 10000 FROM t1
59 --source include/wait_condition.inc
60
61 SELECT COUNT(*) FROM t1;
62 SELECT COUNT(*) FROM ten;
63
64 --echo Killing node #3 to free ports for garbd ...
65 --connection node_3
66 --source include/shutdown_mysqld.inc
67
68 --connection node_1
69 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
70 --source include/wait_condition.inc
71
72 # stop SST donor thread when node is in donor state
73 SET GLOBAL debug_dbug = "+d,sync.wsrep_donor_state";
74
75 --echo Starting garbd ...
76 --exec $MTR_GARBD_EXE --address "gcomm://127.0.0.1:$NODE_GALERAPORT_1" --group my_wsrep_cluster --donor node1 --sst backup --options 'base_port=$NODE_GALERAPORT_3' > $MYSQL_TMP_DIR/garbd.log 2>&1 &
77
78 SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_donor_state_reached";
79
80 #
81 # get hash of data directory contents before BP dirty page flushing
82 #
83 --exec find $datadir -type f ! -name tables_flushed ! -name backup_sst_complete -print 0 -exec md5sum {} \; | sort -u | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_before
84
85 # this should force buffer pool flushing, if not already done by donor state change transfer
86 SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
87 SET GLOBAL innodb_max_dirty_pages_pct=0.0;
88
89 --let $wait_condition = SELECT variable_value = 0 FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'
90 --source include/wait_condition.inc
91
92 #
93 #
94 # record the hash of data directory contents after BP dirty page flushing
95 #
96 --exec find $datadir -type f ! -name tables_flushed ! -name backup_sst_complete -print 0 -exec md5sum {} \; | sort -u | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_after
97
98 # there should be no disk writes
99 --diff_files $MYSQLTEST_VARDIR/tmp/innodb_before $MYSQLTEST_VARDIR/tmp/innodb_after
100
101 SET SESSION debug_sync = "now SIGNAL signal.wsrep_donor_state";
102 SET GLOBAL debug_dbug = "";
103 SET debug_sync='RESET';
104
105 --connection node_1
106
107 #
108 # garbd will die automatically, because of the backup SST script
109 # but just to be sure, sending explicit kill here, as well
110 #
111 --echo Killing garbd ...
112 # FreeBSD's /bin/pkill only supports short versions of the options:
113 # -o Select only the oldest (least recently started)
114 # -f Match against full argument lists
115 --error 0,1
116 --exec pkill -o -f garbd.*$NODE_GALERAPORT_3
117
118 --connection node_1
119 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
120 --source include/wait_condition.inc
121
122 --connection node_2
123
124 DROP TABLE t1;
125 DROP TABLE ten;
126
127 --echo Restarting node #3 to satisfy MTR's end-of-test checks
128 --connection node_3
129 let $restart_noprint=2;
130 --source include/start_mysqld.inc
131
132 --connection node_1
133 --disable_query_log
134 --eval SET GLOBAL innodb_max_dirty_pages_pct = $innodb_max_dirty_pages_pct
135 --eval SET GLOBAL innodb_max_dirty_pages_pct_lwm = $innodb_max_dirty_pages_pct_lwm
136 --enable_query_log
137
138 # Restore original auto_increment_offset values.
139 --source ../galera/include/auto_increment_offset_restore.inc
140