Skip to content

Commit 420ff01

Browse files
committed
DB-11134 start-splice-cluster to abort when start fails, added pipelines/upgrade-testing
- check_upgrade.sh {VERSION} {additional start-splice-cluster parameters}" - create_upgrade_targz.sh {VERSION} {test/upload} {additional start-splice-cluster parameters}
1 parent 76bbf68 commit 420ff01

File tree

4 files changed

+117
-61
lines changed

4 files changed

+117
-61
lines changed

check_upgrade.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
UPGRADE_URL=s3://splice-snapshots/upgrade_tests
3+
4+
if [ $# -lt 2 ]
5+
then
6+
echo "usage: bash create_upgrade_targz.sh {VERSION} {additional start-splice-cluster parameters}"
7+
echo "------------------------------------------------------------------------------------------"
8+
echo "uses a previously created tar.gz to test upgrade"
9+
echo "e.g. bash create_upgrade_targz.sh 3.2.2021 -T 16"
10+
echo "make sure you current branch has already been build"
11+
echo "don't use -b, since we are deleting some files in platform_it/target"
12+
13+
exit 1
14+
fi
15+
16+
VERSION=${1}
17+
shift
18+
19+
# stop current cluster
20+
./start-splice-cluster -k
21+
22+
# clean up platform_it
23+
cd platform_it
24+
git clean -dfx
25+
cd ..
26+
27+
# download the previous standalone data
28+
aws s3 cp ${UPGRADE_URL}/platform_it_${VERSION}.tar.gz .
29+
tar -xzvf platform_it_${VERSION}.tar.gz
30+
rm platform_it_${VERSION}.tar.gz
31+
32+
# restart cluster
33+
./start-splice-cluster -l $*
34+
35+
# test
36+
if mvn -B -e surefire:test -Pcore,cdh6.3.0 -Dtest='UpgradeTestIT#*' -DskipServerStart -DfailIfNoTests=false; then
37+
echo "UPGRADE SUCCEEDED"
38+
cat platform_it/splice.log | grep 'upgrade scripts'
39+
cat platform_it/splice.log | grep 'Running upgrade script'
40+
else
41+
echo "!!! UPGRADE FAILED !!!"
42+
fi
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
UPGRADE_URL=s3://splice-snapshots/upgrade_tests
4+
5+
6+
if [ $# -lt 2 ]
7+
then
8+
echo "usage: bash platform_it/src/test/bin/create_upgrade_targz.sh {VERSION} {test/upload} {additional start-splice-cluster parameters}"
9+
echo "----------------------------------------------------------------------------------------------------------------------------------"
10+
echo "creates a tar.gz of a spliceengine standalone cluster that can be used to test upgrade"
11+
echo "e.g. bash create_upgrade_targz.sh 3.1.0.1971 test -T 16 -pcore,cdh6.3.0"
12+
exit 1
13+
fi
14+
15+
VERSION=${1} # e.g. 3.1.0.1971
16+
MODE=${2} # test or upload
17+
shift 2
18+
19+
20+
PREVIOUS_BRANCH=`git rev-parse --abbrev-ref HEAD`
21+
git stash
22+
23+
# creates a file platform_it_${VERSION}.tar.gz
24+
git checkout tags/${VERSION}
25+
cd platform_it
26+
rm -rf target *.log snappy*.jnilib
27+
cd ..
28+
29+
./start-splice-cluster $*
30+
31+
rm -rf upgrade_test_TMP
32+
mkdir -p upgrade_test_TMP/platform_it/target
33+
cd upgrade_test_TMP
34+
cp -r ../platform_it/target/hbase platform_it/target/.
35+
cp -r ../platform_it/target/zookeeper platform_it/target/.
36+
tar -czvf ../platform_it_${VERSION}.tar.gz platform_it
37+
cd ..
38+
rm -rf upgrade_test_TMP
39+
40+
if [[ $MODE == "upload" ]]; then
41+
aws s3 cp platform_it_${VERSION}.tar.gz ${UPGRADE_URL}/platform_it_${VERSION}.tar.gz
42+
fi
43+
44+
git checkout ${PREVIOUS_BRANCH}
45+
git stash pop

start-splice-cluster

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,24 @@ function is_port_open
6464
}
6565

6666
##################################################################################
67-
# print message ${1} and wait until port {2} is open
67+
# print message ${1} and wait until port {2} is open, for max {3}*2 seconds
6868
##################################################################################
6969
function _wait_for_port
7070
{
7171
msg=${1}
7272
port=${2}
73+
wait_max=${3}
7374
echo -n ${msg}
7475
echo -n " "
7576
counter=0
7677
until is_port_open localhost ${port}; do
7778
echo -n "${counter} - "
7879
counter=$((counter+1))
80+
81+
if [ ${counter} -ge ${wait_max} ]; then
82+
echo "Waited too long, aborting."
83+
exit 2
84+
fi
7985
sleep 2
8086
done
8187
echo "done!"
@@ -175,7 +181,7 @@ function _start_region_servers {
175181
function _wait_for_region_servers {
176182
if [[ ${MEMBERS} -gt 0 ]]; then
177183
for (( MEMBER=1; MEMBER<${MEMBERS}; MEMBER++ )); do
178-
_wait_for_port "Waiting for Region Server $(($MEMBER +1)) to be ready ..." $(( 1527 + ${MEMBER} ))
184+
_wait_for_port "Waiting for Region Server $(($MEMBER +1)) to be ready ..." $(( 1527 + ${MEMBER} )) 60
179185
done
180186
fi
181187
}
@@ -198,7 +204,27 @@ function _start_master {
198204
}
199205

200206
function _wait_for_master {
201-
_wait_for_port "Waiting for Master to be ready ..." 1527
207+
208+
msg="Waiting for Master to be ready ..."
209+
port=1527
210+
wait_max=60
211+
echo -n ${msg}
212+
echo -n " "
213+
counter=0
214+
until is_port_open localhost ${port}; do
215+
echo -n "${counter} - "
216+
counter=$((counter+1))
217+
if [ ${counter} -ge ${wait_max} ]; then
218+
echo "Waited too long, aborting."
219+
exit 2
220+
fi
221+
if cat ${SPLICE_LOG} | grep "[ERROR] Failed to execute goal" ; then
222+
echo "ERROR: Spliceengine couldn't start."
223+
exit 2
224+
fi
225+
sleep 2
226+
done
227+
echo "done!"
202228

203229
}
204230

@@ -234,7 +260,7 @@ function _start_mem
234260

235261
function _wait_for_mem
236262
{
237-
_wait_for_port "Waiting until Mem Platform is ready ..." 1527
263+
_wait_for_port "Waiting until Mem Platform is ready ..." 1527 20
238264
}
239265

240266
export -f _kill_em_all

0 commit comments

Comments
 (0)