set -e
|
M7VER=10.2.7
|
|
# just use current directory if called from framework
|
if [ ! -f common.sh ] ; then
|
[ -d mariadb-environs ] || git clone http://github.com/AndriiNikitin/mariadb-environs
|
cd mariadb-environs
|
./get_plugin.sh galera
|
fi
|
|
function onExit {
|
mv _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump.orig _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump
|
if [ "$inited" != 1 ] ; then
|
echo FAIL - failed to initialize
|
elif [ ! -f m2*/dt/p.id ] ; then
|
echo FAIL - the node is not running
|
elif [ "$passed" != 1 ] ; then
|
echo FAIL - sst wasn\'t cancelled on SIGTERM after 45 sec
|
echo process $(cat m2*/dt/p.id) is still up at $(date +"%T")
|
ps auxww | grep mysqld | grep $(cat m2*/dt/p.id)
|
echo shutdown initiated at:
|
grep -i shutdown m2*/dt/error.log
|
echo last lines in log:
|
tail -n 4 m2*/dt/error.log
|
fi
|
}
|
trap onExit EXIT
|
|
echo CLEANING UP ...
|
[ -f c1/cleanup.sh ] && c1/cleanup.sh || :
|
|
echo GENERATE TEMPLATES ...
|
_template/plant_cluster.sh c1
|
echo m1 > c1/nodes.lst
|
echo m2 >> c1/nodes.lst
|
c1/replant.sh $M7VER
|
|
echo DOWNLOAD BINARIES
|
./build_or_download.sh m1
|
./build_or_download.sh m2
|
|
echo HACK SST SCRIPT ...
|
# one more backup of sst script just in case
|
[ -f _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump.orig1 ] || cp _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump.orig1
|
|
# mysqldump script is handled in special way inside sst, so we will use that name to be extra sure
|
# let's make backup of the script and insert simple sleep instead
|
cp _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump.orig
|
echo '#!/bin/bash' > _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump
|
echo 'for i in {1..150}; do sleep 1; done ' >> _depot/m-tar/${M7VER}/bin/wsrep_sst_mysqldump
|
|
echo INIT NEW CLUSTER ...
|
c1/gen_cnf.sh
|
c1/install_db.sh
|
c1/galera_setup_acl.sh
|
|
. c1/galera_start_new.sh wsrep_sst_method=mysqldump
|
|
echo WAITING A BIT ...
|
m2*/status.sh && inited=1
|
sleep 15
|
echo SENDING SIGTERM AT $(date +"%T")
|
kill $(cat m2*/dt/p.id)
|
|
echo WAIT MORE ...
|
sleep 45
|
echo CHECK IF SST IS STILL UP
|
set +e
|
if kill -0 $(cat m2*/dt/p.id) ; then
|
exit 1
|
else
|
echo PASS
|
passed=1
|
fi
|