@@ -24,7 +24,9 @@ store_logs() {
24
24
mkdir /home/buildbot/sst_logs/mbackup
25
25
for node in 1 2 3; do
26
26
for log in prepare move backup; do
27
- sudo cp /var/lib/node${node} /mariabackup.${log} .log /home/buildbot/sst_logs/mbackup/node${node} .mariabackup.${log} .log
27
+ if [[ -f /var/lib/node${node} /mariabackup.${log} .log ]]; then
28
+ sudo cp /var/lib/node${node} /mariabackup.${log} .log /home/buildbot/sst_logs/mbackup/node${node} .mariabackup.${log} .log
29
+ fi
28
30
done
29
31
done
30
32
sudo chown -R buildbot:buildbot /home/buildbot/sst_logs
@@ -55,21 +57,31 @@ if [[ $sst_mode == "xtrabackup-v2" ]]; then
55
57
esac
56
58
fi
57
59
58
- sudo killall mysqld mariadbd || true
60
+ # //TEMP probably need to remove mysqld in the future
61
+ bb_log_info " make sure mariadb is not running"
62
+ for process in mariadbd mysqld; do
63
+ if pgrep $process > /dev/null; then
64
+ sudo killall $process > /dev/null
65
+ fi
66
+ done
59
67
60
68
# give mariadb the time to shutdown
61
69
for i in 1 2 3 4 5 6 7 8 9 10; do
62
70
if pgrep ' mysqld|mariadbd' ; then
71
+ bb_log_info " give mariadb the time to shutdown ($i )"
63
72
sleep 3
64
73
else
65
74
break
66
75
fi
67
76
done
68
77
69
- # We don't want crash recovery, but if mysqld hasn't stopped, we'll have to deal with it
70
- if pgrep ' mysqld|mariadbd' ; then
71
- sudo killall -s 9 mysqld mariadbd
72
- fi
78
+ # We don't want crash recovery, but if mariadb hasn't stopped, we'll have to
79
+ # deal with it
80
+ for process in mariadbd mysqld; do
81
+ if pgrep $process > /dev/null; then
82
+ sudo killall -s 9 $process > /dev/null
83
+ fi
84
+ done
73
85
74
86
if [[ $sst_mode == " mariabackup" ]]; then
75
87
# Starting from 10.3.6, MariaBackup packages have a generic name mariadb-backup.
@@ -198,12 +210,13 @@ res=1
198
210
set +x
199
211
bb_log_info " waiting till the first node comes up..."
200
212
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
213
+ bb_log_info " still waiting for first node comes up ($i )..."
201
214
sleep 2
202
215
if mysql -uroot -prootpass --port=8301 --protocol=tcp -e " create database mgc; create table mgc.t1 (i int); insert into mgc.t1 values (1)" ; then
203
216
res=0
204
217
break
205
218
fi
206
- date " +% H:%M:%S"
219
+ date + ' %Y-%m-%dT% H:%M:%S%z '
207
220
sudo tail -n 5 /var/lib/node1/node1.err || true
208
221
done
209
222
set -x
@@ -212,7 +225,7 @@ if [ "$res" != "0" ]; then
212
225
store_logs
213
226
exit 1
214
227
fi
215
- mysql -uroot -prootpass --port=8301 --protocol=tcp -e " select * from mgc.t1"
228
+ mysql -uroot -prootpass --port=8301 --protocol=tcp -e " select * from mgc.t1\G "
216
229
217
230
# We can't start both nodes at once, because it causes rsync port conflict
218
231
# (and maybe some other SST methods will have problems too)
@@ -224,23 +237,25 @@ for node in 2 3; do
224
237
res=1
225
238
set +x
226
239
bb_log_info " waiting till node $node comes up..."
227
- # shellcheck disable=SC2034
228
240
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
229
241
sleep 5
230
- if mysql -uroot -prootpass --port=830$node --protocol=tcp -e " select * from mgc.t1" ; then
242
+ # echoing to 2>/dev/null because we do not want mysql connection error to
243
+ # be printed ERROR 2002 (HY000): Can't connect to MySQL server on 'localhost'
244
+ if mysql -uroot -prootpass --port=830$node --protocol=tcp -e " select * from mgc.t1\G" 2> /dev/null; then
231
245
res=0
232
246
break
233
247
fi
234
- date " +%H:%M:%S"
235
- tail -n 5 /var/lib/node${node} /node${node} .err || true
248
+ bb_log_info " still waiting for node $node to come up ($i )..."
249
+ date +' %Y-%m-%dT%H:%M:%S%z'
250
+ sudo tail -n 5 /var/lib/node${node} /node${node} .err || true
236
251
done
237
252
set -x
238
253
if [ " $res " != " 0" ]; then
239
254
bb_log_err " failed to start node $node or to connect to it after the start"
240
255
store_logs
241
256
exit 1
242
257
fi
243
- mysql -uroot -prootpass --port=830$node --protocol=tcp -e " select * from mgc.t1"
258
+ mysql -uroot -prootpass --port=830$node --protocol=tcp -e " select * from mgc.t1\G "
244
259
done
245
260
246
261
mysql -uroot -prootpass --port=8301 --protocol=tcp -e " show status like 'wsrep_cluster_size'"
@@ -249,13 +264,24 @@ store_logs
249
264
250
265
set -e
251
266
mysql -uroot -prootpass --port=8301 --protocol=tcp -e " show status like 'wsrep_cluster_size'" | grep 3
252
- mysql -uroot -prootpass --port=8302 --protocol=tcp -e " select * from mgc.t1"
253
- mysql -uroot -prootpass --port=8303 --protocol=tcp -e " select * from mgc.t1"
267
+
268
+ for node in 2 3; do
269
+ mysql -uroot -prootpass --port=830${node} --protocol=tcp -e " select * from mgc.t1\G"
270
+ done
271
+
254
272
mysql -uroot -prootpass --port=8303 --protocol=tcp -e " drop table mgc.t1"
273
+ # check that previous drop was replicated to other nodes
274
+ for node in 2 1; do
275
+ if mysql -uroot -prootpass --port=830${node} --protocol=tcp -e " set wsrep_sync_wait=15; use mgc; show tables" | grep -q t1; then
276
+ bb_log_err " modification on node 3 was not replicated on node ${node} "
277
+ mysql -uroot -prootpass --port=830${node} --protocol=tcp -e " use mgc; show tables"
278
+ exit 1
279
+ fi
280
+ done
255
281
256
- # //TEMP I don't understand this test but it's not validated by shellcheck
257
- # shellcheck disable=SC2251
258
- ! mysql -uroot -prootpass --port=8302 --protocol=tcp -e " set wsrep_sync_wait=15; select * from mgc.t1 "
259
- ! mysql -uroot -prootpass --port=8301 --protocol=tcp -e " set wsrep_sync_wait=15; select * from mgc.t1 "
282
+ bb_log_info " stop cluster "
283
+ sudo killall -s 9 mariadbd || true
284
+ sleep 1
285
+ sudo killall -s 9 mysqld_safe || true
260
286
261
287
bb_log_ok " all done"
0 commit comments