From ce9119b332bae9abce1cba238f40ae3314f3cd24 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 7 Jul 2021 17:24:51 +0800 Subject: [PATCH] Feature/sangshuduo/td 3973 use jemalloc (#6788) * [TD-3973]: add jemalloc as submodule. * add macro definitions in cmake. * [TD-3973]: use jemalloc. build works as following instructions: cmake .. -DJEMALLOC_ENABLED=true make * fix jemalloc at tag 5.2.1 * link jemalloc works. * make install works. * support jemalloc in release.sh. * release script works. * fix a typo. * [TD-3937]: support jemalloc add install funtion to all scripts. * adjust install_jemalloc() position for update check compatiblity. * fix position bug. * add ldconfig for jemalloc library cache refresh. * add /etc/ld.so.conf.d/jemalloc.conf for centos * check ver comp by file. Co-authored-by: Shuduo Sang --- packaging/release.sh | 8 +++--- packaging/tools/install.sh | 8 ++++-- packaging/tools/install_power.sh | 8 ++++-- packaging/tools/install_tq.sh | 8 ++++-- packaging/tools/makepkg.sh | 4 +-- packaging/tools/makepkg_power.sh | 42 ++++++++++++++++---------------- packaging/tools/makepkg_tq.sh | 30 +++++++++++------------ 7 files changed, 60 insertions(+), 48 deletions(-) diff --git a/packaging/release.sh b/packaging/release.sh index 34fda44243..5ba6c01a0b 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -204,7 +204,7 @@ else exit 1 fi -make -j8 +make cd ${curr_dir} @@ -246,15 +246,15 @@ if [ "$osType" != "Darwin" ]; then cd ${script_dir}/tools if [[ "$dbName" == "taos" ]]; then - ${csudo} ./makepkg.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} + ${csudo} ./makepkg.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${verNumberComp} ${csudo} ./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${csudo} ./makearbi.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} elif [[ "$dbName" == "tq" ]]; then - ${csudo} ./makepkg_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} + ${csudo} ./makepkg_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp} ${csudo} ./makeclient_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${csudo} ./makearbi_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} else - ${csudo} ./makepkg_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} + ${csudo} ./makepkg_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp} ${csudo} ./makeclient_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${csudo} ./makearbi_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} fi diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index c8970ed821..57467e4b72 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -772,9 +772,13 @@ vercomp () { function is_version_compatible() { - curr_version=$(${bin_dir}/taosd -V | head -1 | cut -d ' ' -f 3) + curr_version=`ls ${script_dir}/driver/libtaos.so* |cut -d '.' -f 3-6` - min_compatible_version=$(${script_dir}/bin/taosd -V | head -1 | cut -d ' ' -f 5) + if [ -f ${script_dir}/driver/vercomp.txt ]; then + min_compatible_version=`cat ${script_dir}/driver/vercomp.txt` + else + min_compatible_version=$(${script_dir}/bin/tqd -V | head -1 | cut -d ' ' -f 5) + fi vercomp $curr_version $min_compatible_version case $? in diff --git a/packaging/tools/install_power.sh b/packaging/tools/install_power.sh index b73b0b70c0..d0220cca25 100755 --- a/packaging/tools/install_power.sh +++ b/packaging/tools/install_power.sh @@ -741,9 +741,13 @@ vercomp () { function is_version_compatible() { - curr_version=$(${bin_dir}/powerd -V | head -1 | cut -d ' ' -f 3) + curr_version=`ls ${script_dir}/driver/libtaos.so* |cut -d '.' -f 3-6` - min_compatible_version=$(${script_dir}/bin/powerd -V | head -1 | cut -d ' ' -f 5) + if [ -f ${script_dir}/driver/vercomp.txt ]; then + min_compatible_version=`cat ${script_dir}/driver/vercomp.txt` + else + min_compatible_version=$(${script_dir}/bin/tqd -V | head -1 | cut -d ' ' -f 5) + fi vercomp $curr_version $min_compatible_version case $? in diff --git a/packaging/tools/install_tq.sh b/packaging/tools/install_tq.sh index 4bdb39838a..52e08cb6b0 100755 --- a/packaging/tools/install_tq.sh +++ b/packaging/tools/install_tq.sh @@ -741,9 +741,13 @@ vercomp () { function is_version_compatible() { - curr_version=$(${bin_dir}/tqd -V | head -1 | cut -d ' ' -f 3) + curr_version=`ls ${script_dir}/driver/libtaos.so* |cut -d '.' -f 3-6` - min_compatible_version=$(${script_dir}/bin/tqd -V | head -1 | cut -d ' ' -f 5) + if [ -f ${script_dir}/driver/vercomp.txt ]; then + min_compatible_version=`cat ${script_dir}/driver/vercomp.txt` + else + min_compatible_version=$(${script_dir}/bin/tqd -V | head -1 | cut -d ' ' -f 5) + fi vercomp $curr_version $min_compatible_version case $? in diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 624f72278a..81061416a2 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -14,6 +14,7 @@ osType=$5 verMode=$6 verType=$7 pagMode=$8 +versionComp=$9 script_dir="$(dirname $(readlink -f $0))" top_dir="$(readlink -f ${script_dir}/../..)" @@ -175,8 +176,7 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then cp -r ${examples_dir}/C# ${install_dir}/examples fi # Copy driver -mkdir -p ${install_dir}/driver -cp ${lib_files} ${install_dir}/driver +mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo "${versionComp}" > ${install_dir}/driver/vercomp.txt # Copy connector connector_dir="${code_dir}/connector" diff --git a/packaging/tools/makepkg_power.sh b/packaging/tools/makepkg_power.sh index 633a135c14..a2643b7486 100755 --- a/packaging/tools/makepkg_power.sh +++ b/packaging/tools/makepkg_power.sh @@ -14,6 +14,7 @@ osType=$5 verMode=$6 verType=$7 pagMode=$8 +versionComp=$9 script_dir="$(dirname $(readlink -f $0))" top_dir="$(readlink -f ${script_dir}/../..)" @@ -32,10 +33,10 @@ fi # Directories and files. #if [ "$pagMode" == "lite" ]; then -# strip ${build_dir}/bin/taosd +# strip ${build_dir}/bin/taosd # strip ${build_dir}/bin/taos # bin_files="${build_dir}/bin/powerd ${build_dir}/bin/power ${script_dir}/remove_power.sh" -#else +#else # bin_files="${build_dir}/bin/powerd ${build_dir}/bin/power ${build_dir}/bin/powerdemo ${build_dir}/bin/tarbitrator ${script_dir}/remove_power.sh\ # ${script_dir}/set_core.sh ${script_dir}/startPre.sh ${script_dir}/taosd-dump-cfg.gdb" #fi @@ -70,19 +71,19 @@ mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/taos.cfg ${install_dir}/cfg/taos.cf #mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : mkdir -p ${install_dir}/bin if [ "$pagMode" == "lite" ]; then - strip ${build_dir}/bin/taosd + strip ${build_dir}/bin/taosd strip ${build_dir}/bin/taos # bin_files="${build_dir}/bin/powerd ${build_dir}/bin/power ${script_dir}/remove_power.sh" cp ${build_dir}/bin/taos ${install_dir}/bin/power cp ${build_dir}/bin/taosd ${install_dir}/bin/powerd cp ${script_dir}/remove_power.sh ${install_dir}/bin -else +else # bin_files="${build_dir}/bin/powerd ${build_dir}/bin/power ${build_dir}/bin/powerdemo ${build_dir}/bin/tarbitrator ${script_dir}/remove_power.sh ${script_dir}/set_core.sh" cp ${build_dir}/bin/taos ${install_dir}/bin/power cp ${build_dir}/bin/taosd ${install_dir}/bin/powerd cp ${script_dir}/remove_power.sh ${install_dir}/bin - cp ${build_dir}/bin/taosdemo ${install_dir}/bin/powerdemo - cp ${build_dir}/bin/taosdump ${install_dir}/bin/powerdump + cp ${build_dir}/bin/taosdemo ${install_dir}/bin/powerdemo + cp ${build_dir}/bin/taosdump ${install_dir}/bin/powerdump cp ${build_dir}/bin/tarbitrator ${install_dir}/bin cp ${script_dir}/set_core.sh ${install_dir}/bin cp ${script_dir}/get_client.sh ${install_dir}/bin @@ -99,14 +100,14 @@ mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir} if [ "$verMode" == "cluster" ]; then sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove_power.sh >> remove_power_temp.sh mv remove_power_temp.sh ${install_dir}/bin/remove_power.sh - + mkdir -p ${install_dir}/nginxd && cp -r ${nginx_dir}/* ${install_dir}/nginxd cp ${nginx_dir}/png/taos.png ${install_dir}/nginxd/admin/images/taos.png rm -rf ${install_dir}/nginxd/png - sed -i "s/TDengine/PowerDB/g" ${install_dir}/nginxd/admin/*.html + sed -i "s/TDengine/PowerDB/g" ${install_dir}/nginxd/admin/*.html sed -i "s/TDengine/PowerDB/g" ${install_dir}/nginxd/admin/js/*.js - + sed -i '/dataDir/ {s/taos/power/g}' ${install_dir}/cfg/taos.cfg sed -i '/logDir/ {s/taos/power/g}' ${install_dir}/cfg/taos.cfg sed -i "s/TDengine/PowerDB/g" ${install_dir}/cfg/taos.cfg @@ -149,17 +150,16 @@ sed -i '/root/ {s/taosdata/powerdb/g}' ${install_dir}/examples/c/*.c if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then cp -r ${examples_dir}/JDBC ${install_dir}/examples cp -r ${examples_dir}/matlab ${install_dir}/examples - sed -i '/password/ {s/taosdata/powerdb/g}' ${install_dir}/examples/matlab/TDengineDemo.m + sed -i '/password/ {s/taosdata/powerdb/g}' ${install_dir}/examples/matlab/TDengineDemo.m cp -r ${examples_dir}/python ${install_dir}/examples - sed -i '/password/ {s/taosdata/powerdb/g}' ${install_dir}/examples/python/read_example.py + sed -i '/password/ {s/taosdata/powerdb/g}' ${install_dir}/examples/python/read_example.py cp -r ${examples_dir}/R ${install_dir}/examples - sed -i '/password/ {s/taosdata/powerdb/g}' ${install_dir}/examples/R/command.txt - cp -r ${examples_dir}/go ${install_dir}/examples + sed -i '/password/ {s/taosdata/powerdb/g}' ${install_dir}/examples/R/command.txt + cp -r ${examples_dir}/go ${install_dir}/examples sed -i '/root/ {s/taosdata/powerdb/g}' ${install_dir}/examples/go/taosdemo.go fi # Copy driver -mkdir -p ${install_dir}/driver -cp ${lib_files} ${install_dir}/driver +mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo "${versionComp}" > ${install_dir}/driver/vercomp.txt # Copy connector connector_dir="${code_dir}/connector" @@ -178,11 +178,11 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then echo "WARNING: go connector not found, please check if want to use it!" fi cp -r ${connector_dir}/python ${install_dir}/connector/ - + sed -i '/password/ {s/taosdata/powerdb/g}' ${install_dir}/connector/python/taos/cinterface.py - + sed -i '/password/ {s/taosdata/powerdb/g}' ${install_dir}/connector/python/taos/subscription.py - + sed -i '/self._password/ {s/taosdata/powerdb/g}' ${install_dir}/connector/python/taos/connection.py fi # Copy release note @@ -190,7 +190,7 @@ fi # exit 1 -cd ${release_dir} +cd ${release_dir} if [ "$verMode" == "cluster" ]; then pkg_name=${install_dir}-${osType}-${cpuType} @@ -207,8 +207,8 @@ fi if [ "$verType" == "beta" ]; then pkg_name=${pkg_name}-${verType} -elif [ "$verType" == "stable" ]; then - pkg_name=${pkg_name} +elif [ "$verType" == "stable" ]; then + pkg_name=${pkg_name} else echo "unknow verType, nor stabel or beta" exit 1 diff --git a/packaging/tools/makepkg_tq.sh b/packaging/tools/makepkg_tq.sh index 086092ea33..6f897de0ce 100755 --- a/packaging/tools/makepkg_tq.sh +++ b/packaging/tools/makepkg_tq.sh @@ -14,6 +14,7 @@ osType=$5 verMode=$6 verType=$7 pagMode=$8 +versionComp=$9 script_dir="$(dirname $(readlink -f $0))" top_dir="$(readlink -f ${script_dir}/../..)" @@ -32,10 +33,10 @@ fi # Directories and files. #if [ "$pagMode" == "lite" ]; then -# strip ${build_dir}/bin/taosd +# strip ${build_dir}/bin/taosd # strip ${build_dir}/bin/taos # bin_files="${build_dir}/bin/tqd ${build_dir}/bin/tq ${script_dir}/remove_tq.sh" -#else +#else # bin_files="${build_dir}/bin/tqd ${build_dir}/bin/tq ${build_dir}/bin/tqdemo ${build_dir}/bin/tarbitrator ${script_dir}/remove_tq.sh\ # ${script_dir}/set_core.sh ${script_dir}/startPre.sh ${script_dir}/taosd-dump-cfg.gdb" #fi @@ -70,13 +71,13 @@ mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/taos.cfg ${install_dir}/cfg/taos.cf #mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : mkdir -p ${install_dir}/bin if [ "$pagMode" == "lite" ]; then - strip ${build_dir}/bin/taosd + strip ${build_dir}/bin/taosd strip ${build_dir}/bin/taos # bin_files="${build_dir}/bin/tqd ${build_dir}/bin/tq ${script_dir}/remove_tq.sh" cp ${build_dir}/bin/taos ${install_dir}/bin/tq cp ${build_dir}/bin/taosd ${install_dir}/bin/tqd cp ${script_dir}/remove_tq.sh ${install_dir}/bin -else +else # bin_files="${build_dir}/bin/tqd ${build_dir}/bin/tq ${build_dir}/bin/tqdemo ${build_dir}/bin/tarbitrator ${script_dir}/remove_tq.sh ${script_dir}/set_core.sh" cp ${build_dir}/bin/taos ${install_dir}/bin/tq cp ${build_dir}/bin/taosd ${install_dir}/bin/tqd @@ -99,14 +100,14 @@ chmod a+x ${install_dir}/bin/* || : if [ "$verMode" == "cluster" ]; then sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove_tq.sh >> remove_tq_temp.sh mv remove_tq_temp.sh ${install_dir}/bin/remove_tq.sh - + mkdir -p ${install_dir}/nginxd && cp -r ${nginx_dir}/* ${install_dir}/nginxd cp ${nginx_dir}/png/taos.png ${install_dir}/nginxd/admin/images/taos.png rm -rf ${install_dir}/nginxd/png sed -i "s/TDengine/TQ/g" ${install_dir}/nginxd/admin/*.html sed -i "s/TDengine/TQ/g" ${install_dir}/nginxd/admin/js/*.js - + sed -i '/dataDir/ {s/taos/tq/g}' ${install_dir}/cfg/taos.cfg sed -i '/logDir/ {s/taos/tq/g}' ${install_dir}/cfg/taos.cfg sed -i "s/TDengine/TQ/g" ${install_dir}/cfg/taos.cfg @@ -154,12 +155,11 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then sed -i '/password/ {s/taosdata/tqueue/g}' ${install_dir}/examples/python/read_example.py cp -r ${examples_dir}/R ${install_dir}/examples sed -i '/password/ {s/taosdata/tqueue/g}' ${install_dir}/examples/R/command.txt - cp -r ${examples_dir}/go ${install_dir}/examples + cp -r ${examples_dir}/go ${install_dir}/examples sed -i '/root/ {s/taosdata/tqueue/g}' ${install_dir}/examples/go/taosdemo.go fi # Copy driver -mkdir -p ${install_dir}/driver -cp ${lib_files} ${install_dir}/driver +mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo "${versionComp}" > ${install_dir}/driver/vercomp.txt # Copy connector connector_dir="${code_dir}/connector" @@ -178,11 +178,11 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then echo "WARNING: go connector not found, please check if want to use it!" fi cp -r ${connector_dir}/python ${install_dir}/connector/ - + sed -i '/password/ {s/taosdata/tqueue/g}' ${install_dir}/connector/python/taos/cinterface.py - + sed -i '/password/ {s/taosdata/tqueue/g}' ${install_dir}/connector/python/taos/subscription.py - + sed -i '/self._password/ {s/taosdata/tqueue/g}' ${install_dir}/connector/python/taos/connection.py fi # Copy release note @@ -190,7 +190,7 @@ fi # exit 1 -cd ${release_dir} +cd ${release_dir} if [ "$verMode" == "cluster" ]; then pkg_name=${install_dir}-${osType}-${cpuType} @@ -207,8 +207,8 @@ fi if [ "$verType" == "beta" ]; then pkg_name=${pkg_name}-${verType} -elif [ "$verType" == "stable" ]; then - pkg_name=${pkg_name} +elif [ "$verType" == "stable" ]; then + pkg_name=${pkg_name} else echo "unknow verType, nor stabel or beta" exit 1 -- GitLab