Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pack without libaio #676

Merged
merged 21 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 56 additions & 51 deletions scripts/pack_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <minos-package-template-file-path>"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -121,14 +114,26 @@ 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
hycdong marked this conversation as resolved.
Show resolved Hide resolved
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}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not copy_file "${SYS_LIB_PATH}" "${pack}/bin"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure but ${SYS_LIB_NAME} and ${SYS_LIB_PATH} could point to different file names.

}

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,
Expand Down Expand Up @@ -160,12 +165,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
Expand All @@ -182,6 +187,6 @@ if [ -f $pack_template ]; then
sed -i "/^source:/c source: \"$PEGASUS_ROOT\"" $pack_template
fi

echo ${pack} > PACKAGE
echo ${pack} >PACKAGE

echo "Done"
23 changes: 17 additions & 6 deletions scripts/pack_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to move pack_system_lib() to pack_common.sh .

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
Expand Down
2 changes: 1 addition & 1 deletion src/base/pegasus_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class top_n
result.emplace_front(_queue.top());
_queue.pop();
}
return std::move(result);
return result;
}

protected:
Expand Down
1 change: 0 additions & 1 deletion src/server/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/server/config.min.ini
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,9 @@
recover_from_replica_server = false
neverchanje marked this conversation as resolved.
Show resolved Hide resolved

[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@
Expand Down