@@ -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# #################################################################################
6969function _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 {
175181function _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}
@@ -201,14 +207,19 @@ function _wait_for_master {
201207
202208 msg=" Waiting for Master to be ready ..."
203209 port=1527
210+ wait_max=60
204211 echo -n ${msg}
205212 echo -n " "
206213 counter=0
207214 until is_port_open localhost ${port} ; do
208215 echo -n " ${counter} - "
209216 counter=$(( counter+ 1 ))
210- if cat ${SPLICE_LOG} | grep " java.lang.RuntimeException: The timestamp source has been closed" ; then
211- echo " ERROR: timestamp source has been closed"
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."
212223 exit 2
213224 fi
214225 sleep 2
@@ -249,7 +260,7 @@ function _start_mem
249260
250261function _wait_for_mem
251262{
252- _wait_for_port " Waiting until Mem Platform is ready ..." 1527
263+ _wait_for_port " Waiting until Mem Platform is ready ..." 1527 20
253264}
254265
255266export -f _kill_em_all
0 commit comments