Feature/sangshuduo/td 3973 use jemalloc (#6319)
* [TD-3973]<feature>: add jemalloc as submodule. * add macro definitions in cmake. * [TD-3973]<feature>: 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. Co-authored-by: Shuduo Sang <sdsang@taosdata.com>
This commit is contained in:
parent
ca3ec15956
commit
09c4c28169
|
@ -10,3 +10,6 @@
|
||||||
[submodule "tests/examples/rust"]
|
[submodule "tests/examples/rust"]
|
||||||
path = tests/examples/rust
|
path = tests/examples/rust
|
||||||
url = https://github.com/songtianyi/tdengine-rust-bindings.git
|
url = https://github.com/songtianyi/tdengine-rust-bindings.git
|
||||||
|
[submodule "deps/jemalloc"]
|
||||||
|
path = deps/jemalloc
|
||||||
|
url = https://github.com/jemalloc/jemalloc
|
||||||
|
|
|
@ -59,6 +59,11 @@ IF (TD_LINUX_64)
|
||||||
MESSAGE(STATUS "linux64 is defined")
|
MESSAGE(STATUS "linux64 is defined")
|
||||||
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
|
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
|
||||||
ADD_DEFINITIONS(-DUSE_LIBICONV)
|
ADD_DEFINITIONS(-DUSE_LIBICONV)
|
||||||
|
|
||||||
|
IF (JEMALLOC_ENABLED)
|
||||||
|
ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
IF (TD_LINUX_32)
|
IF (TD_LINUX_32)
|
||||||
|
|
|
@ -72,3 +72,8 @@ IF (${RANDOM_NETWORK_FAIL} MATCHES "true")
|
||||||
SET(TD_RANDOM_NETWORK_FAIL TRUE)
|
SET(TD_RANDOM_NETWORK_FAIL TRUE)
|
||||||
MESSAGE(STATUS "build with random-network-fail enabled")
|
MESSAGE(STATUS "build with random-network-fail enabled")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
IF (${JEMALLOC_ENABLED} MATCHES "true")
|
||||||
|
SET(TD_JEMALLOC_ENABLED TRUE)
|
||||||
|
MESSAGE(STATUS "build with jemalloc enabled")
|
||||||
|
ENDIF ()
|
||||||
|
|
|
@ -18,3 +18,16 @@ ENDIF ()
|
||||||
IF (TD_DARWIN AND TD_MQTT)
|
IF (TD_DARWIN AND TD_MQTT)
|
||||||
ADD_SUBDIRECTORY(MQTT-C)
|
ADD_SUBDIRECTORY(MQTT-C)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
|
||||||
|
MESSAGE("setup dpes/jemalloc, current source dir:" ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
MESSAGE("binary dir:" ${CMAKE_BINARY_DIR})
|
||||||
|
include(ExternalProject)
|
||||||
|
ExternalProject_Add(jemalloc
|
||||||
|
PREFIX "jemalloc"
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/build/
|
||||||
|
BUILD_COMMAND ${MAKE}
|
||||||
|
)
|
||||||
|
ENDIF ()
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit ea6b3e973b477b8061e0076bb257dbd7f3faa756
|
|
@ -6,7 +6,7 @@ set -e
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
# release.sh -v [cluster | edge]
|
# release.sh -v [cluster | edge]
|
||||||
# -c [aarch32 | aarch64 | x64 | x86 | mips64 ...]
|
# -c [aarch32 | aarch64 | x64 | x86 | mips64 ...]
|
||||||
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
|
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
|
||||||
# -V [stable | beta]
|
# -V [stable | beta]
|
||||||
# -l [full | lite]
|
# -l [full | lite]
|
||||||
|
@ -22,11 +22,12 @@ cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...]
|
||||||
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
|
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
|
||||||
pagMode=full # [full | lite]
|
pagMode=full # [full | lite]
|
||||||
soMode=dynamic # [static | dynamic]
|
soMode=dynamic # [static | dynamic]
|
||||||
|
allocator=glibc # [glibc | jemalloc]
|
||||||
dbName=taos # [taos | power]
|
dbName=taos # [taos | power]
|
||||||
verNumber=""
|
verNumber=""
|
||||||
verNumberComp="2.0.0.0"
|
verNumberComp="2.0.0.0"
|
||||||
|
|
||||||
while getopts "hv:V:c:o:l:s:d:n:m:" arg
|
while getopts "hv:V:c:o:l:s:d:a:n:m:" arg
|
||||||
do
|
do
|
||||||
case $arg in
|
case $arg in
|
||||||
v)
|
v)
|
||||||
|
@ -53,6 +54,10 @@ do
|
||||||
#echo "dbName=$OPTARG"
|
#echo "dbName=$OPTARG"
|
||||||
dbName=$(echo $OPTARG)
|
dbName=$(echo $OPTARG)
|
||||||
;;
|
;;
|
||||||
|
a)
|
||||||
|
#echo "allocator=$OPTARG"
|
||||||
|
allocator=$(echo $OPTARG)
|
||||||
|
;;
|
||||||
n)
|
n)
|
||||||
#echo "verNumber=$OPTARG"
|
#echo "verNumber=$OPTARG"
|
||||||
verNumber=$(echo $OPTARG)
|
verNumber=$(echo $OPTARG)
|
||||||
|
@ -71,20 +76,21 @@ do
|
||||||
echo " -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...] "
|
echo " -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...] "
|
||||||
echo " -V [stable | beta] "
|
echo " -V [stable | beta] "
|
||||||
echo " -l [full | lite] "
|
echo " -l [full | lite] "
|
||||||
|
echo " -a [glibc | jemalloc] "
|
||||||
echo " -s [static | dynamic] "
|
echo " -s [static | dynamic] "
|
||||||
echo " -d [taos | power] "
|
echo " -d [taos | power] "
|
||||||
echo " -n [version number] "
|
echo " -n [version number] "
|
||||||
echo " -m [compatible version number] "
|
echo " -m [compatible version number] "
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
?) #unknow option
|
?) #unknow option
|
||||||
echo "unkonw argument"
|
echo "unkonw argument"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} soMode=${soMode} dbName=${dbName} verNumber=${verNumber} verNumberComp=${verNumberComp}"
|
echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} soMode=${soMode} dbName=${dbName} allocator=${allocator} verNumber=${verNumber} verNumberComp=${verNumberComp}"
|
||||||
|
|
||||||
curr_dir=$(pwd)
|
curr_dir=$(pwd)
|
||||||
|
|
||||||
|
@ -118,7 +124,7 @@ function vercomp () {
|
||||||
echo 0
|
echo 0
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local IFS=.
|
local IFS=.
|
||||||
local i ver1=($1) ver2=($2)
|
local i ver1=($1) ver2=($2)
|
||||||
|
|
||||||
|
@ -164,7 +170,7 @@ if [[ "$verMode" == "cluster" ]]; then
|
||||||
else
|
else
|
||||||
gitinfoOfInternal=NULL
|
gitinfoOfInternal=NULL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${curr_dir}
|
cd ${curr_dir}
|
||||||
|
|
||||||
# 2. cmake executable file
|
# 2. cmake executable file
|
||||||
|
@ -180,12 +186,18 @@ else
|
||||||
fi
|
fi
|
||||||
cd ${compile_dir}
|
cd ${compile_dir}
|
||||||
|
|
||||||
|
if [[ "$allocator" == "jemalloc" ]]; then
|
||||||
|
allocator_macro="-DJEMALLOC_ENABLED=true"
|
||||||
|
else
|
||||||
|
allocator_macro=""
|
||||||
|
fi
|
||||||
|
|
||||||
# check support cpu type
|
# check support cpu type
|
||||||
if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]] ; then
|
if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]] ; then
|
||||||
if [ "$verMode" != "cluster" ]; then
|
if [ "$verMode" != "cluster" ]; then
|
||||||
cmake ../ -DCPUTYPE=${cpuType} -DOSTYPE=${osType} -DSOMODE=${soMode} -DDBNAME=${dbName} -DVERTYPE=${verType} -DVERDATE="${build_time}" -DGITINFO=${gitinfo} -DGITINFOI=${gitinfoOfInternal} -DVERNUMBER=${verNumber} -DVERCOMPATIBLE=${verNumberComp} -DPAGMODE=${pagMode}
|
cmake ../ -DCPUTYPE=${cpuType} -DOSTYPE=${osType} -DSOMODE=${soMode} -DDBNAME=${dbName} -DVERTYPE=${verType} -DVERDATE="${build_time}" -DGITINFO=${gitinfo} -DGITINFOI=${gitinfoOfInternal} -DVERNUMBER=${verNumber} -DVERCOMPATIBLE=${verNumberComp} -DPAGMODE=${pagMode} ${allocator_macro}
|
||||||
else
|
else
|
||||||
cmake ../../ -DCPUTYPE=${cpuType} -DOSTYPE=${osType} -DSOMODE=${soMode} -DDBNAME=${dbName} -DVERTYPE=${verType} -DVERDATE="${build_time}" -DGITINFO=${gitinfo} -DGITINFOI=${gitinfoOfInternal} -DVERNUMBER=${verNumber} -DVERCOMPATIBLE=${verNumberComp}
|
cmake ../../ -DCPUTYPE=${cpuType} -DOSTYPE=${osType} -DSOMODE=${soMode} -DDBNAME=${dbName} -DVERTYPE=${verType} -DVERDATE="${build_time}" -DGITINFO=${gitinfo} -DGITINFOI=${gitinfoOfInternal} -DVERNUMBER=${verNumber} -DVERCOMPATIBLE=${verNumberComp} ${allocator_macro}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "input cpuType=${cpuType} error!!!"
|
echo "input cpuType=${cpuType} error!!!"
|
||||||
|
@ -199,9 +211,9 @@ cd ${curr_dir}
|
||||||
# 3. Call the corresponding script for packaging
|
# 3. Call the corresponding script for packaging
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
if [[ "$verMode" != "cluster" ]] && [[ "$cpuType" == "x64" ]] && [[ "$dbName" == "taos" ]]; then
|
if [[ "$verMode" != "cluster" ]] && [[ "$cpuType" == "x64" ]] && [[ "$dbName" == "taos" ]]; then
|
||||||
ret='0'
|
ret='0'
|
||||||
command -v dpkg >/dev/null 2>&1 || { ret='1'; }
|
command -v dpkg >/dev/null 2>&1 || { ret='1'; }
|
||||||
if [ "$ret" -eq 0 ]; then
|
if [ "$ret" -eq 0 ]; then
|
||||||
echo "====do deb package for the ubuntu system===="
|
echo "====do deb package for the ubuntu system===="
|
||||||
output_dir="${top_dir}/debs"
|
output_dir="${top_dir}/debs"
|
||||||
if [ -d ${output_dir} ]; then
|
if [ -d ${output_dir} ]; then
|
||||||
|
@ -214,9 +226,9 @@ if [ "$osType" != "Darwin" ]; then
|
||||||
echo "==========dpkg command not exist, so not release deb package!!!"
|
echo "==========dpkg command not exist, so not release deb package!!!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ret='0'
|
ret='0'
|
||||||
command -v rpmbuild >/dev/null 2>&1 || { ret='1'; }
|
command -v rpmbuild >/dev/null 2>&1 || { ret='1'; }
|
||||||
if [ "$ret" -eq 0 ]; then
|
if [ "$ret" -eq 0 ]; then
|
||||||
echo "====do rpm package for the centos system===="
|
echo "====do rpm package for the centos system===="
|
||||||
output_dir="${top_dir}/rpms"
|
output_dir="${top_dir}/rpms"
|
||||||
if [ -d ${output_dir} ]; then
|
if [ -d ${output_dir} ]; then
|
||||||
|
@ -229,11 +241,11 @@ if [ "$osType" != "Darwin" ]; then
|
||||||
echo "==========rpmbuild command not exist, so not release rpm package!!!"
|
echo "==========rpmbuild command not exist, so not release rpm package!!!"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "====do tar.gz package for all systems===="
|
echo "====do tar.gz package for all systems===="
|
||||||
cd ${script_dir}/tools
|
cd ${script_dir}/tools
|
||||||
|
|
||||||
if [[ "$dbName" == "taos" ]]; then
|
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}
|
||||||
${csudo} ./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
|
${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}
|
${csudo} ./makearbi.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# This file is used to install TAOS time-series database on linux systems. The operating system
|
# This file is used to install TAOS time-series database on linux systems. The operating system
|
||||||
# is required to use systemd to manage services at boot
|
# is required to use systemd to manage services at boot
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
# -----------------------Variables definition---------------------
|
# -----------------------Variables definition
|
||||||
source_dir=$1
|
source_dir=$1
|
||||||
binary_dir=$2
|
binary_dir=$2
|
||||||
osType=$3
|
osType=$3
|
||||||
|
@ -71,9 +71,9 @@ if [ "$osType" != "Darwin" ]; then
|
||||||
service_mod=0
|
service_mod=0
|
||||||
elif $(which service &> /dev/null); then
|
elif $(which service &> /dev/null); then
|
||||||
service_mod=1
|
service_mod=1
|
||||||
service_config_dir="/etc/init.d"
|
service_config_dir="/etc/init.d"
|
||||||
if $(which chkconfig &> /dev/null); then
|
if $(which chkconfig &> /dev/null); then
|
||||||
initd_mod=1
|
initd_mod=1
|
||||||
elif $(which insserv &> /dev/null); then
|
elif $(which insserv &> /dev/null); then
|
||||||
initd_mod=2
|
initd_mod=2
|
||||||
elif $(which update-rc.d &> /dev/null); then
|
elif $(which update-rc.d &> /dev/null); then
|
||||||
|
@ -123,9 +123,9 @@ function kill_taosd() {
|
||||||
function install_main_path() {
|
function install_main_path() {
|
||||||
#create install main dir and all sub dir
|
#create install main dir and all sub dir
|
||||||
${csudo} rm -rf ${install_main_dir} || :
|
${csudo} rm -rf ${install_main_dir} || :
|
||||||
${csudo} mkdir -p ${install_main_dir}
|
${csudo} mkdir -p ${install_main_dir}
|
||||||
${csudo} mkdir -p ${install_main_dir}/cfg
|
${csudo} mkdir -p ${install_main_dir}/cfg
|
||||||
${csudo} mkdir -p ${install_main_dir}/bin
|
${csudo} mkdir -p ${install_main_dir}/bin
|
||||||
${csudo} mkdir -p ${install_main_dir}/connector
|
${csudo} mkdir -p ${install_main_dir}/connector
|
||||||
${csudo} mkdir -p ${install_main_dir}/driver
|
${csudo} mkdir -p ${install_main_dir}/driver
|
||||||
${csudo} mkdir -p ${install_main_dir}/examples
|
${csudo} mkdir -p ${install_main_dir}/examples
|
||||||
|
@ -176,6 +176,49 @@ function install_bin() {
|
||||||
[ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/rmtaos || :
|
[ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/rmtaos || :
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
function install_jemalloc() {
|
||||||
|
if [ "$osType" != "Darwin" ]; then
|
||||||
|
/usr/bin/install -c -d /usr/local/bin
|
||||||
|
|
||||||
|
if [ -f ${binary_dir}/build/bin/jemalloc-config ]; then
|
||||||
|
/usr/bin/install -c -m 755 ${binary_dir}/build/bin/jemalloc-config /usr/local/bin
|
||||||
|
fi
|
||||||
|
if [ -f ${binary_dir}/build/bin/jemalloc.sh ]; then
|
||||||
|
/usr/bin/install -c -m 755 ${binary_dir}/build/bin/jemalloc.sh /usr/local/bin
|
||||||
|
fi
|
||||||
|
if [ -f ${binary_dir}/build/bin/jeprof ]; then
|
||||||
|
/usr/bin/install -c -m 755 ${binary_dir}/build/bin/jeprof /usr/local/bin
|
||||||
|
fi
|
||||||
|
if [ -f ${binary_dir}/build/include/jemalloc/jemalloc.h ]; then
|
||||||
|
/usr/bin/install -c -d /usr/local/include/jemalloc
|
||||||
|
/usr/bin/install -c -m 644 ${binary_dir}/build/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
|
||||||
|
fi
|
||||||
|
if [ -f ${binary_dir}/build/lib/libjemalloc.so.2 ]; then
|
||||||
|
/usr/bin/install -c -d /usr/local/lib
|
||||||
|
/usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc.so.2 /usr/local/lib
|
||||||
|
ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
|
||||||
|
/usr/bin/install -c -d /usr/local/lib
|
||||||
|
if [ -f ${binary_dir}/build/lib/libjemalloc.a ]; then
|
||||||
|
/usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc.a /usr/local/lib
|
||||||
|
fi
|
||||||
|
if [ -f ${binary_dir}/build/lib/libjemalloc_pic.a ]; then
|
||||||
|
/usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc_pic.a /usr/local/lib
|
||||||
|
fi
|
||||||
|
if [ -f ${binary_dir}/build/lib/libjemalloc_pic.a ]; then
|
||||||
|
/usr/bin/install -c -d /usr/local/lib/pkgconfig
|
||||||
|
/usr/bin/install -c -m 644 ${binary_dir}/build/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f ${binary_dir}/build/share/doc/jemalloc/jemalloc.html ]; then
|
||||||
|
/usr/bin/install -c -d /usr/local/share/doc/jemalloc
|
||||||
|
/usr/bin/install -c -m 644 ${binary_dir}/build/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
|
||||||
|
fi
|
||||||
|
if [ -f ${binary_dir}/build/share/man/man3/jemalloc.3 ]; then
|
||||||
|
/usr/bin/install -c -d /usr/local/share/man/man3
|
||||||
|
/usr/bin/install -c -m 644 ${binary_dir}/build/share/man/man3/jemalloc.3 /usr/local/share/man/man3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function install_lib() {
|
function install_lib() {
|
||||||
# Remove links
|
# Remove links
|
||||||
|
@ -183,12 +226,12 @@ function install_lib() {
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
|
${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
${csudo} cp ${binary_dir}/build/lib/libtaos.so.${verNumber} ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
|
${csudo} cp ${binary_dir}/build/lib/libtaos.so.${verNumber} ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
|
||||||
${csudo} ln -sf ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
|
${csudo} ln -sf ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
|
||||||
${csudo} ln -sf ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
|
${csudo} ln -sf ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
|
||||||
|
|
||||||
if [ -d "${lib64_link_dir}" ]; then
|
if [ -d "${lib64_link_dir}" ]; then
|
||||||
${csudo} ln -sf ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1
|
${csudo} ln -sf ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1
|
||||||
${csudo} ln -sf ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so
|
${csudo} ln -sf ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so
|
||||||
|
@ -198,7 +241,9 @@ function install_lib() {
|
||||||
${csudo} ln -sf ${install_main_dir}/driver/libtaos.1.dylib ${lib_link_dir}/libtaos.1.dylib
|
${csudo} ln -sf ${install_main_dir}/driver/libtaos.1.dylib ${lib_link_dir}/libtaos.1.dylib
|
||||||
${csudo} ln -sf ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
|
${csudo} ln -sf ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
install_jemalloc
|
||||||
|
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
${csudo} ldconfig
|
${csudo} ldconfig
|
||||||
fi
|
fi
|
||||||
|
@ -206,26 +251,26 @@ function install_lib() {
|
||||||
|
|
||||||
function install_header() {
|
function install_header() {
|
||||||
|
|
||||||
${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
|
${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
|
||||||
${csudo} cp -f ${source_dir}/src/inc/taos.h ${source_dir}/src/inc/taoserror.h ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
|
${csudo} cp -f ${source_dir}/src/inc/taos.h ${source_dir}/src/inc/taoserror.h ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
|
||||||
${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
|
${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
|
||||||
${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
|
${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_config() {
|
function install_config() {
|
||||||
#${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
|
#${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
|
||||||
|
|
||||||
if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
|
if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
|
||||||
${csudo} mkdir -p ${cfg_install_dir}
|
${csudo} mkdir -p ${cfg_install_dir}
|
||||||
[ -f ${script_dir}/../cfg/taos.cfg ] && ${csudo} cp ${script_dir}/../cfg/taos.cfg ${cfg_install_dir}
|
[ -f ${script_dir}/../cfg/taos.cfg ] && ${csudo} cp ${script_dir}/../cfg/taos.cfg ${cfg_install_dir}
|
||||||
${csudo} chmod 644 ${cfg_install_dir}/*
|
${csudo} chmod 644 ${cfg_install_dir}/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${csudo} cp -f ${script_dir}/../cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
|
${csudo} cp -f ${script_dir}/../cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
|
||||||
${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
|
${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_log() {
|
function install_log() {
|
||||||
${csudo} rm -rf ${log_dir} || :
|
${csudo} rm -rf ${log_dir} || :
|
||||||
|
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
|
@ -239,7 +284,7 @@ function install_log() {
|
||||||
|
|
||||||
function install_data() {
|
function install_data() {
|
||||||
${csudo} mkdir -p ${data_dir}
|
${csudo} mkdir -p ${data_dir}
|
||||||
${csudo} ln -s ${data_dir} ${install_main_dir}/data
|
${csudo} ln -s ${data_dir} ${install_main_dir}/data
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_connector() {
|
function install_connector() {
|
||||||
|
@ -254,8 +299,8 @@ function install_connector() {
|
||||||
echo "WARNING: go connector not found, please check if want to use it!"
|
echo "WARNING: go connector not found, please check if want to use it!"
|
||||||
fi
|
fi
|
||||||
${csudo} cp -rf ${source_dir}/src/connector/python ${install_main_dir}/connector
|
${csudo} cp -rf ${source_dir}/src/connector/python ${install_main_dir}/connector
|
||||||
|
|
||||||
${csudo} cp ${binary_dir}/build/lib/*.jar ${install_main_dir}/connector &> /dev/null && ${csudo} chmod 777 ${install_main_dir}/connector/*.jar || echo &> /dev/null
|
${csudo} cp ${binary_dir}/build/lib/*.jar ${install_main_dir}/connector &> /dev/null && ${csudo} chmod 777 ${install_main_dir}/connector/*.jar || echo &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_examples() {
|
function install_examples() {
|
||||||
|
@ -264,8 +309,8 @@ function install_examples() {
|
||||||
|
|
||||||
function clean_service_on_sysvinit() {
|
function clean_service_on_sysvinit() {
|
||||||
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
|
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
|
||||||
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
|
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
|
||||||
|
|
||||||
if pidof taosd &> /dev/null; then
|
if pidof taosd &> /dev/null; then
|
||||||
${csudo} service taosd stop || :
|
${csudo} service taosd stop || :
|
||||||
fi
|
fi
|
||||||
|
@ -277,9 +322,9 @@ function clean_service_on_sysvinit() {
|
||||||
elif ((${initd_mod}==3)); then
|
elif ((${initd_mod}==3)); then
|
||||||
${csudo} update-rc.d -f taosd remove || :
|
${csudo} update-rc.d -f taosd remove || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${csudo} rm -f ${service_config_dir}/taosd || :
|
${csudo} rm -f ${service_config_dir}/taosd || :
|
||||||
|
|
||||||
if $(which init &> /dev/null); then
|
if $(which init &> /dev/null); then
|
||||||
${csudo} init q || :
|
${csudo} init q || :
|
||||||
fi
|
fi
|
||||||
|
@ -298,10 +343,10 @@ function install_service_on_sysvinit() {
|
||||||
${csudo} cp -f ${script_dir}/../rpm/taosd ${install_main_dir}/init.d
|
${csudo} cp -f ${script_dir}/../rpm/taosd ${install_main_dir}/init.d
|
||||||
${csudo} cp ${script_dir}/../rpm/taosd ${service_config_dir} && ${csudo} chmod a+x ${service_config_dir}/taosd
|
${csudo} cp ${script_dir}/../rpm/taosd ${service_config_dir} && ${csudo} chmod a+x ${service_config_dir}/taosd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
|
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
|
||||||
#${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
|
#${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
|
||||||
|
|
||||||
if ((${initd_mod}==1)); then
|
if ((${initd_mod}==1)); then
|
||||||
${csudo} chkconfig --add taosd || :
|
${csudo} chkconfig --add taosd || :
|
||||||
${csudo} chkconfig --level 2345 taosd on || :
|
${csudo} chkconfig --level 2345 taosd on || :
|
||||||
|
@ -323,7 +368,7 @@ function clean_service_on_systemd() {
|
||||||
${csudo} systemctl disable taosd &> /dev/null || echo &> /dev/null
|
${csudo} systemctl disable taosd &> /dev/null || echo &> /dev/null
|
||||||
|
|
||||||
${csudo} rm -f ${taosd_service_config}
|
${csudo} rm -f ${taosd_service_config}
|
||||||
}
|
}
|
||||||
|
|
||||||
# taos:2345:respawn:/etc/init.d/taosd start
|
# taos:2345:respawn:/etc/init.d/taosd start
|
||||||
|
|
||||||
|
@ -383,7 +428,7 @@ function update_TDengine() {
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_main_path
|
install_main_path
|
||||||
|
|
||||||
install_log
|
install_log
|
||||||
|
@ -431,16 +476,16 @@ function install_TDengine() {
|
||||||
# Start to install
|
# Start to install
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
echo -e "${GREEN}Start to install TDEngine...${NC}"
|
echo -e "${GREEN}Start to install TDEngine...${NC}"
|
||||||
else
|
else
|
||||||
echo -e "${GREEN}Start to install TDEngine Client ...${NC}"
|
echo -e "${GREEN}Start to install TDEngine Client ...${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_main_path
|
install_main_path
|
||||||
|
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
install_data
|
install_data
|
||||||
fi
|
fi
|
||||||
install_log
|
install_log
|
||||||
install_header
|
install_header
|
||||||
install_lib
|
install_lib
|
||||||
install_connector
|
install_connector
|
||||||
|
@ -452,7 +497,7 @@ function install_TDengine() {
|
||||||
install_service
|
install_service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_config
|
install_config
|
||||||
|
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
# Ask if to start the service
|
# Ask if to start the service
|
||||||
|
|
|
@ -10,8 +10,15 @@ INCLUDE_DIRECTORIES(${TD_ENTERPRISE_DIR}/src/inc)
|
||||||
INCLUDE_DIRECTORIES(inc)
|
INCLUDE_DIRECTORIES(inc)
|
||||||
AUX_SOURCE_DIRECTORY(src SRC)
|
AUX_SOURCE_DIRECTORY(src SRC)
|
||||||
|
|
||||||
|
IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
|
||||||
|
ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc)
|
||||||
|
SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc")
|
||||||
|
ELSE ()
|
||||||
|
SET(LINK_JEMALLOC "")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
ADD_EXECUTABLE(taosd ${SRC})
|
ADD_EXECUTABLE(taosd ${SRC})
|
||||||
TARGET_LINK_LIBRARIES(taosd mnode monitor http tsdb twal vnode cJson lz4 balance sync)
|
TARGET_LINK_LIBRARIES(taosd mnode monitor http tsdb twal vnode cJson lz4 balance sync ${LINK_JEMALLOC})
|
||||||
|
|
||||||
IF (TD_SOMODE_STATIC)
|
IF (TD_SOMODE_STATIC)
|
||||||
TARGET_LINK_LIBRARIES(taosd taos_static)
|
TARGET_LINK_LIBRARIES(taosd taos_static)
|
||||||
|
|
|
@ -11,10 +11,17 @@ IF (TD_LINUX)
|
||||||
LIST(REMOVE_ITEM SRC ./src/shellDarwin.c)
|
LIST(REMOVE_ITEM SRC ./src/shellDarwin.c)
|
||||||
ADD_EXECUTABLE(shell ${SRC})
|
ADD_EXECUTABLE(shell ${SRC})
|
||||||
|
|
||||||
|
IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
|
||||||
|
ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc)
|
||||||
|
SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc")
|
||||||
|
ELSE ()
|
||||||
|
SET(LINK_JEMALLOC "")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
IF (TD_SOMODE_STATIC)
|
IF (TD_SOMODE_STATIC)
|
||||||
TARGET_LINK_LIBRARIES(shell taos_static)
|
TARGET_LINK_LIBRARIES(shell taos_static ${LINK_JEMALLOC})
|
||||||
ELSE ()
|
ELSE ()
|
||||||
TARGET_LINK_LIBRARIES(shell taos)
|
TARGET_LINK_LIBRARIES(shell taos ${LINK_JEMALLOC})
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME taos)
|
SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME taos)
|
||||||
|
|
|
@ -55,14 +55,21 @@ ENDIF ()
|
||||||
MESSAGE("TD_VERSION_NUMBER is:" ${TD_VERSION_NUMBER})
|
MESSAGE("TD_VERSION_NUMBER is:" ${TD_VERSION_NUMBER})
|
||||||
ADD_DEFINITIONS(-DTD_VERNUMBER="${TD_VERSION_NUMBER}")
|
ADD_DEFINITIONS(-DTD_VERNUMBER="${TD_VERSION_NUMBER}")
|
||||||
|
|
||||||
|
IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
|
||||||
|
ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc)
|
||||||
|
SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc")
|
||||||
|
ELSE ()
|
||||||
|
SET(LINK_JEMALLOC "")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
IF (TD_LINUX)
|
IF (TD_LINUX)
|
||||||
AUX_SOURCE_DIRECTORY(. SRC)
|
AUX_SOURCE_DIRECTORY(. SRC)
|
||||||
ADD_EXECUTABLE(taosdemo ${SRC})
|
ADD_EXECUTABLE(taosdemo ${SRC})
|
||||||
|
|
||||||
IF (TD_SOMODE_STATIC)
|
IF (TD_SOMODE_STATIC)
|
||||||
TARGET_LINK_LIBRARIES(taosdemo taos_static cJson)
|
TARGET_LINK_LIBRARIES(taosdemo taos_static cJson ${LINK_JEMALLOC})
|
||||||
ELSE ()
|
ELSE ()
|
||||||
TARGET_LINK_LIBRARIES(taosdemo taos cJson)
|
TARGET_LINK_LIBRARIES(taosdemo taos cJson ${LINK_JEMALLOC})
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
ELSEIF (TD_WINDOWS)
|
ELSEIF (TD_WINDOWS)
|
||||||
AUX_SOURCE_DIRECTORY(. SRC)
|
AUX_SOURCE_DIRECTORY(. SRC)
|
||||||
|
@ -71,7 +78,7 @@ ELSEIF (TD_WINDOWS)
|
||||||
IF (TD_SOMODE_STATIC)
|
IF (TD_SOMODE_STATIC)
|
||||||
TARGET_LINK_LIBRARIES(taosdemo taos_static cJson)
|
TARGET_LINK_LIBRARIES(taosdemo taos_static cJson)
|
||||||
ELSE ()
|
ELSE ()
|
||||||
TARGET_LINK_LIBRARIES(taosdemo taos cJson})
|
TARGET_LINK_LIBRARIES(taosdemo taos cJson)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
ELSEIF (TD_DARWIN)
|
ELSEIF (TD_DARWIN)
|
||||||
# missing a few dependencies, such as <argp.h>
|
# missing a few dependencies, such as <argp.h>
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TD_JEMALLOC_ENABLED
|
||||||
|
#include <jemalloc/jemalloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TAOS_ALLOC_MODE_DEFAULT = 0,
|
TAOS_ALLOC_MODE_DEFAULT = 0,
|
||||||
TAOS_ALLOC_MODE_RANDOM_FAIL = 1,
|
TAOS_ALLOC_MODE_RANDOM_FAIL = 1,
|
||||||
|
|
Loading…
Reference in New Issue