diff --git a/tools/deploy/copy.sh b/tools/deploy/copy.sh index 6b5e65158e..39a7f44ce6 100755 --- a/tools/deploy/copy.sh +++ b/tools/deploy/copy.sh @@ -1,9 +1,31 @@ #!/bin/bash -x SOURCE_DIR=$(readlink -f "$(dirname ${BASH_SOURCE[0]})/../..") +BUILD_TYPE_ORDER="debug debug_asan debug_no_unity release release_asan release_coverage release_no_unity + errsim errsim_asan errsim_debug errsim_sanity dissearray rpm perf sanity coverage + enable_latch_diagnose enable_memory_diagnosis enable_obj_leak_check enable_smart_var_check + trans_module_test" + if [ $# -lt 1 ] then - echo "Usage ./copy.sh [oceanbase_dev_dir]" - BUILD_DIR=$(find $SOURCE_DIR -maxdepth 1 -name 'build_*' -type d | grep -v 'build_ccls' | head -1) + ALL_BUILD_DIRS=$(find $SOURCE_DIR -maxdepth 1 -name 'build_*' -type d | grep -v 'build_ccls' | sort) + for TYPE in ${BUILD_TYPE_ORDER[@]} + do + for BUILD_DIR in ${ALL_BUILD_DIRS[@]} + do + if [[ "build_$TYPE" == "$(basename $BUILD_DIR)" ]] + then + break 2 + fi + done + done + [[ "$BUILD_DIR" == "" ]] && BUILD_DIR=${ALL_BUILD_DIRS[0]} + if [[ "$BUILD_DIR" == "" ]] + then + echo "Please specify the build directory of oceanbase." + exit 1 + else + echo "Choose $BUILD_DIR as build directory of oceanbase." + fi else BUILD_DIR=$1 fi diff --git a/tools/deploy/obd.sh b/tools/deploy/obd.sh index 316b382731..585d8dba74 100755 --- a/tools/deploy/obd.sh +++ b/tools/deploy/obd.sh @@ -34,7 +34,7 @@ function obd_exec { } alias obd="obd_exec" -function variables_parpare { +function variables_prepare { if [[ "$(readlink -f "$BASE_DIR"/..)" == "$OB_FLOW_WORK_DIR" ]] then path=$(readlink -f "$BASE_DIR") @@ -47,7 +47,7 @@ function variables_parpare { DATA_PATH="/data/$(whoami)" IPADDRESS="127.0.0.1" if [[ -f "$BASE_DIR/.ce" ]] - then + then export IS_CE=1 COMPONENT="oceanbase-ce" else @@ -74,7 +74,7 @@ function variables_parpare { function copy_sh { if [[ -f copy.sh ]] then - sh copy.sh + sh copy.sh $BUILD_PATH else echo 'can not find copy.sh' fi @@ -559,11 +559,11 @@ Usage: $entrance [options] Available commands: -prepare [-p DATA_PATH -h HOST] Prepare for deployment. +prepare [-b BUILD_PATH -p DATA_PATH -h HOST] Prepare for deployment. deploy -c YAML_CONF [-n DEPLOY_NAME] Deploy a cluster by a deploy yaml file. Default deploy name will be the name of yaml file. -redeploy [-c YAML_CONF -n DEPLOY_NAME] Redeploy cluster. +redeploy [-c YAML_CONF -n DEPLOY_NAME] Redeploy cluster. reinstall [-n DEPLOY_NAME] Reinstall cluster. (Change bin file, sync libs and restart) -start [-n DEPLOY_NAME] Start cluster. +start [-n DEPLOY_NAME] Start cluster. stop [-n DEPLOY_NAME] Stop a started cluster. restart [-n DEPLOY_NAME] Restart cluster. destroy [-n DEPLOY_NAME] Destroy cluster. @@ -593,20 +593,21 @@ Options: -n DEPLOY_NAME, --deploy-name DEPLOY_NAME The name of the deployment. -v VERBOSE Activate verbose output. +-b BUILD_PATH, --build-path BUILD_PATH The build path of oceanbase. -p DATA_PATH, --data-path DATA_PATH The data path for server deployment, it can be changed in the yaml file. --ip IPADDRESS The ipaddress for server deployment, it can be changed in the yaml file. --port PORT_BEGIN The port starting point. All the ports can be changed in the yaml file. --with-local-obproxy Use local obproxy. --skip-copy Skip copy.sh. --cp Exec copy.sh. ---reboot Redeploy cluster before mysqltest +--reboot Redeploy cluster before mysqltest. """ } function main() { entrance=${OBD_SH_ENTRANCE:-obd.sh} - variables_parpare + variables_prepare command="$1" shift extra_args="" @@ -625,6 +626,7 @@ function main() { fi ;; -n | --deploy-name ) DEPLOY_NAME="$2"; shift 2 ;; + -b | --build-path ) BUILD_PATH="$2"; shift 2 ;; -p | --data-path ) DATA_PATH="$2"; shift 2 ;; -N ) NO_CONFIRM="1"; shift ;; --ip ) IPADDRESS="$2"; shift 2 ;; @@ -645,6 +647,7 @@ function main() { YAML_CONF=$(absolute_path ${YAML_CONF}) DATA_PATH=$(absolute_path ${DATA_PATH}) + BUILD_PATH=$(absolute_path ${BUILD_PATH}) OBSERVER_PATH=$(absolute_path ${OBSERVER_PATH}) if [[ "$MINI" == "1" && "$DISABLE_REBOOT" != "1" ]] @@ -733,7 +736,7 @@ function main() { mirror_create && reinstall_cluster ;; list) - obd cluster list + obd cluster list ;; edit) edit