HBASE-14462 rolling_restart.sh --master-only throws "line 142: test: 0: unary operator expected" (Samir Ahmic)

This commit is contained in:
tedyu 2015-12-01 10:28:56 -08:00
parent 3534e1ffef
commit ed4e00119e
1 changed files with 23 additions and 11 deletions

View File

@ -116,6 +116,7 @@ else
if [ "$zmaster" == "null" ]; then zmaster="master"; fi if [ "$zmaster" == "null" ]; then zmaster="master"; fi
zmaster=$zparent/$zmaster zmaster=$zparent/$zmaster
echo -n "Waiting for Master ZNode ${zmaster} to expire" echo -n "Waiting for Master ZNode ${zmaster} to expire"
echo
while ! "$bin"/hbase zkcli stat $zmaster 2>&1 | grep "Node does not exist"; do while ! "$bin"/hbase zkcli stat $zmaster 2>&1 | grep "Node does not exist"; do
echo -n "." echo -n "."
sleep 1 sleep 1
@ -136,11 +137,21 @@ else
zunassigned=`$bin/hbase org.apache.hadoop.hbase.util.HBaseConfTool zookeeper.znode.unassigned` zunassigned=`$bin/hbase org.apache.hadoop.hbase.util.HBaseConfTool zookeeper.znode.unassigned`
if [ "$zunassigned" == "null" ]; then zunassigned="region-in-transition"; fi if [ "$zunassigned" == "null" ]; then zunassigned="region-in-transition"; fi
zunassigned="$zparent/$zunassigned" zunassigned="$zparent/$zunassigned"
# Checking if /hbase/region-in-transition exist
ritZnodeCheck=`$bin/hbase zkcli stat ${zunassigned} 2>&1 | tail -1 \
| grep "Node does not exist:" >/dev/null`
ret=$?
if test 0 -eq ${ret}
then
echo "Znode ${zunassigned} does not exist"
else
echo -n "Waiting for ${zunassigned} to empty" echo -n "Waiting for ${zunassigned} to empty"
while true ; do while true ; do
unassigned=`$bin/hbase zkcli stat ${zunassigned} 2>&1 |grep -e 'numChildren = '|sed -e 's,numChildren = ,,'` unassigned=`$bin/hbase zkcli stat ${zunassigned} 2>&1 \
| grep -e 'numChildren = '|sed -e 's,numChildren = ,,'`
if test 0 -eq ${unassigned} if test 0 -eq ${unassigned}
then then
echo
break break
else else
echo -n " ${unassigned}" echo -n " ${unassigned}"
@ -148,6 +159,7 @@ else
sleep 1 sleep 1
done done
fi fi
fi
if [ $RR_RS -eq 1 ]; then if [ $RR_RS -eq 1 ]; then
# unlike the masters, roll all regionservers one-at-a-time # unlike the masters, roll all regionservers one-at-a-time