未验证 提交 879ae0da 编写于 作者: Q QinZuoyan 提交者: GitHub

scripts: not start collector in onebox by default; not exit -1 but exit 0 when...

scripts: not start collector in onebox by default; not exit -1 but exit 0 when test fail; update rdsn (#72)
上级 08548f79
Subproject commit 14d8ba6e0c444cf4694631b70d3087a1ddda213e
Subproject commit afc240e48d040e907ef06ea95b23d56cb98554c8
......@@ -119,7 +119,7 @@ function run_build()
echo "ERROR: unknown option \"$key\""
echo
usage_build
exit -1
exit 1
;;
esac
shift
......@@ -128,12 +128,12 @@ function run_build()
echo "ERROR: invalid build type \"$BUILD_TYPE\""
echo
usage_build
exit -1
exit 1
fi
if [ ! -d $ROOT/rdsn/include ]; then
echo "ERROR: rdsn submodule not fetched"
exit -1
exit 1
fi
export DSN_ROOT=$ROOT/rdsn/builder/output
......@@ -156,7 +156,7 @@ function run_build()
./run.sh build $OPT
if [ $? -ne 0 ]; then
echo "ERROR: build rdsn failed"
exit -1
exit 1
fi
echo "INFO: start build pegasus..."
......@@ -166,7 +166,7 @@ function run_build()
RUN_VERBOSE="$RUN_VERBOSE" TEST_MODULE="$TEST_MODULE" ./build.sh
if [ $? -ne 0 ]; then
echo "ERROR: build pegasus failed"
exit -1
exit 1
fi
cd $ROOT
......@@ -205,7 +205,7 @@ function run_test()
echo "Error: unknow option \"$key\""
echo
usage_test
exit -1
exit 1
;;
esac
shift
......@@ -225,7 +225,7 @@ function run_test()
REPORT_DIR=$REPORT_DIR ./run.sh
if [ $? != 0 ]; then
echo "run test \"$module\" in `pwd` failed"
exit
exit 1
fi
popd
done
......@@ -254,13 +254,13 @@ function run_start_zk()
java -help 1>/dev/null 2>/dev/null
if [ $? != 0 ]; then
echo "start zk failed, need install jre..."
exit
exit 1
fi
# check nc command
nc -help 1>/dev/null 2>/dev/null
if [ $? != 0 ]; then
echo "start zk failed, need install netcat command..."
exit
exit 1
fi
INSTALL_DIR=`pwd`/.zk_install
PORT=22181
......@@ -283,7 +283,7 @@ function run_start_zk()
echo "ERROR: unknown option \"$key\""
echo
usage_start_zk
exit -1
exit 1
;;
esac
shift
......@@ -320,7 +320,7 @@ function run_stop_zk()
echo "ERROR: unknown option \"$key\""
echo
usage_stop_zk
exit -1
exit 1
;;
esac
shift
......@@ -357,7 +357,7 @@ function run_clear_zk()
echo "ERROR: unknown option \"$key\""
echo
usage_clear__zk
exit -1
exit 1
;;
esac
shift
......@@ -376,6 +376,8 @@ function usage_start_onebox()
echo " meta server count, default is 3"
echo " -r|--replica_count <num>"
echo " replica server count, default is 3"
echo " -c|--collector"
echo " start the collector server, default not start"
echo " -a|--app_name <str>"
echo " default app name, default is temp"
echo " -p|--partition_count <num>"
......@@ -390,6 +392,7 @@ function run_start_onebox()
{
META_COUNT=3
REPLICA_COUNT=3
COLLECTOR_COUNT=0
APP_NAME=temp
PARTITION_COUNT=8
SERVER_PATH=${DSN_ROOT}/bin/pegasus_server
......@@ -409,6 +412,9 @@ function run_start_onebox()
REPLICA_COUNT="$2"
shift
;;
-c|--collector)
COLLECTOR_COUNT=1
;;
-a|--app_name)
APP_NAME="$2"
shift
......@@ -428,18 +434,18 @@ function run_start_onebox()
echo "ERROR: unknown option \"$key\""
echo
usage_start_onebox
exit -1
exit 1
;;
esac
shift
done
if [ ! -f ${SERVER_PATH}/pegasus_server ]; then
echo "ERROR: file ${SERVER_PATH}/pegasus_server not exist"
exit -1
exit 1
fi
if ps -ef | grep ' /pegasus_server config.ini' | grep -E 'app_list meta|app_list replica|app_list collector'; then
if ps -ef | grep '/pegasus_server config.ini' | grep -E -q 'app_list meta|app_list replica|app_list collector'; then
echo "ERROR: some onebox processes are running, start failed"
exit -1
exit 1
fi
ln -s -f ${SERVER_PATH}/pegasus_server
run_start_zk
......@@ -504,15 +510,18 @@ function run_start_onebox()
ps -ef | grep '/pegasus_server config.ini' | grep "\<$PID\>"
cd ..
done
mkdir -p collector
cd collector
ln -s -f ${SERVER_PATH}/pegasus_server pegasus_server
sed "s/@META_PORT@/34600/;s/@REPLICA_PORT@/34800/" ${ROOT}/config-server.ini >config.ini
echo "cd `pwd` && $PWD/pegasus_server config.ini -app_list collector &>result &"
$PWD/pegasus_server config.ini -app_list collector &>result &
PID=$!
ps -ef | grep '/pegasus_server config.ini' | grep "\<$PID\>"
cd ..
if [ $COLLECTOR_COUNT -eq 1 ]
then
mkdir -p collector
cd collector
ln -s -f ${SERVER_PATH}/pegasus_server pegasus_server
sed "s/@META_PORT@/34600/;s/@REPLICA_PORT@/34800/" ${ROOT}/config-server.ini >config.ini
echo "cd `pwd` && $PWD/pegasus_server config.ini -app_list collector &>result &"
$PWD/pegasus_server config.ini -app_list collector &>result &
PID=$!
ps -ef | grep '/pegasus_server config.ini' | grep "\<$PID\>"
cd ..
fi
}
#####################
......@@ -537,7 +546,7 @@ function run_stop_onebox()
echo "ERROR: unknown option \"$key\""
echo
usage_stop_onebox
exit -1
exit 1
;;
esac
shift
......@@ -567,7 +576,7 @@ function run_list_onebox()
echo "ERROR: unknown option \"$key\""
echo
usage_list_onebox
exit -1
exit 1
;;
esac
shift
......@@ -597,7 +606,7 @@ function run_clear_onebox()
echo "ERROR: unknown option \"$key\""
echo
usage_clear_onebox
exit -1
exit 1
;;
esac
shift
......@@ -646,24 +655,24 @@ function run_start_onebox_instance()
echo "ERROR: unknown option \"$key\""
echo
usage_start_onebox_instance
exit -1
exit 1
;;
esac
shift
done
if [ $META_ID = "0" -a $REPLICA_ID = "0" -a $COLLECTOR_ID = "0" ]; then
echo "ERROR: no meta_id or replica_id or collector set"
exit -1
exit 1
fi
if [ $META_ID != "0" ]; then
dir=onebox/meta$META_ID
if [ ! -d $dir ]; then
echo "ERROR: invalid meta_id"
exit -1
exit 1
fi
if ps -ef | grep "/meta$META_ID/pegasus_server config.ini" | grep "app_list meta" ; then
echo "INFO: meta@$META_ID already running"
exit -1
exit 1
fi
cd $dir
echo "cd `pwd` && $PWD/pegasus_server config.ini -app_list meta &>result &"
......@@ -677,11 +686,11 @@ function run_start_onebox_instance()
dir=onebox/replica$REPLICA_ID
if [ ! -d $dir ]; then
echo "ERROR: invalid replica_id"
exit -1
exit 1
fi
if ps -ef | grep "/replica$REPLICA_ID/pegasus_server config.ini" | grep "app_list replica" ; then
echo "INFO: replica@$REPLICA_ID already running"
exit -1
exit 1
fi
cd $dir
echo "cd `pwd` && $PWD/pegasus_server config.ini -app_list replica &>result &"
......@@ -695,11 +704,11 @@ function run_start_onebox_instance()
dir=onebox/collector
if [ ! -d $dir ]; then
echo "ERROR: collector dir $dir not exist"
exit -1
exit 1
fi
if ps -ef | grep "/collector/pegasus_server config.ini" | grep "app_list collector" ; then
echo "INFO: collector already running"
exit -1
exit 1
fi
cd $dir
echo "cd `pwd` && $PWD/pegasus_server config.ini -app_list collector &>result &"
......@@ -750,24 +759,24 @@ function run_stop_onebox_instance()
echo "ERROR: unknown option \"$key\""
echo
usage_stop_onebox_instance
exit -1
exit 1
;;
esac
shift
done
if [ $META_ID = "0" -a $REPLICA_ID = "0" -a $COLLECTOR_ID = "0" ]; then
echo "ERROR: no meta_id or replica_id or collector set"
exit -1
exit 1
fi
if [ $META_ID != "0" ]; then
dir=onebox/meta$META_ID
if [ ! -d $dir ]; then
echo "ERROR: invalid meta_id"
exit -1
exit 1
fi
if ! ps -ef | grep "/meta$META_ID/pegasus_server config.ini" | grep "app_list meta" ; then
echo "INFO: meta@$META_ID is not running"
exit -1
exit 1
fi
ps -ef | grep "/meta$META_ID/pegasus_server config.ini" | grep "app_list meta" | awk '{print $2}' | xargs kill &>/dev/null
echo "INFO: meta@$META_ID stopped"
......@@ -776,11 +785,11 @@ function run_stop_onebox_instance()
dir=onebox/replica$REPLICA_ID
if [ ! -d $dir ]; then
echo "ERROR: invalid replica_id"
exit -1
exit 1
fi
if ! ps -ef | grep "/replica$REPLICA_ID/pegasus_server config.ini" | grep "app_list replica" ; then
echo "INFO: replica@$REPLICA_ID is not running"
exit -1
exit 1
fi
ps -ef | grep "/replica$REPLICA_ID/pegasus_server config.ini" | grep "app_list replica" | awk '{print $2}' | xargs kill &>/dev/null
echo "INFO: replica@$REPLICA_ID stopped"
......@@ -788,7 +797,7 @@ function run_stop_onebox_instance()
if [ $COLLECTOR_ID != "0" ]; then
if ! ps -ef | grep "/collector/pegasus_server config.ini" | grep "app_list collector" ; then
echo "INFO: collector is not running"
exit -1
exit 1
fi
ps -ef | grep "/collector/pegasus_server config.ini" | grep "app_list collector" | awk '{print $2}' | xargs kill &>/dev/null
echo "INFO: collector stopped"
......@@ -841,14 +850,14 @@ function run_restart_onebox_instance()
echo "ERROR: unknown option \"$key\""
echo
usage_restart_onebox_instance
exit -1
exit 1
;;
esac
shift
done
if [ $META_ID = "0" -a $REPLICA_ID = "0" -a "x$COLLECTOR_OPT" = "x" ]; then
echo "ERROR: no meta_id or replica_id or collector set"
exit -1
exit 1
fi
run_stop_onebox_instance -m $META_ID -r $REPLICA_ID $COLLECTOR_OPT
echo "sleep $SLEEP"
......@@ -935,7 +944,7 @@ function run_start_kill_test()
echo "ERROR: unknown option \"$key\""
echo
usage_start_kill_test
exit -1
exit 1
;;
esac
shift
......@@ -1000,7 +1009,7 @@ function run_stop_kill_test()
echo "ERROR: unknown option \"$key\""
echo
usage_stop_kill_test
exit -1
exit 1
;;
esac
shift
......@@ -1032,7 +1041,7 @@ function run_list_kill_test()
echo "ERROR: unknown option \"$key\""
echo
usage_list_kill_test
exit -1
exit 1
;;
esac
shift
......@@ -1067,7 +1076,7 @@ function run_clear_kill_test()
echo "ERROR: unknown option \"$key\""
echo
usage_clear_kill_test
exit -1
exit 1
;;
esac
shift
......@@ -1163,7 +1172,7 @@ function run_start_upgrade_test()
echo "ERROR: unknown option \"$key\""
echo
usage_start_upgrade_test
exit -1
exit 1
;;
esac
shift
......@@ -1230,7 +1239,7 @@ function run_stop_upgrade_test()
echo "ERROR: unknown option \"$key\""
echo
usage_stop_upgrade_test
exit -1
exit 1
;;
esac
shift
......@@ -1262,7 +1271,7 @@ function run_list_upgrade_test()
echo "ERROR: unknown option \"$key\""
echo
usage_list_upgrade_test
exit -1
exit 1
;;
esac
shift
......@@ -1297,7 +1306,7 @@ function run_clear_upgrade_test()
echo "ERROR: unknown option \"$key\""
echo
usage_clear_upgrade_test
exit -1
exit 1
;;
esac
shift
......@@ -1388,7 +1397,7 @@ function run_bench()
echo "ERROR: unknown option \"$key\""
echo
usage_bench
exit -1
exit 1
;;
esac
shift
......@@ -1454,7 +1463,7 @@ function run_shell()
echo "ERROR: unknown option \"$key\""
echo
usage_shell
exit -1
exit 1
;;
esac
shift
......@@ -1464,7 +1473,7 @@ function run_shell()
echo "ERROR: can not specify both cluster and cluster_name at the same time"
echo
usage_shell
exit -1
exit 1
fi
if [ ${CLUSTER_SPECIFIED} -eq 1 ]; then
......@@ -1555,7 +1564,7 @@ function run_migrate_node()
echo "ERROR: unknown option \"$key\""
echo
usage_migrate_node
exit -1
exit 1
;;
esac
shift
......@@ -1565,21 +1574,21 @@ function run_migrate_node()
echo "ERROR: no cluster specified"
echo
usage_migrate_node
exit -1
exit 1
fi
if [ "$NODE" == "" ]; then
echo "ERROR: no node specified"
echo
usage_migrate_node
exit -1
exit 1
fi
if [ "$TYPE" != "test" -a "$TYPE" != "run" ]; then
echo "ERROR: invalid type $TYPE"
echo
usage_migrate_node
exit -1
exit 1
fi
echo "CLUSTER=$CLUSTER"
......@@ -1649,7 +1658,7 @@ function run_downgrade_node()
echo "ERROR: unknown option \"$key\""
echo
usage_downgrade_node
exit -1
exit 1
;;
esac
shift
......@@ -1659,21 +1668,21 @@ function run_downgrade_node()
echo "ERROR: no cluster specified"
echo
usage_downgrade_node
exit -1
exit 1
fi
if [ "$NODE" == "" ]; then
echo "ERROR: no node specified"
echo
usage_downgrade_node
exit -1
exit 1
fi
if [ "$TYPE" != "test" -a "$TYPE" != "run" ]; then
echo "ERROR: invalid type $TYPE"
echo
usage_downgrade_node
exit -1
exit 1
fi
echo "CLUSTER=$CLUSTER"
......@@ -1824,6 +1833,6 @@ case $cmd in
echo "ERROR: unknown command $cmd"
echo
usage
exit -1
exit 1
esac
......@@ -2,7 +2,7 @@
if [ $# -ne 1 ]; then
echo "USAGE: $0 <version>"
exit -1
exit 1
fi
pwd="$( cd "$( dirname "$0" )" && pwd )"
......
......@@ -6,7 +6,7 @@
if [ -z "$INSTALL_DIR" ]
then
echo "ERROR: no INSTALL_DIR specified"
exit -1
exit 1
fi
cd $INSTALL_DIR
......
......@@ -7,7 +7,7 @@ then
echo "This tool is for downgrading replicas of specified node."
echo "USAGE: $0 <cluster-meta-list> <node> <app-name> <run|test>"
echo " app-name = * means migrate all apps"
exit -1
exit 1
fi
pwd="$( cd "$( dirname "$0" )" && pwd )"
......@@ -23,7 +23,7 @@ if [ "$type" != "run" -a "$type" != "test" ]
then
echo "ERROR: invalid type: $type"
echo "USAGE: $0 <cluster-meta-list> <node> <app-name> <run|test>"
exit -1
exit 1
fi
echo "UID=$UID"
......@@ -58,17 +58,17 @@ do
if [ "$pri" = "" ]
then
echo "ERROR: can't downgrade ${gid}.${pid} because it is unhealthy"
exit -1
exit 1
fi
if [ "$pri" = "$node" ]
then
echo "ERROR: can't downgrade ${gid}.${pid} because $node is primary"
exit -1
exit 1
fi
if echo $sec | grep -v -q ','
then
echo "ERROR: can't downgrade ${gid}.${pid} because it is unhealthy"
exit -1
exit 1
fi
echo "propose --gpid ${gid}.${pid} --type DOWNGRADE_TO_INACTIVE -t $pri -n $node"
fi
......
......@@ -7,7 +7,7 @@ then
echo "This tool is for migrating primary replicas out of specified node."
echo "USAGE: $0 <cluster-meta-list> <migrate-node> <app-name> <run|test>"
echo " app-name = * means migrate all apps"
exit -1
exit 1
fi
pwd="$( cd "$( dirname "$0" )" && pwd )"
......@@ -23,7 +23,7 @@ if [ "$type" != "run" -a "$type" != "test" ]
then
echo "ERROR: invalid type: $type"
echo "USAGE: $0 <cluster-meta-list> <migrate-node> <app-name> <run|test>"
exit -1
exit 1
fi
echo "UID=$UID"
......
......@@ -19,19 +19,19 @@ cd $shell_dir
if [ ! -f src/include/pegasus/git_commit.h ]
then
echo "ERROR: src/include/pegasus/git_commit.h not found"
exit -1
exit 1
fi
if [ ! -f DSN_ROOT/bin/pegasus_server/pegasus_server ]
then
echo "ERROR: DSN_ROOT/bin/pegasus_server/pegasus_server not found"
exit -1
exit 1
fi
if [ ! -f src/builder/CMAKE_OPTIONS ]
then
echo "ERROR: src/builder/CMAKE_OPTIONS not found"
exit -1
exit 1
fi
if grep -q Debug src/builder/CMAKE_OPTIONS
......
......@@ -19,19 +19,19 @@ cd $shell_dir
if [ ! -f src/include/pegasus/git_commit.h ]
then
echo "ERROR: src/include/pegasus/git_commit.h not found"
exit -1
exit 1
fi
if [ ! -f DSN_ROOT/bin/pegasus_server/pegasus_server ]
then
echo "ERROR: DSN_ROOT/bin/pegasus_server/pegasus_server not found"
exit -1
exit 1
fi
if [ ! -f src/builder/CMAKE_OPTIONS ]
then
echo "ERROR: src/builder/CMAKE_OPTIONS not found"
exit -1
exit 1
fi
if grep -q Debug src/builder/CMAKE_OPTIONS
......
......@@ -19,19 +19,19 @@ cd $shell_dir
if [ ! -f src/include/pegasus/git_commit.h ]
then
echo "ERROR: src/include/pegasus/git_commit.h not found"
exit -1
exit 1
fi
if [ ! -f DSN_ROOT/bin/pegasus_shell/pegasus_shell ]
then
echo "ERROR: DSN_ROOT/bin/pegasus_shell/pegasus_shell not found"
exit -1
exit 1
fi
if [ ! -f src/builder/CMAKE_OPTIONS ]
then
echo "ERROR: src/builder/CMAKE_OPTIONS not found"
exit -1
exit 1
fi
if grep -q Debug src/builder/CMAKE_OPTIONS
......
......@@ -4,7 +4,7 @@ if [ $# -ne 5 ]
then
echo "USAGE: $0 <meta-count> <replica-count> <app-name> <kill-type> <sleep-time>"
echo " kill-type: meta | replica | all"
exit -1
exit 1
fi
META_COUNT=$1
REPLICA_COUNT=$2
......@@ -14,7 +14,7 @@ SLEEP_TIME=$5
if [ "$KILL_TYPE" != "meta" -a "$KILL_TYPE" != "replica" -a "$KILL_TYPE" != "all" ]
then
echo "ERROR: invalid kill-type, should be: meta | replica | all"
exit -1
exit 1
fi
function stop_kill_test() {
......@@ -23,7 +23,7 @@ function stop_kill_test() {
echo "---------------------------"
ps -ef | grep pegasus_kill_test | grep -v grep | awk '{print $2}' | xargs kill
./run.sh stop_onebox
exit -1
exit 1
}
pwd="$( cd "$( dirname "$0" )" && pwd )"
......
......@@ -57,7 +57,7 @@ function get_env()
get_ok=`grep 'get app envs succeed' ${log_file} | wc -l`
if [ ${get_ok} -ne 1 ]; then
echo "ERROR: get app envs failed, refer to ${log_file}"
exit -1
exit 1
fi
grep "^${key} =" ${log_file} | awk '{print $3}'
}
......@@ -76,7 +76,7 @@ function set_env()
set_ok=`grep 'set app envs succeed' ${log_file} | wc -l`
if [ ${set_ok} -ne 1 ]; then
echo "ERROR: set app envs failed, refer to ${log_file}"
exit -1
exit 1
fi
}
......@@ -195,38 +195,38 @@ cd ${shell_dir}
# check cluster
if [ "${cluster}" == "" ]; then
echo "ERROR: invalid cluster: ${cluster}"
exit -1
exit 1
fi
# check app_name
if [ "${app_name}" == "" ]; then
echo "ERROR: invalid app_name: ${app_name}"
exit -1
exit 1
fi
# check type
if [ "${type}" != "periodic" -a "${type}" != "once" ]; then
echo "ERROR: invalid type: ${type}"
exit -1
exit 1
fi
# check wait_only
if [ "${wait_only}" == "true" -a "${type}" != "once" ]; then
echo "ERROR: can not specify wait_only when type is ${type}"
exit -1
exit 1
fi
# check trigger_time
if [ "${type}" == "once" ]; then
if [ "${trigger_time}" != "" ]; then
echo "ERROR: can not specify trigger_time when type is ${type}"
exit -1
exit 1
fi
if [ "${wait_only}" == "true" ]; then
trigger_time=`get_env ${cluster} ${app_name} "manual_compact.once.trigger_time"`
if [ "${trigger_time}" == "" ]; then
echo "No once compact triggered previously, nothing to wait"
exit -1
exit 1
fi
else
trigger_time=`date +%s`
......@@ -234,7 +234,7 @@ if [ "${type}" == "once" ]; then
else # type == periodic
if [ "${trigger_time}" == "" ]; then
echo "ERROR: should specify trigger_time when type is ${type}"
exit -1
exit 1
fi
fi
......@@ -242,17 +242,17 @@ fi
expr ${target_level} + 0 &>/dev/null
if [ $? -ne 0 ]; then
echo "ERROR: invalid target_level: ${target_level}"
exit -1
exit 1
fi
if [ ${target_level} -lt -1 ]; then
echo "ERROR: invalid target_level: ${target_level}"
exit -1
exit 1
fi
# check bottommost_level_compaction
if [ "${bottommost_level_compaction}" != "skip" -a "${bottommost_level_compaction}" != "force" ]; then
echo "ERROR: invalid bottommost_level_compaction: ${bottommost_level_compaction}"
exit -1
exit 1
fi
# record start time
......@@ -286,7 +286,7 @@ fi
disabled=`get_env ${cluster} ${app_name} "manual_compact.disabled"`
if [ "${disabled}" == "true" ]; then
echo "Manual compact is disabled, not to wait"
exit -1
exit 1
fi
ls_log_file="/tmp/$UID.$PID.pegasus.ls"
......@@ -306,7 +306,7 @@ do
if [ "$status" != "AVAILABLE" ]; then
echo "app ${app_name} is not available now, try to query result later"
exit -1
exit 1
fi
wait_manual_compact ${app_id} ${trigger_time} $(($partition_count*$replica_count))
......
......@@ -11,7 +11,7 @@ if [ $# -le 2 ]; then
echo "For example:"
echo " $0 onebox 127.0.0.1:34601,127.0.0.1:34602 127.0.0.1:2181"
echo
exit -1
exit 1
fi
cluster=$1
......@@ -27,28 +27,28 @@ cd $shell_dir
minos_config=$minos_config_dir/pegasus-${cluster}.cfg
if [ ! -f $minos_config ]; then
echo "ERROR: minos config \"$minos_config\" not found"
exit -1
exit 1
fi
minos_client=$minos_client_dir/deploy
if [ ! -f $minos_client ]; then
echo "ERROR: minos client \"$minos_client\" not found"
exit -1
exit 1
fi
if [ `cat $minos_config | grep " recover_from_replica_server = " | wc -l` -ne 1 ] ; then
echo "ERROR: no [recover_from_replica_server] entry in minos config \"$minos_config\""
exit -1
exit 1
fi
if [ `cat $minos_config | grep " hosts_list = " | wc -l` -ne 1 ] ; then
echo "ERROR: no [hosts_list] entry in minos config \"$minos_config\""
exit -1
exit 1
fi
low_version_count=`echo server_info | ./run.sh shell --cluster $meta_list 2>&1 | grep 'Pegasus Server' | grep -v 'Pegasus Server 1.5' | wc -l`
if [ $low_version_count -gt 0 ]; then
echo "ERROR: cluster should upgrade to v1.5.0"
exit -1
exit 1
fi
echo "UID=$UID"
......@@ -59,7 +59,7 @@ echo ">>>> Backuping app list..."
echo "ls -o ${cluster}.apps" | ./run.sh shell --cluster $meta_list &>/dev/null
if [ `cat ${cluster}.apps | wc -l` -eq 0 ]; then
echo "ERROR: backup app list failed"
exit -1
exit 1
fi
cat ${cluster}.apps
......@@ -67,16 +67,16 @@ echo ">>>> Backuping node list..."
echo "nodes -d -o ${cluster}.nodes" | ./run.sh shell --cluster $meta_list &>/dev/null
if [ `cat ${cluster}.nodes | wc -l` -eq 0 ]; then
echo "ERROR: backup node list failed"
exit -1
exit 1
fi
if [ `grep UNALIVE ${cluster}.nodes | wc -l` -gt 0 ]; then
echo "ERROR: unalive nodes found in \"${cluster}.nodes\""
exit -1
exit 1
fi
cat ${cluster}.nodes | grep " ALIVE" | awk '{print $1}' >${cluster}.recover.nodes
if [ `cat ${cluster}.recover.nodes | wc -l` -eq 0 ]; then
echo "ERROR: no node found in \"${cluster}.recover.nodes\""
exit -1
exit 1
fi
echo ">>>> Generating recover config..."
......@@ -118,7 +118,7 @@ echo ">>>> Rolling update meta-server task 0..."
rolling_update_meta 0
if [ $? -ne 0 ]; then
undo
exit -1
exit 1
fi
echo ">>>> Sending recover command..."
......@@ -138,7 +138,7 @@ do
echo "nodes -d -o /tmp/$UID.$PID.pegasus.migrate_zookeeper.shell.nodes" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.migrate_zookeeper.shell.nodes.log
if [ `cat /tmp/$UID.$PID.pegasus.migrate_zookeeper.shell.nodes | wc -l` -eq 0 ]; then
echo "ERROR: get node list failed, refer to /tmp/$UID.$PID.pegasus.migrate_zookeeper.shell.nodes.log"
exit -1
exit 1
fi
awk '{print $1,$2,$3}' /tmp/$UID.$PID.pegasus.migrate_zookeeper.shell.nodes >/tmp/$UID.$PID.pegasus.migrate_zookeeper.diff.new
diff /tmp/$UID.$PID.pegasus.migrate_zookeeper.diff.old /tmp/$UID.$PID.pegasus.migrate_zookeeper.diff.new &>/tmp/$UID.$PID.pegasus.migrate_zookeeper.diff
......@@ -154,13 +154,13 @@ sed -i "s/ recover_from_replica_server = .*/ recover_from_replica_server = false
echo ">>>> Rolling update meta-server task 1..."
rolling_update_meta 1
if [ $? -ne 0 ]; then
exit -1
exit 1
fi
echo ">>>> Rolling update meta-server task 0..."
rolling_update_meta 0
if [ $? -ne 0 ]; then
exit -1
exit 1
fi
echo ">>>> Querying cluster info..."
......
......@@ -11,7 +11,7 @@ if [ $# -le 2 ]; then
echo "For example:"
echo " $0 onebox 127.0.0.1:34601,127.0.0.1:34602 0"
echo
exit -1
exit 1
fi
cluster=$1
......@@ -27,13 +27,13 @@ cd $shell_dir
minos_config=$minos_config_dir/pegasus-${cluster}.cfg
if [ ! -f $minos_config ]; then
echo "ERROR: minos config \"$minos_config\" not found"
exit -1
exit 1
fi
minos_client=$minos_client_dir/deploy
if [ ! -f $minos_client ]; then
echo "ERROR: minos client \"$minos_client\" not found"
exit -1
exit 1
fi
echo "UID=$UID"
......@@ -51,7 +51,7 @@ grep 'Showing task [0-9][0-9]* of replica' /tmp/$UID.$PID.pegasus.offline_node.m
replica_server_count=`cat /tmp/$UID.$PID.pegasus.offline_node.rs.list | wc -l`
if [ $replica_server_count -eq 0 ]; then
echo "ERROR: replica server count is 0 by minos show"
exit -1
exit 1
fi
cd $shell_dir
......@@ -60,12 +60,12 @@ echo cluster_info | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus
cname=`grep zookeeper_root /tmp/$UID.$PID.pegasus.offline_node.cluster_info | grep -o '/[^/]*$' | grep -o '[^/]*$'`
if [ "$cname" != "$cluster" ]; then
echo "ERROR: cluster name and meta list not matched"
exit -1
exit 1
fi
pmeta=`grep primary_meta_server /tmp/$UID.$PID.pegasus.offline_node.cluster_info | grep -o '[0-9.:]*$'`
if [ "$pmeta" == "" ]; then
echo "ERROR: extract primary_meta_server by shell failed"
exit -1
exit 1
fi
echo "Generating /tmp/$UID.$PID.pegasus.offline_node.nodes..."
......@@ -73,7 +73,7 @@ echo nodes | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.offlin
rs_port=`grep '^[0-9.]*:' /tmp/$UID.$PID.pegasus.offline_node.nodes | head -n 1 | grep -o ':[0-9]*' | grep -o '[0-9]*'`
if [ "$rs_port" == "" ]; then
echo "ERROR: extract replica server port by shell failed"
exit -1
exit 1
fi
echo "Set meta level to steady..."
......@@ -81,7 +81,7 @@ echo "set_meta_level steady" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$
set_ok=`grep 'control meta level ok' /tmp/$UID.$PID.pegasus.offline_node.set_meta_level | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set meta level to steady failed"
exit -1
exit 1
fi
echo "Set lb.assign_delay_ms to 10..."
......@@ -89,7 +89,7 @@ echo "remote_command -l $pmeta meta.lb.assign_delay_ms 10" | ./run.sh shell --cl
set_ok=`grep OK /tmp/$UID.$PID.pegasus.offline_node.assign_delay_ms | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set lb.assign_delay_ms to 10 failed"
exit -1
exit 1
fi
echo
......@@ -189,7 +189,7 @@ echo "remote_command -l $pmeta meta.lb.assign_delay_ms DEFAULT" | ./run.sh shell
set_ok=`grep OK /tmp/$UID.$PID.pegasus.offline_node.assign_delay_ms | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set lb.assign_delay_ms to DEFAULT failed"
exit -1
exit 1
fi
echo
......
......@@ -11,7 +11,7 @@ if [ $# -le 2 ]; then
echo "For example:"
echo " $0 onebox 127.0.0.1:34601,127.0.0.1:34602 1,2,3"
echo
exit -1
exit 1
fi
cluster=$1
......@@ -27,13 +27,13 @@ cd $shell_dir
minos_config=$minos_config_dir/pegasus-${cluster}.cfg
if [ ! -f $minos_config ]; then
echo "ERROR: minos config \"$minos_config\" not found"
exit -1
exit 1
fi
minos_client=$minos_client_dir/deploy
if [ ! -f $minos_client ]; then
echo "ERROR: minos client \"$minos_client\" not found"
exit -1
exit 1
fi
echo "UID=$UID"
......@@ -51,7 +51,7 @@ grep 'Showing task [0-9][0-9]* of replica' /tmp/$UID.$PID.pegasus.offline_node_l
replica_server_count=`cat /tmp/$UID.$PID.pegasus.offline_node_list.rs.list | wc -l`
if [ $replica_server_count -eq 0 ]; then
echo "ERROR: replica server count is 0 by minos show"
exit -1
exit 1
fi
cd $shell_dir
......@@ -60,12 +60,12 @@ echo cluster_info | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus
cname=`grep zookeeper_root /tmp/$UID.$PID.pegasus.offline_node_list.cluster_info | grep -o '/[^/]*$' | grep -o '[^/]*$'`
if [ "$cname" != "$cluster" ]; then
echo "ERROR: cluster name and meta list not matched"
exit -1
exit 1
fi
pmeta=`grep primary_meta_server /tmp/$UID.$PID.pegasus.offline_node_list.cluster_info | grep -o '[0-9.:]*$'`
if [ "$pmeta" == "" ]; then
echo "ERROR: extract primary_meta_server by shell failed"
exit -1
exit 1
fi
echo "Generating /tmp/$UID.$PID.pegasus.offline_node_list.nodes..."
......@@ -73,7 +73,7 @@ echo nodes | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.offlin
rs_port=`grep '^[0-9.]*:' /tmp/$UID.$PID.pegasus.offline_node_list.nodes | head -n 1 | grep -o ':[0-9]*' | grep -o '[0-9]*'`
if [ "$rs_port" == "" ]; then
echo "ERROR: extract replica server port by shell failed"
exit -1
exit 1
fi
echo "Checking replica task id list..."
......@@ -83,13 +83,13 @@ for id in `echo $replica_task_id_list | sed 's/,/ /g'` ; do
if [ "$id_list" != "" ]; then
if echo "$id_list" | grep -q "\<$id\>" ; then
echo "ERROR: duplicate replica task id $id"
exit -1;
exit 1;
fi
fi
pair=`grep "^$id " /tmp/$UID.$PID.pegasus.offline_node_list.rs.list`
if [ "$pair" == "" ]; then
echo "ERROR: replica task id $id not found, refer to /tmp/$UID.$PID.pegasus.offline_node_list.minos.show"
exit -1;
exit 1;
fi
address=`echo $pair | awk '{print $2}'`
if [ "$id_list" != "" ]; then
......@@ -106,7 +106,7 @@ echo "remote_command -l $pmeta meta.lb.assign_secondary_black_list $address_list
set_ok=`grep "set ok" /tmp/$UID.$PID.pegasus.offline_node_list.assign_secondary_black_list | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set lb.assign_secondary_black_list failed, refer to /tmp/$UID.$PID.pegasus.offline_node_list.assign_secondary_black_list"
exit -1
exit 1
fi
echo
......@@ -116,7 +116,7 @@ do
./scripts/pegasus_offline_node.sh $cluster $meta_list $id
if [ $? -ne 0 ]; then
echo "ERROR: offline replica task $id failed"
exit -1
exit 1
fi
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "sleep for 10 seconds"
......@@ -128,7 +128,7 @@ echo "remote_command -l $pmeta meta.lb.assign_secondary_black_list clear" | ./ru
set_ok=`grep "clear ok" /tmp/$UID.$PID.pegasus.offline_node_list.assign_secondary_black_list | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: clear lb.assign_secondary_black_list failed, refer to /tmp/$UID.$PID.pegasus.offline_node_list.assign_secondary_black_list"
exit -1
exit 1
fi
all_finish_time=$((`date +%s`))
......
......@@ -15,7 +15,7 @@ if [ $# -le 3 ]; then
echo "For example:"
echo " $0 onebox 127.0.0.1:34601,127.0.0.1:34602 one 0"
echo
exit -1
exit 1
fi
update_options="--update_package --update_config"
......@@ -26,7 +26,7 @@ type=$3
start_task_id=$4
if [ "$type" != "one" -a "$type" != "all" ]; then
echo "ERROR: invalid type, should be one or all"
exit -1
exit 1
fi
pwd="$( cd "$( dirname "$0" )" && pwd )"
......@@ -38,13 +38,13 @@ cd $shell_dir
minos_config=$minos_config_dir/pegasus-${cluster}.cfg
if [ ! -f $minos_config ]; then
echo "ERROR: minos config \"$minos_config\" not found"
exit -1
exit 1
fi
minos_client=$minos_client_dir/deploy
if [ ! -f $minos_client ]; then
echo "ERROR: minos client \"$minos_client\" not found"
exit -1
exit 1
fi
echo "UID=$UID"
......@@ -62,7 +62,7 @@ grep 'Showing task [0-9][0-9]* of replica' /tmp/$UID.$PID.pegasus.rolling_update
replica_server_count=`cat /tmp/$UID.$PID.pegasus.rolling_update.rs.list | wc -l`
if [ $replica_server_count -eq 0 ]; then
echo "ERROR: replica server count is 0 by minos show"
exit -1
exit 1
fi
cd $shell_dir
......@@ -71,12 +71,12 @@ echo cluster_info | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus
cname=`grep zookeeper_root /tmp/$UID.$PID.pegasus.rolling_update.cluster_info | grep -o '/[^/]*$' | grep -o '[^/]*$'`
if [ "$cname" != "$cluster" ]; then
echo "ERROR: cluster name and meta list not matched"
exit -1
exit 1
fi
pmeta=`grep primary_meta_server /tmp/$UID.$PID.pegasus.rolling_update.cluster_info | grep -o '[0-9.:]*$'`
if [ "$pmeta" == "" ]; then
echo "ERROR: extract primary_meta_server by shell failed"
exit -1
exit 1
fi
echo "Generating /tmp/$UID.$PID.pegasus.rolling_update.nodes..."
......@@ -84,7 +84,7 @@ echo nodes | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.rollin
rs_port=`grep '^[0-9.]*:' /tmp/$UID.$PID.pegasus.rolling_update.nodes | head -n 1 | grep -o ':[0-9]*' | grep -o '[0-9]*'`
if [ "$rs_port" == "" ]; then
echo "ERROR: extract replica server port by shell failed"
exit -1
exit 1
fi
echo "Set meta level to steady..."
......@@ -92,7 +92,7 @@ echo "set_meta_level steady" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$
set_ok=`grep 'control meta level ok' /tmp/$UID.$PID.pegasus.rolling_update.set_meta_level | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set meta level to steady failed"
exit -1
exit 1
fi
echo
......@@ -122,7 +122,7 @@ do
set_ok=`grep OK /tmp/$UID.$PID.pegasus.rolling_update.add_secondary_max_count_for_one_node | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set lb.add_secondary_max_count_for_one_node to 0 failed"
exit -1
exit 1
fi
echo "Migrating primary replicas out of node..."
......@@ -182,7 +182,7 @@ do
closing_count=`grep -o 'replica_stub.closing.replica(Count)","type":"NUMBER","value":[0-9]*' /tmp/$UID.$PID.pegasus.rolling_update.replica_count_perf_counters | grep -o '[0-9]*$'`
if [ "$serving_count" = "" -o "$opening_count" = "" -o "$closing_count" = "" ]; then
echo "ERROR: extract replica count from perf counters failed"
exit -1
exit 1
fi
rep_count=$((serving_count + opening_count + closing_count))
if [ $rep_count -eq 0 ]; then
......@@ -207,7 +207,7 @@ do
set_ok=`grep OK /tmp/$UID.$PID.pegasus.rolling_update.add_secondary_max_count_for_one_node | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set lb.add_secondary_max_count_for_one_node to 100 failed"
exit -1
exit 1
fi
echo "Rolling update by minos..."
......@@ -261,7 +261,7 @@ echo "remote_command -l $pmeta meta.lb.add_secondary_max_count_for_one_node DEFA
set_ok=`grep OK /tmp/$UID.$PID.pegasus.rolling_update.add_secondary_max_count_for_one_node | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set lb.add_secondary_max_count_for_one_node to DEFAULT failed"
exit -1
exit 1
fi
if [ "$type" = "all" ]; then
......@@ -278,7 +278,7 @@ if [ "$type" = "all" ]; then
set_ok=`grep 'control meta level ok' /tmp/$UID.$PID.pegasus.rolling_update.set_meta_level | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set meta level to lively failed"
exit -1
exit 1
fi
echo
......@@ -291,7 +291,7 @@ if [ "$type" = "all" ]; then
set_ok=`grep 'control meta level ok' /tmp/$UID.$PID.pegasus.rolling_update.set_meta_level | wc -l`
if [ $set_ok -ne 1 ]; then
echo "ERROR: set meta level to steady failed"
exit -1
exit 1
fi
echo
fi
......
......@@ -6,7 +6,7 @@ if [ $# -ne 3 ]
then
echo "This tool is for set usage scenario of specified table(app)."
echo "USAGE: $0 <cluster-meta-list> <app-name> <normal|prefer_write|bulk_load>"
exit -1
exit 1
fi
pwd="$( cd "$( dirname "$0" )" && pwd )"
......@@ -20,7 +20,7 @@ scenario_key="rocksdb.usage_scenario"
if [ "$scenario" != "normal" -a "$scenario" != "prefer_write" -a "$scenario" != "bulk_load" ]; then
echo "invalid usage scenario type: $scenario"
exit -1
exit 1
fi
echo "UID=$UID"
......@@ -34,7 +34,7 @@ set_ok=`grep 'set app envs succeed' /tmp/$UID.$PID.pegasus.set_app_envs | wc -l`
if [ $set_ok -ne 1 ]; then
grep ERR /tmp/$UID.$PID.pegasus.set_app_envs
echo "ERROR: set app envs failed, refer to /tmp/$UID.$PID.pegasus.set_app_envs"
exit -1
exit 1
fi
echo ls | ./run.sh shell --cluster $cluster &>/tmp/$UID.$PID.pegasus.ls
......
......@@ -7,7 +7,7 @@ if [ $# -ne 2 ]; then
echo " eg: $0 onebox 2017-07"
echo
echo "Result: <cluster> <filter> <day_count> <available>"
exit -1
exit 1
fi
cluster=$1
......@@ -21,13 +21,13 @@ cd $shell_dir
if [ ! -f $minos_config ]; then
echo "ERROR: minos config \"$minos_config\" not found"
exit -1
exit 1
fi
detect_table=`grep '^ *available_detect_app = ' $minos_config | awk '{print $3}'`
if [ "$detect_table" == "" ]; then
echo "ERROR: get detect table from $minos_config failed"
exit -1
exit 1
fi
result_file="pegasus.stat_available.scan_result"
......@@ -37,14 +37,14 @@ scan_ok=`grep 'key-value pairs got' $tmp_file | wc -l`
if [ $scan_ok -ne 1 ]; then
echo "ERROR: scan detect table failed, refer error to $tmp_file"
rm -f $result_file
exit -1
exit 1
fi
days=`cat $result_file | wc -l`
if [ $days -eq 0 ]; then
echo "ERROR: no detect data found for filter \"$filter\", refer to $tmp_file"
rm -f $result_file
exit -1
exit 1
fi
available=`cat $result_file | grep -o '[0-9]*,[0-9]*,[0-9]*' | awk -F, '{a+=$1;b+=$2}END{printf("%f\n",(double)b/a);}'`
......
......@@ -54,5 +54,5 @@ case $cmd in
;;
*)
echo "Error: Unknown command $cmd."
exit -1
exit 1
esac
......@@ -7,20 +7,20 @@
if [ -z "$INSTALL_DIR" ]
then
echo "ERROR: no INSTALL_DIR specified"
exit -1
exit 1
fi
if [ -z "$PORT" ]
then
echo "ERROR: no PORT specified"
exit -1
exit 1
fi
mkdir -p $INSTALL_DIR
if [ $? -ne 0 ]
then
echo "ERROR: mkdir $PREFIX failed"
exit -1
exit 1
fi
cd $INSTALL_DIR
......@@ -34,7 +34,7 @@ if [ ! -f zookeeper-3.4.6.tar.gz ]; then
wget -T 5 -t 1 $download_url
if [ $? -ne 0 ]; then
echo "ERROR: download zookeeper failed"
exit -1
exit 1
fi
fi
fi
......@@ -44,7 +44,7 @@ if [ ! -d zookeeper-3.4.6 ]; then
tar xfz zookeeper-3.4.6.tar.gz
if [ $? -ne 0 ]; then
echo "ERROR: decompress zookeeper failed"
exit -1
exit 1
fi
fi
......@@ -64,6 +64,6 @@ if echo ruok | nc localhost $ZOOKEEPER_PORT | grep -q imok; then
exit 0
else
echo "ERROR: start zookeeper failed"
exit -1
exit 1
fi
......@@ -6,7 +6,7 @@
if [ -z "$INSTALL_DIR" ]
then
echo "ERROR: no INSTALL_DIR specified"
exit -1
exit 1
fi
cd $INSTALL_DIR
......
......@@ -132,7 +132,7 @@ make -C ../rocksdb static_lib_$BUILD_TYPE $MAKE_OPTIONS
if [ $? -ne 0 ]
then
echo "ERROR: build librocksdb.a failed"
exit -1
exit 1
else
echo "Build librocksdb.a succeed"
fi
......@@ -147,7 +147,7 @@ then
if [ $? -ne 0 ]
then
echo "ERROR: cmake failed"
exit -1
exit 1
fi
cd ..
fi
......@@ -168,7 +168,7 @@ make install $MAKE_OPTIONS
if [ $? -ne 0 ]
then
echo "ERROR: build pegasus failed"
exit -1
exit 1
else
echo "Build pegasus succeed"
fi
......@@ -179,7 +179,7 @@ make -C ../rocksdb pegasus_bench_$BUILD_TYPE $MAKE_OPTIONS
if [ $? -ne 0 ]
then
echo "ERROR: build pegasus_bench failed"
exit -1
exit 1
else
mkdir -p $DSN_ROOT/bin/pegasus_bench
mv ../rocksdb/pegasus_bench $DSN_ROOT/bin/pegasus_bench/pegasus_bench
......
......@@ -3,7 +3,7 @@
exit_if_fail() {
if [ $1 != 0 ]; then
echo $2
exit -1
exit 1
fi
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册