From 717afb7144c8f56e8ea310fc1e5fc4a393596351 Mon Sep 17 00:00:00 2001 From: neverchanje Date: Thu, 7 Jan 2021 19:14:25 +0800 Subject: [PATCH 01/12] fix: compilation error in pegasus_utils --- src/base/pegasus_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/pegasus_utils.h b/src/base/pegasus_utils.h index 4bd31115ef..38f3207de8 100644 --- a/src/base/pegasus_utils.h +++ b/src/base/pegasus_utils.h @@ -62,7 +62,7 @@ class top_n result.emplace_front(_queue.top()); _queue.pop(); } - return std::move(result); + return result; } protected: From 0f93d7c81e636cdf2ee40a835dc29974278996b0 Mon Sep 17 00:00:00 2001 From: neverchanje Date: Fri, 8 Jan 2021 16:03:15 +0800 Subject: [PATCH 02/12] fix: remove packing libaio --- scripts/pack_server.sh | 106 +++++++++++++++++++++-------------------- scripts/pack_tools.sh | 23 ++++++--- 2 files changed, 72 insertions(+), 57 deletions(-) diff --git a/scripts/pack_server.sh b/scripts/pack_server.sh index 94b7f723c2..416beccfd6 100755 --- a/scripts/pack_server.sh +++ b/scripts/pack_server.sh @@ -6,9 +6,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -18,8 +18,7 @@ source $(dirname $0)/pack_common.sh -function usage() -{ +function usage() { echo "Options for subcommand 'pack_server':" echo " -h" echo " -p|--update-package-template " @@ -28,55 +27,49 @@ function usage() exit 0 } -pwd="$( cd "$( dirname "$0" )" && pwd )" -shell_dir="$( cd $pwd/.. && pwd )" -cd $shell_dir +pwd="$(cd "$(dirname "$0")" && pwd)" +shell_dir="$(cd $pwd/.. && pwd)" +cd "$shell_dir" || exit 1 -if [ ! -f src/include/pegasus/git_commit.h ] -then +if [ ! -f src/include/pegasus/git_commit.h ]; then echo "ERROR: src/include/pegasus/git_commit.h not found" exit 1 fi -if [ ! -f DSN_ROOT/bin/pegasus_server/pegasus_server ] -then +if [ ! -f DSN_ROOT/bin/pegasus_server/pegasus_server ]; then echo "ERROR: DSN_ROOT/bin/pegasus_server/pegasus_server not found" exit 1 fi -if [ ! -f src/builder/CMAKE_OPTIONS ] -then +if [ ! -f src/builder/CMAKE_OPTIONS ]; then echo "ERROR: src/builder/CMAKE_OPTIONS not found" exit 1 fi -if grep -q Debug src/builder/CMAKE_OPTIONS -then +if grep -q Debug src/builder/CMAKE_OPTIONS; then build_type=debug else build_type=release fi -version=`grep "VERSION" src/include/pegasus/version.h | cut -d "\"" -f 2` -commit_id=`grep "GIT_COMMIT" src/include/pegasus/git_commit.h | cut -d "\"" -f 2` -glibc_ver=`ldd --version | grep ldd | grep -Eo "[0-9]+.[0-9]+$"` +version=$(grep "VERSION" src/include/pegasus/version.h | cut -d "\"" -f 2) +commit_id=$(grep "GIT_COMMIT" src/include/pegasus/git_commit.h | cut -d "\"" -f 2) +glibc_ver=$(ldd --version | grep ldd | grep -Eo "[0-9]+.[0-9]+$") echo "Packaging pegasus server $version ($commit_id) glibc-$glibc_ver $build_type ..." pack_version=server-$version-${commit_id:0:7}-glibc${glibc_ver}-${build_type} pack=pegasus-$pack_version -if [ -f ${pack}.tar.gz ] -then +if [ -f ${pack}.tar.gz ]; then rm -f ${pack}.tar.gz fi -if [ -d ${pack} ] -then +if [ -d ${pack} ]; then rm -rf ${pack} fi pack_template="" if [ -n "$MINOS_CONFIG_FILE" ]; then - pack_template=`dirname $MINOS_CONFIG_FILE`/xiaomi-config/package/pegasus.yaml + pack_template=$(dirname $MINOS_CONFIG_FILE)/xiaomi-config/package/pegasus.yaml fi custom_gcc="false" @@ -85,20 +78,20 @@ keytab_file="" while [[ $# > 0 ]]; do option_key="$1" case $option_key in - -p|--update-package-template) - pack_template="$2" - shift - ;; - -g|--custom-gcc) - custom_gcc="true" - ;; - -h|--help) - usage - ;; - -k|--keytab-file) - keytab_file="$2" - shift - ;; + -p | --update-package-template) + pack_template="$2" + shift + ;; + -g | --custom-gcc) + custom_gcc="true" + ;; + -h | --help) + usage + ;; + -k | --keytab-file) + keytab_file="$2" + shift + ;; esac shift done @@ -121,14 +114,25 @@ copy_file ./rdsn/thirdparty/output/lib/libk5crypto.so.3 ${pack}/bin copy_file ./rdsn/thirdparty/output/lib/sasl2 ${pack}/bin copy_file ./scripts/sendmail.sh ${pack}/bin copy_file ./src/server/config.ini ${pack}/bin +copy_file ./config_hdfs.sh ${pack}/bin -copy_file `get_stdcpp_lib $custom_gcc` ${pack}/bin -copy_file `get_system_lib server snappy` ${pack}/bin/`get_system_libname server snappy` -copy_file `get_system_lib server crypto` ${pack}/bin/`get_system_libname server crypto` -copy_file `get_system_lib server ssl` ${pack}/bin/`get_system_libname server ssl` -copy_file `get_system_lib server aio` ${pack}/bin/`get_system_libname server aio` -copy_file `get_system_lib server zstd` ${pack}/bin/`get_system_libname server zstd` -copy_file `get_system_lib server lz4` ${pack}/bin/`get_system_libname server lz4` +copy_file "$(get_stdcpp_lib $custom_gcc)" "${pack}/bin" + +pack_system_lib() { + SYS_LIB_PATH=$(get_system_lib server "$1") + if [ -z "${SYS_LIB_PATH}" ]; then + echo "ERROR: library $1 is missing on your system" + exit 1 + fi + SYS_LIB_NAME=$(get_system_libname server "$1") + copy_file "${SYS_LIB_PATH}" "${pack}/bin/${SYS_LIB_NAME}" +} + +pack_system_lib snappy +pack_system_lib crypto +pack_system_lib ssl +pack_system_lib zstd +pack_system_lib lz4 # Pack hadoop-related files. # If you want to use hdfs service to backup/restore/bulkload pegasus tables, @@ -160,12 +164,12 @@ fi DISTRIB_ID=$(cat /etc/*-release | grep DISTRIB_ID | awk -F'=' '{print $2}') DISTRIB_RELEASE=$(cat /etc/*-release | grep DISTRIB_RELEASE | awk -F'=' '{print $2}') if [ -n "$DISTRIB_ID" ] && [ -n "$DISTRIB_RELEASE" ]; then - if [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$DISTRIB_RELEASE" == "18.04" ]; then - copy_file "$(get_system_lib server icui18n)" "$pack/bin/$(get_system_libname server icui18n)" - copy_file "$(get_system_lib server icuuc)" "$pack/bin/$(get_system_libname server icuuc)" - copy_file "$(get_system_lib server icudata)" "$pack/bin/$(get_system_libname server icudata)" - fi - # more cases can be added here. + if [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$DISTRIB_RELEASE" == "18.04" ]; then + pack_system_lib icui18n + pack_system_lib icuuc + pack_system_lib icudata + fi + # more cases can be added here. fi chmod +x ${pack}/bin/pegasus_* ${pack}/bin/*.sh @@ -182,6 +186,6 @@ if [ -f $pack_template ]; then sed -i "/^source:/c source: \"$PEGASUS_ROOT\"" $pack_template fi -echo ${pack} > PACKAGE +echo ${pack} >PACKAGE echo "Done" diff --git a/scripts/pack_tools.sh b/scripts/pack_tools.sh index 0bc80e181f..0fca6a7af9 100755 --- a/scripts/pack_tools.sh +++ b/scripts/pack_tools.sh @@ -114,12 +114,23 @@ copy_file ./rdsn/thirdparty/output/lib/libPoco*.so.48 ${pack}/DSN_ROOT/lib/ copy_file ./rdsn/thirdparty/output/lib/libtcmalloc_and_profiler.so.4 ${pack}/DSN_ROOT/lib/ copy_file ./rdsn/thirdparty/output/lib/libboost*.so.1.69.0 ${pack}/DSN_ROOT/lib/ copy_file `get_stdcpp_lib $custom_gcc` ${pack}/DSN_ROOT/lib/ -copy_file `get_system_lib shell snappy` ${pack}/DSN_ROOT/lib/`get_system_libname shell snappy` -copy_file `get_system_lib shell crypto` ${pack}/DSN_ROOT/lib/`get_system_libname shell crypto` -copy_file `get_system_lib shell ssl` ${pack}/DSN_ROOT/lib/`get_system_libname shell ssl` -copy_file `get_system_lib shell aio` ${pack}/DSN_ROOT/lib/`get_system_libname shell aio` -copy_file `get_system_lib shell zstd` ${pack}/DSN_ROOT/lib/`get_system_libname shell zstd` -copy_file `get_system_lib shell lz4` ${pack}/DSN_ROOT/lib/`get_system_libname shell lz4` + +pack_system_lib() { + SYS_LIB_PATH=$(get_system_lib shell "$1") + if [ -z "${SYS_LIB_PATH}" ]; then + echo "ERROR: library $1 is missing on your system" + exit 1 + fi + SYS_LIB_NAME=$(get_system_libname shell "$1") + copy_file "${SYS_LIB_PATH}" "${pack}/DSN_ROOT/lib/${SYS_LIB_NAME}" +} + +pack_system_lib snappy +pack_system_lib crypto +pack_system_lib ssl +pack_system_lib zstd +pack_system_lib lz4 + chmod -x ${pack}/DSN_ROOT/lib/* mkdir -p ${pack}/scripts From 63df5a4af73940324ff28fae45982a3b88aa70e7 Mon Sep 17 00:00:00 2001 From: neverchanje Date: Fri, 8 Jan 2021 17:05:02 +0800 Subject: [PATCH 03/12] remove unused configs --- scripts/pack_server.sh | 1 + src/server/config.ini | 1 - src/server/config.min.ini | 3 --- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/pack_server.sh b/scripts/pack_server.sh index 416beccfd6..0772c950eb 100755 --- a/scripts/pack_server.sh +++ b/scripts/pack_server.sh @@ -114,6 +114,7 @@ copy_file ./rdsn/thirdparty/output/lib/libk5crypto.so.3 ${pack}/bin copy_file ./rdsn/thirdparty/output/lib/sasl2 ${pack}/bin copy_file ./scripts/sendmail.sh ${pack}/bin copy_file ./src/server/config.ini ${pack}/bin +copy_file ./src/server/config.min.ini ${pack}/bin copy_file ./config_hdfs.sh ${pack}/bin copy_file "$(get_stdcpp_lib $custom_gcc)" "${pack}/bin" diff --git a/src/server/config.ini b/src/server/config.ini index eb6e56020e..4b52ffd0b6 100644 --- a/src/server/config.ini +++ b/src/server/config.ini @@ -200,7 +200,6 @@ verbose_commit_log_on_start = false delay_for_fd_timeout_on_start = false empty_write_disabled = false - allow_non_idempotent_write = false prepare_timeout_ms_for_secondaries = 3000 prepare_timeout_ms_for_potential_secondaries = 5000 diff --git a/src/server/config.min.ini b/src/server/config.min.ini index 0094879713..2ab5b53de7 100644 --- a/src/server/config.min.ini +++ b/src/server/config.min.ini @@ -111,12 +111,9 @@ recover_from_replica_server = false [replication] - allow_non_idempotent_write = true mutation_2pc_min_replica_count = 1 cold_backup_root = onebox - duplication_disabled = true cluster_name = onebox - cold_backup_checkpoint_reserve_minutes = 10 [meta_server.apps.@APP_NAME@] app_name = @APP_NAME@ From bdb2614b4ba2f78111170668e284232856d79787 Mon Sep 17 00:00:00 2001 From: neverchanje Date: Fri, 8 Jan 2021 19:07:00 +0800 Subject: [PATCH 04/12] remove recover_from_replica_server from config.min.ini --- src/server/config.min.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/src/server/config.min.ini b/src/server/config.min.ini index 2ab5b53de7..90688eb22b 100644 --- a/src/server/config.min.ini +++ b/src/server/config.min.ini @@ -108,7 +108,6 @@ server_load_balancer_type = greedy_load_balancer min_live_node_count_for_unfreeze = 1 cold_backup_disabled = false - recover_from_replica_server = false [replication] mutation_2pc_min_replica_count = 1 From 39ccf47233220d6cd68dabc109c1816ec329309e Mon Sep 17 00:00:00 2001 From: neverchanje Date: Tue, 26 Jan 2021 14:29:21 +0800 Subject: [PATCH 05/12] fix comment --- src/server/config.min.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/config.min.ini b/src/server/config.min.ini index 81518f5577..5b9a7b191d 100644 --- a/src/server/config.min.ini +++ b/src/server/config.min.ini @@ -108,6 +108,7 @@ server_load_balancer_type = greedy_load_balancer min_live_node_count_for_unfreeze = 1 cold_backup_disabled = false + recover_from_replica_server = false [replication] mutation_2pc_min_replica_count = 1 @@ -130,7 +131,7 @@ # Options: # - falcon # - prometheus - perf_counter_sink = + perf_counter_sink = prometheus # The HTTP port exposed to Prometheus for pulling metrics from pegasus server. prometheus_port = @PROMETHEUS_PORT@ From 7e4238460ed4852e4d14481f6fed4344f8a21e0d Mon Sep 17 00:00:00 2001 From: neverchanje Date: Tue, 9 Feb 2021 17:48:16 +0800 Subject: [PATCH 06/12] update and fix workflow --- .github/workflows/ci-pull-request.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-pull-request.yaml b/.github/workflows/ci-pull-request.yaml index ee3c3fb76f..3cb2a06cec 100644 --- a/.github/workflows/ci-pull-request.yaml +++ b/.github/workflows/ci-pull-request.yaml @@ -17,10 +17,7 @@ on: paths: - 'rdsn/**' - 'src/**' - - '.github/workflows/ci-pull-request.yml' - push: - paths: - - '.github/workflows/ci-pull-request.yml' + - '.github/workflows/ci-pull-request.yaml' # for manually triggering workflow workflow_dispatch: @@ -64,4 +61,6 @@ jobs: - name: Compilation run: ./run.sh build -c --skip_thirdparty - name: Unit Testing - run: ./run.sh test --on_travis + run: | + source ./config_hdfs.sh + ./run.sh test --on_travis From 840f831b8e1c9c17f439ef869c03be1309b72627 Mon Sep 17 00:00:00 2001 From: neverchanje Date: Tue, 9 Feb 2021 18:55:57 +0800 Subject: [PATCH 07/12] use thirdparties-bin for testing --- .github/workflows/ci-pull-request.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-pull-request.yaml b/.github/workflows/ci-pull-request.yaml index 3cb2a06cec..57e155d1ba 100644 --- a/.github/workflows/ci-pull-request.yaml +++ b/.github/workflows/ci-pull-request.yaml @@ -47,7 +47,7 @@ jobs: needs: lint runs-on: ubuntu-latest container: - image: apachepegasus/ci-env + image: ghcr.io/pegasus-kv/thirdparties-bin:ubuntu1804 defaults: run: working-directory: /root/incubator-pegasus @@ -57,7 +57,7 @@ jobs: run: | git clone --recursive --depth=1 https://github.com/apache/incubator-pegasus.git - name: Unpack prebuilt third-parties - run: unzip /root/pegasus-thirdparty-output.zip -d ./rdsn/thirdparty + run: unzip /root/thirdparties-bin.zip -d ./rdsn/thirdparty - name: Compilation run: ./run.sh build -c --skip_thirdparty - name: Unit Testing From b56da7fff189ab2926c3854116bf56228606245c Mon Sep 17 00:00:00 2001 From: neverchanje Date: Mon, 22 Feb 2021 15:45:53 +0800 Subject: [PATCH 08/12] fix: ensure run command using bash --- .github/workflows/ci-pull-request.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-pull-request.yaml b/.github/workflows/ci-pull-request.yaml index 57e155d1ba..acadd7544a 100644 --- a/.github/workflows/ci-pull-request.yaml +++ b/.github/workflows/ci-pull-request.yaml @@ -51,6 +51,7 @@ jobs: defaults: run: working-directory: /root/incubator-pegasus + shell: bash steps: - name: Clone Apache Pegasus Source working-directory: /root @@ -59,7 +60,9 @@ jobs: - name: Unpack prebuilt third-parties run: unzip /root/thirdparties-bin.zip -d ./rdsn/thirdparty - name: Compilation - run: ./run.sh build -c --skip_thirdparty + run: | + source ./config_hdfs.sh + ./run.sh build -c --skip_thirdparty - name: Unit Testing run: | source ./config_hdfs.sh From d7dc6926f9e0ec673826893227df85737e517bcf Mon Sep 17 00:00:00 2001 From: neverchanje Date: Mon, 22 Feb 2021 15:51:05 +0800 Subject: [PATCH 09/12] fix ci --- .github/workflows/ci-pull-request.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci-pull-request.yaml b/.github/workflows/ci-pull-request.yaml index acadd7544a..e6e3109502 100644 --- a/.github/workflows/ci-pull-request.yaml +++ b/.github/workflows/ci-pull-request.yaml @@ -60,9 +60,7 @@ jobs: - name: Unpack prebuilt third-parties run: unzip /root/thirdparties-bin.zip -d ./rdsn/thirdparty - name: Compilation - run: | - source ./config_hdfs.sh - ./run.sh build -c --skip_thirdparty + run: ./run.sh build -c --skip_thirdparty - name: Unit Testing run: | source ./config_hdfs.sh From 92b13d922e33a92f375103dce0cc6abb623d078e Mon Sep 17 00:00:00 2001 From: neverchanje Date: Tue, 23 Feb 2021 14:12:13 +0800 Subject: [PATCH 10/12] update rdsn --- rdsn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdsn b/rdsn index d8cbbe5985..c057d35c93 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit d8cbbe59854fd382d10954349f24c058ffa1b107 +Subproject commit c057d35c93ff9d895d5eefef343b6c7afd74812d From aec787ec1a9ce2c50cd28f910f73059f0ab1e264 Mon Sep 17 00:00:00 2001 From: neverchanje Date: Tue, 23 Feb 2021 15:49:30 +0800 Subject: [PATCH 11/12] fix: adapt to new rdsn commit --- src/base/test/CMakeLists.txt | 1 + src/client_lib/CMakeLists.txt | 1 + src/shell/command_helper.h | 11 +++++++++++ src/shell/commands/rebalance.cpp | 21 +++++++++------------ src/shell/commands/recovery.cpp | 4 ++-- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/base/test/CMakeLists.txt b/src/base/test/CMakeLists.txt index 651e0c0551..b3e4e1a569 100644 --- a/src/base/test/CMakeLists.txt +++ b/src/base/test/CMakeLists.txt @@ -29,6 +29,7 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_runtime + dsn_aio dsn_utils pegasus_base gtest) diff --git a/src/client_lib/CMakeLists.txt b/src/client_lib/CMakeLists.txt index f2a99864a2..5b1f96f63a 100644 --- a/src/client_lib/CMakeLists.txt +++ b/src/client_lib/CMakeLists.txt @@ -46,6 +46,7 @@ add_dependencies(pegasus_client_static combine_lib) set_target_properties(pegasus_client_static PROPERTIES IMPORTED_LOCATION ${pegasus_client_static_lib}) +target_link_libraries(pegasus_client_static INTERFACE dsn_aio) install(FILES ${pegasus_client_static_lib} DESTINATION "lib") # link the shared lib of pegasus client diff --git a/src/shell/command_helper.h b/src/shell/command_helper.h index 65403e799b..d345ad66af 100644 --- a/src/shell/command_helper.h +++ b/src/shell/command_helper.h @@ -1093,3 +1093,14 @@ inline bool get_storage_size_stat(shell_context *sc, app_storage_size_stat &st_s st_stat.timestamp = buf; return true; } + +inline configuration_proposal_action new_proposal_action(const dsn::rpc_address &target, + const dsn::rpc_address &node, + config_type::type type) +{ + configuration_proposal_action act; + act.__set_target(target); + act.__set_node(node); + act.__set_type(type); + return act; +} diff --git a/src/shell/commands/rebalance.cpp b/src/shell/commands/rebalance.cpp index b326d232e7..ad3dc38d4d 100644 --- a/src/shell/commands/rebalance.cpp +++ b/src/shell/commands/rebalance.cpp @@ -110,7 +110,7 @@ bool propose(command_executor *e, shell_context *sc, arguments args) type_from_string(_config_type_VALUES_TO_NAMES, proposal_type, config_type::CT_INVALID); verify_logged( tp != config_type::CT_INVALID, "parse %s as config_type failed.\n", proposal_type.c_str()); - request.action_list = {configuration_proposal_action{target, node, tp}}; + request.action_list = {new_proposal_action(target, node, tp)}; dsn::error_code err = sc->ddl_client->send_balancer_proposal(request); std::cout << "send proposal response: " << err.to_string() << std::endl; return true; @@ -172,21 +172,18 @@ bool balance(command_executor *e, shell_context *sc, arguments args) actions.reserve(4); if (balance_type == "move_pri") { actions.emplace_back( - configuration_proposal_action{from, from, config_type::CT_DOWNGRADE_TO_SECONDARY}); - actions.emplace_back( - configuration_proposal_action{to, to, config_type::CT_UPGRADE_TO_PRIMARY}); + new_proposal_action(from, from, config_type::CT_DOWNGRADE_TO_SECONDARY)); + actions.emplace_back(new_proposal_action(to, to, config_type::CT_UPGRADE_TO_PRIMARY)); } else if (balance_type == "copy_pri") { + actions.emplace_back(new_proposal_action(from, to, config_type::CT_ADD_SECONDARY_FOR_LB)); actions.emplace_back( - configuration_proposal_action{from, to, config_type::CT_ADD_SECONDARY_FOR_LB}); + new_proposal_action(from, from, config_type::CT_DOWNGRADE_TO_SECONDARY)); + actions.emplace_back(new_proposal_action(to, to, config_type::CT_UPGRADE_TO_PRIMARY)); + } else if (balance_type == "copy_sec") { actions.emplace_back( - configuration_proposal_action{from, from, config_type::CT_DOWNGRADE_TO_SECONDARY}); + new_proposal_action(dsn::rpc_address(), to, config_type::CT_ADD_SECONDARY_FOR_LB)); actions.emplace_back( - configuration_proposal_action{to, to, config_type::CT_UPGRADE_TO_PRIMARY}); - } else if (balance_type == "copy_sec") { - actions.emplace_back(configuration_proposal_action{ - dsn::rpc_address(), to, config_type::CT_ADD_SECONDARY_FOR_LB}); - actions.emplace_back(configuration_proposal_action{ - dsn::rpc_address(), from, config_type::CT_DOWNGRADE_TO_INACTIVE}); + new_proposal_action(dsn::rpc_address(), from, config_type::CT_DOWNGRADE_TO_INACTIVE)); } else { fprintf(stderr, "parse %s as a balance type failed\n", balance_type.c_str()); return false; diff --git a/src/shell/commands/recovery.cpp b/src/shell/commands/recovery.cpp index 2b58a3e434..b1f539b904 100644 --- a/src/shell/commands/recovery.cpp +++ b/src/shell/commands/recovery.cpp @@ -350,8 +350,8 @@ bool ddd_diagnose(command_executor *e, shell_context *sc, arguments args) if (!primary.is_invalid() && !skip_this) { dsn::replication::configuration_balancer_request request; request.gpid = pinfo.config.pid; - request.action_list = {configuration_proposal_action{ - primary, primary, config_type::CT_ASSIGN_PRIMARY}}; + request.action_list = { + new_proposal_action(primary, primary, config_type::CT_ASSIGN_PRIMARY)}; request.force = false; dsn::error_code err = sc->ddl_client->send_balancer_proposal(request); out << " propose_request: propose -g " << request.gpid.to_string() From efe2de9c722d80119068d6f2360997879c15fe9e Mon Sep 17 00:00:00 2001 From: neverchanje Date: Wed, 24 Feb 2021 15:51:03 +0800 Subject: [PATCH 12/12] fix: remove duplicated code to pack_common --- scripts/pack_common.sh | 14 ++++++++++++++ scripts/pack_server.sh | 20 +++++++------------- scripts/pack_tools.sh | 20 +++++++------------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/scripts/pack_common.sh b/scripts/pack_common.sh index 532ded29b7..48d3221b56 100755 --- a/scripts/pack_common.sh +++ b/scripts/pack_common.sh @@ -100,3 +100,17 @@ function check_bit() fi } +function pack_system_lib() +{ + local package_path=$1 + local package_type=$2 + local lib_name=$3 + + SYS_LIB_PATH=$(get_system_lib "${package_type}" "${lib_name}") + if [ -z "${SYS_LIB_PATH}" ]; then + echo "ERROR: library ${lib_name} is missing on your system" + exit 1 + fi + SYS_LIB_NAME=$(get_system_libname "${package_type}" "${lib_name}") + copy_file "${SYS_LIB_PATH}" "${package_path}/${SYS_LIB_NAME}" +} diff --git a/scripts/pack_server.sh b/scripts/pack_server.sh index 0772c950eb..ff97858949 100755 --- a/scripts/pack_server.sh +++ b/scripts/pack_server.sh @@ -119,21 +119,15 @@ copy_file ./config_hdfs.sh ${pack}/bin copy_file "$(get_stdcpp_lib $custom_gcc)" "${pack}/bin" -pack_system_lib() { - SYS_LIB_PATH=$(get_system_lib server "$1") - if [ -z "${SYS_LIB_PATH}" ]; then - echo "ERROR: library $1 is missing on your system" - exit 1 - fi - SYS_LIB_NAME=$(get_system_libname server "$1") - copy_file "${SYS_LIB_PATH}" "${pack}/bin/${SYS_LIB_NAME}" +pack_server_lib() { + pack_system_lib "${pack}/bin" server "$1" } -pack_system_lib snappy -pack_system_lib crypto -pack_system_lib ssl -pack_system_lib zstd -pack_system_lib lz4 +pack_server_lib snappy +pack_server_lib crypto +pack_server_lib ssl +pack_server_lib zstd +pack_server_lib lz4 # Pack hadoop-related files. # If you want to use hdfs service to backup/restore/bulkload pegasus tables, diff --git a/scripts/pack_tools.sh b/scripts/pack_tools.sh index 0fca6a7af9..9f45b0d3bd 100755 --- a/scripts/pack_tools.sh +++ b/scripts/pack_tools.sh @@ -115,21 +115,15 @@ copy_file ./rdsn/thirdparty/output/lib/libtcmalloc_and_profiler.so.4 ${pack}/DSN copy_file ./rdsn/thirdparty/output/lib/libboost*.so.1.69.0 ${pack}/DSN_ROOT/lib/ copy_file `get_stdcpp_lib $custom_gcc` ${pack}/DSN_ROOT/lib/ -pack_system_lib() { - SYS_LIB_PATH=$(get_system_lib shell "$1") - if [ -z "${SYS_LIB_PATH}" ]; then - echo "ERROR: library $1 is missing on your system" - exit 1 - fi - SYS_LIB_NAME=$(get_system_libname shell "$1") - copy_file "${SYS_LIB_PATH}" "${pack}/DSN_ROOT/lib/${SYS_LIB_NAME}" +pack_tools_lib() { + pack_system_lib "${pack}/DSN_ROOT/lib" shell "$1" } -pack_system_lib snappy -pack_system_lib crypto -pack_system_lib ssl -pack_system_lib zstd -pack_system_lib lz4 +pack_tools_lib snappy +pack_tools_lib crypto +pack_tools_lib ssl +pack_tools_lib zstd +pack_tools_lib lz4 chmod -x ${pack}/DSN_ROOT/lib/*