diff --git a/CMakeLists.txt b/CMakeLists.txt index 565ab32f005226a13368e2df444929625092e9ad..9e2d11962ce207b11fdb4562794d79052b50ce15 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ SET(TD_MEM_CHECK FALSE) SET(TD_PAGMODE_LITE FALSE) SET(TD_SOMODE_STATIC FALSE) +SET(TD_OEM_POWER FALSE) SET(TD_GODLL FALSE) SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR}) diff --git a/cmake/define.inc b/cmake/define.inc index a63b9f1732a8c404a1b701899fae4b8588e8f7ca..166a451487b1ef21d5256c3aa0f603af4e4d4a67 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -17,6 +17,10 @@ IF (TD_GODLL) ADD_DEFINITIONS(-D_TD_GO_DLL_) ENDIF () +IF (TD_OEM_POWER) + ADD_DEFINITIONS(-D_TD_OEM_POWER_) +ENDIF () + IF (TD_MEM_CHECK) ADD_DEFINITIONS(-DTAOS_MEM_CHECK) ENDIF () diff --git a/cmake/input.inc b/cmake/input.inc index 0235ba42d33ae1cfe3659331ca3e777c3e5e8bac..2ecb2a85c750bcbcbe1fca4188ac4554485a7f9c 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -27,6 +27,11 @@ IF (${SOMODE} MATCHES "static") MESSAGE(STATUS "Link so using static mode") ENDIF () +IF (${DBNAME} MATCHES "power") + SET(TD_OEM_POWER TRUE) + MESSAGE(STATUS "OEM power is true") +ENDIF () + IF (${DLLTYPE} MATCHES "go") SET(TD_GODLL TRUE) MESSAGE(STATUS "input dll type: " ${DLLTYPE}) diff --git a/cmake/install.inc b/cmake/install.inc index 997101c8d920f9bfab01ff96e933ea73fc5e2420..decb25e3e7197916b6d637b471dce17236fb200c 100755 --- a/cmake/install.inc +++ b/cmake/install.inc @@ -4,7 +4,12 @@ IF (TD_LINUX) INSTALL(CODE "execute_process(COMMAND chmod 777 ${TD_MAKE_INSTALL_SH})") INSTALL(CODE "execute_process(COMMAND ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR})") ELSEIF (TD_WINDOWS) - SET(CMAKE_INSTALL_PREFIX C:/TDengine) + IF (TD_OEM_POWER) + SET(CMAKE_INSTALL_PREFIX C:/PowerDB) + ELSE () + SET(CMAKE_INSTALL_PREFIX C:/TDengine) + ENDIF () + IF (NOT TD_GODLL) #INSTALL(DIRECTORY ${TD_COMMUNITY_DIR}/src/connector/go DESTINATION connector) #INSTALL(DIRECTORY ${TD_COMMUNITY_DIR}/src/connector/grafana DESTINATION connector) diff --git a/packaging/release.sh b/packaging/release.sh index 3c0378042d21b5bd4325317fe46f77aa0c40cdea..7542a5b4cafb69d5cee16bddfc9a5651eb717b92 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -11,6 +11,7 @@ set -e # -V [stable | beta] # -l [full | lite] # -s [static | dynamic] +# -d [taos | power] # -n [2.0.0.3] # -m [2.0.0.0] @@ -21,10 +22,11 @@ cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...] osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...] pagMode=full # [full | lite] soMode=dynamic # [static | dynamic] +dbName=taos # [taos | power] verNumber="" verNumberComp="2.0.0.0" -while getopts "hv:V:c:o:l:s:n:m:" arg +while getopts "hv:V:c:o:l:s:d:n:m:" arg do case $arg in v) @@ -47,6 +49,10 @@ do #echo "soMode=$OPTARG" soMode=$(echo $OPTARG) ;; + d) + #echo "dbName=$OPTARG" + dbName=$(echo $OPTARG) + ;; n) #echo "verNumber=$OPTARG" verNumber=$(echo $OPTARG) @@ -66,6 +72,7 @@ do echo " -V [stable | beta] " echo " -l [full | lite] " echo " -s [static | dynamic] " + echo " -d [taos | power] " echo " -n [version number] " echo " -m [compatible version number] " exit 0 @@ -77,7 +84,7 @@ do esac done -echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} soMode=${soMode} verNumber=${verNumber} verNumberComp=${verNumberComp}" +echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} soMode=${soMode} dbName=${dbName} verNumber=${verNumber} verNumberComp=${verNumberComp}" curr_dir=$(pwd) @@ -170,9 +177,9 @@ cd ${compile_dir} # check support cpu type if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]] ; then if [ "$verMode" != "cluster" ]; then - cmake ../ -DCPUTYPE=${cpuType} -DOSTYPE=${osType} -DSOMODE=${soMode} -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} else - cmake ../../ -DCPUTYPE=${cpuType} -DOSTYPE=${osType} -DSOMODE=${soMode} -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} fi else echo "input cpuType=${cpuType} error!!!" @@ -185,7 +192,7 @@ cd ${curr_dir} # 3. Call the corresponding script for packaging if [ "$osType" != "Darwin" ]; then - if [[ "$verMode" != "cluster" ]] && [[ "$cpuType" == "x64" ]]; then + if [[ "$verMode" != "cluster" ]] && [[ "$cpuType" == "x64" ]] && [[ "$dbName" == "taos" ]]; then echo "====do deb package for the ubuntu system====" output_dir="${top_dir}/debs" if [ -d ${output_dir} ]; then @@ -208,11 +215,17 @@ if [ "$osType" != "Darwin" ]; then echo "====do tar.gz package for all systems====" cd ${script_dir}/tools - ${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} ./makearbi.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} + if [[ "$dbName" == "taos" ]]; then + ${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} ./makearbi.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} ./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 else cd ${script_dir}/tools - ./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} + ./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${dbName} fi diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index 6a1b7be191b626f59ab61510a6c2b701b85bca9e..24586d3390fe5c4f38b6292442fed2936d5ea7a6 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -85,7 +85,7 @@ function install_bin() { # Remove links ${csudo} rm -f ${bin_link_dir}/taos || : if [ "$osType" == "Darwin" ]; then - ${csudo} rm -f ${bin_link_dir}/taosdump || : + ${csudo} rm -f ${bin_link_dir}/taosdemo || : fi ${csudo} rm -f ${bin_link_dir}/rmtaos || : ${csudo} rm -f ${bin_link_dir}/set_core || : @@ -95,7 +95,7 @@ function install_bin() { #Make link [ -x ${install_main_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || : if [ "$osType" == "Darwin" ]; then - [ -x ${install_main_dir}/bin/taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || : + [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : fi [ -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/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index 8545a3e5e4b7f41c24814fd4eb327c7d86301f9d..665fb2845c83a05153cf411f65a1a4323e8cc819 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -41,7 +41,7 @@ fi if [ "$osType" != "Darwin" ]; then if [ "$pagMode" == "lite" ]; then - strip ${build_dir}/bin/taosd + #strip ${build_dir}/bin/taosd strip ${build_dir}/bin/taos bin_files="${build_dir}/bin/taos ${script_dir}/remove_client.sh" else diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index dd6fe65eb7e69ecc85c255e37e5b97d468048157..e9a4f48cf78469ac3b5d3a46cc058430d6da4d56 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -102,36 +102,31 @@ function clean_log() { function clean_service_on_systemd() { taosd_service_config="${service_config_dir}/${taos_service_name}.service" - if systemctl is-active --quiet ${taos_service_name}; then echo "TDengine taosd is running, stopping it..." ${csudo} systemctl stop ${taos_service_name} &> /dev/null || echo &> /dev/null fi ${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null - ${csudo} rm -f ${taosd_service_config} - + + tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service" + if systemctl is-active --quiet ${tarbitrator_service_name}; then + echo "TDengine tarbitrator is running, stopping it..." + ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null + fi + ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null + ${csudo} rm -f ${tarbitratord_service_config} + if [ "$verMode" == "cluster" ]; then - tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service" - - if systemctl is-active --quiet ${tarbitrator_service_name}; then - echo "TDengine tarbitrator is running, stopping it..." - ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null - fi - ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null - - ${csudo} rm -f ${tarbitratord_service_config} - - nginx_service_config="${service_config_dir}/${nginx_service_name}.service" - if [ -d ${bin_dir}/web ]; then - if systemctl is-active --quiet ${nginx_service_name}; then - echo "Nginx for TDengine is running, stopping it..." - ${csudo} systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null - fi - ${csudo} systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null - - ${csudo} rm -f ${nginx_service_config} + nginx_service_config="${service_config_dir}/${nginx_service_name}.service" + if [ -d ${bin_dir}/web ]; then + if systemctl is-active --quiet ${nginx_service_name}; then + echo "Nginx for TDengine is running, stopping it..." + ${csudo} systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null fi + ${csudo} systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null + ${csudo} rm -f ${nginx_service_config} + fi fi } @@ -227,3 +222,4 @@ elif echo $osinfo | grep -qwi "centos" ; then fi echo -e "${GREEN}TDengine is removed successfully!${NC}" +echo \ No newline at end of file diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index 7cbf524d04734e5b5a73b37c44bf23b2c0254157..2c28b7b6bf41b3798d533b8835a5ff311eecfdb4 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -39,6 +39,7 @@ function clean_bin() { ${csudo} rm -f ${bin_link_dir}/taos || : ${csudo} rm -f ${bin_link_dir}/taosdemo || : ${csudo} rm -f ${bin_link_dir}/rmtaos || : + ${csudo} rm -f ${bin_link_dir}/set_core || : } function clean_lib() { @@ -80,3 +81,4 @@ clean_config ${csudo} rm -rf ${install_main_dir} echo -e "${GREEN}TDengine client is removed successfully!${NC}" +echo diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index b61890347f8af8e37cf0664c83c02e55f829a27d..4c8b4482927312a8f42e99f62275bec3ca9de80f 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -85,7 +85,11 @@ extern const int32_t TYPE_BYTES[11]; #define TSDB_DATA_NULL_STR_L "null" #define TSDB_DEFAULT_USER "root" +#ifdef _TD_OEM_POWER_ +#define TSDB_DEFAULT_PASS "powerdb" +#else #define TSDB_DEFAULT_PASS "taosdata" +#endif #define TSDB_TRUE 1 #define TSDB_FALSE 0 diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 8f7f4d9324d01778daef9958db2ce97634d2f223..18f4feb0134bb1a8d478b8e650f07b432de329d8 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -30,11 +30,22 @@ #include /**************** Global variables ****************/ +#ifdef _TD_OEM_POWER_ +char CLIENT_VERSION[] = "Welcome to the PowerDB shell from %s, Client Version:%s\n" + "Copyright (c) 2017 by PowerDB, Inc. All rights reserved.\n\n"; +char PROMPT_HEADER[] = "power> "; + +char CONTINUE_PROMPT[] = " -> "; +int prompt_size = 7; +#else char CLIENT_VERSION[] = "Welcome to the TDengine shell from %s, Client Version:%s\n" "Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.\n\n"; char PROMPT_HEADER[] = "taos> "; + char CONTINUE_PROMPT[] = " -> "; int prompt_size = 6; +#endif + TAOS_RES *result = NULL; SShellHistory history; diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 6469990c780bac6b9d7ec1161459dd234bacff19..99fa92adb3470268c85212e5b83641f4ca78f42e 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -89,7 +89,11 @@ typedef struct DemoArguments { {0, 'h', "host", 0, "The host to connect to TDengine. Default is localhost.", 0}, {0, 'p', "port", 0, "The TCP/IP port number to use for the connection. Default is 0.", 1}, {0, 'u', "user", 0, "The TDengine user name to use when connecting to the server. Default is 'root'.", 2}, + #ifdef _TD_OEM_POWER_ + {0, 'P', "password", 0, "The password to use when connecting to the server. Default is 'powerdb'.", 3}, + #else {0, 'P', "password", 0, "The password to use when connecting to the server. Default is 'taosdata'.", 3}, + #endif {0, 'd', "database", 0, "Destination database. Default is 'test'.", 3}, {0, 'a', "replica", 0, "Set the replica parameters of the database, Default 1, min: 1, max: 3.", 3}, {0, 'm', "table_prefix", 0, "Table prefix name. Default is 't'.", 3}, @@ -104,7 +108,11 @@ typedef struct DemoArguments { {0, 'r', "num_of_records_per_req", 0, "The number of records per request. Default is 1000.", 10}, {0, 't', "num_of_tables", 0, "The number of tables. Default is 10000.", 11}, {0, 'n', "num_of_records_per_table", 0, "The number of records per table. Default is 100000.", 12}, + #ifdef _TD_OEM_POWER_ + {0, 'c', "config_directory", 0, "Configuration directory. Default is '/etc/power/'.", 14}, + #else {0, 'c', "config_directory", 0, "Configuration directory. Default is '/etc/taos/'.", 14}, + #endif {0, 'x', 0, 0, "Insert only flag.", 13}, {0, 'O', "order", 0, "Insert mode--0: In order, 1: Out of order. Default is in order.", 14}, {0, 'R', "rate", 0, "Out of order data's rate--if order=1 Default 10, min: 0, max: 50.", 14}, @@ -279,7 +287,11 @@ typedef struct DemoArguments { printf("%s%s\n", indent, "-u"); printf("%s%s%s\n", indent, indent, "user, The user name to use when connecting to the server. Default is 'root'."); printf("%s%s\n", indent, "-p"); + #ifdef _TD_OEM_POWER_ + printf("%s%s%s\n", indent, indent, "password, The password to use when connecting to the server. Default is 'powerdb'."); + #else printf("%s%s%s\n", indent, indent, "password, The password to use when connecting to the server. Default is 'taosdata'."); + #endif printf("%s%s\n", indent, "-d"); printf("%s%s%s\n", indent, indent, "database, Destination database. Default is 'test'."); printf("%s%s\n", indent, "-a"); @@ -309,7 +321,11 @@ typedef struct DemoArguments { printf("%s%s\n", indent, "-n"); printf("%s%s%s\n", indent, indent, "num_of_records_per_table, The number of records per table. Default is 100000."); printf("%s%s\n", indent, "-c"); + #ifdef _TD_OEM_POWER_ + printf("%s%s%s\n", indent, indent, "config_directory, Configuration directory. Default is '/etc/power/'."); + #else printf("%s%s%s\n", indent, indent, "config_directory, Configuration directory. Default is '/etc/taos/'."); + #endif printf("%s%s\n", indent, "-x"); printf("%s%s%s\n", indent, indent, "flag, Insert only flag."); printf("%s%s\n", indent, "-O"); @@ -513,7 +529,11 @@ int main(int argc, char *argv[]) { SDemoArguments arguments = { NULL, // host 0, // port "root", // user + #ifdef _TD_OEM_POWER_ + "powerdb", // password + #else "taosdata", // password + #endif "test", // database 1, // replica "t", // tb_prefix diff --git a/src/os/src/linux/linuxEnv.c b/src/os/src/linux/linuxEnv.c index 811d98ad7f8c34851e70ccbd190a13b74d865703..6946017e99f010ed06d69ec0094872b05152d1a6 100644 --- a/src/os/src/linux/linuxEnv.c +++ b/src/os/src/linux/linuxEnv.c @@ -18,15 +18,25 @@ #include "tglobal.h" void osInit() { + +#ifdef _TD_OEM_POWER_ + if (configDir[0] == 0) { + strcpy(configDir, "/etc/power"); + } + strcpy(tsDataDir, "/var/lib/power"); + strcpy(tsLogDir, "/var/log/power"); + strcpy(tsScriptDir, "/etc/power"); +#else if (configDir[0] == 0) { strcpy(configDir, "/etc/taos"); } + strcpy(tsDataDir, "/var/lib/taos"); + strcpy(tsLogDir, "/var/log/taos"); + strcpy(tsScriptDir, "/etc/taos"); +#endif strcpy(tsVnodeDir, ""); strcpy(tsDnodeDir, ""); strcpy(tsMnodeDir, ""); - strcpy(tsDataDir, "/var/lib/taos"); - strcpy(tsLogDir, "/var/log/taos"); - strcpy(tsScriptDir, "/etc/taos"); strcpy(tsOsName, "Linux"); } \ No newline at end of file diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index 704af2017e4acae1992b645fe6c60ba3157e5bcc..a976369287a1767bfeced61be19e279f2b939769 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -260,8 +260,13 @@ void taosReadGlobalLogCfg() { } strcpy(configDir, full_path.we_wordv[0]); } else { + #ifdef _TD_OEM_POWER_ + printf("configDir:%s not there, use default value: /etc/power", configDir); + strcpy(configDir, "/etc/power"); + #else printf("configDir:%s not there, use default value: /etc/taos", configDir); strcpy(configDir, "/etc/taos"); + #endif } wordfree(&full_path); diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index cf6ccdcbce8c25751bf9014fa696bae5e62ab825..f532e2e93cc17e7c9c755f395460a0cd9f5fad20 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -66,7 +66,11 @@ int32_t tsAsyncLog = 1; float tsTotalLogDirGB = 0; float tsAvailLogDirGB = 0; float tsMinimalLogDirGB = 0.1f; +#ifdef _TD_OEM_POWER_ +char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/power"; +#else char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/taos"; +#endif static SLogObj tsLogObj = { .fileNum = 1 }; static void * taosAsyncOutputLog(void *param);