未验证 提交 ea5d925c 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

fix: alpine support (#19353)

* fix: alpine support

* fix: ostimer thread_id

* fix: taosPrintTrace and tsStreamMax

* fix: make_install.sh and dnodes.py for alpine

* fix: cmake.platform and cut option for alpine

* fix: timer sigev and string convert

* fix: test case for alpine

* fix: fix test script for alpine

* fix: fix test script for alpine

* fix: fix taosLogTrace for Alpine

* fix: fix taosSort

* fix: vnode and mnode compare functions and test cases

* fix: sorting algorithms and unit tests

* fix: libtaosws.so build error on Alpine

* fix: libtaosws.so build error on Alpine

---------
Co-authored-by: Nt_max <1172915550@qq.com>
上级 703c4066
...@@ -37,6 +37,21 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin ...@@ -37,6 +37,21 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
SET(TD_LINUX_32 TRUE) SET(TD_LINUX_32 TRUE)
ENDIF () ENDIF ()
EXECUTE_PROCESS(COMMAND chmod 777 ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh)
EXECUTE_PROCESS(COMMAND readlink /bin/sh OUTPUT_VARIABLE SHELL_LINK)
MESSAGE(STATUS "The shell is: " ${SHELL_LINK})
IF (${SHELL_LINK} MATCHES "dash")
EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh "" OUTPUT_VARIABLE TD_OS_INFO)
ELSE ()
EXECUTE_PROCESS(COMMAND sh ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh "" OUTPUT_VARIABLE TD_OS_INFO)
ENDIF ()
MESSAGE(STATUS "The current OS is " ${TD_OS_INFO})
IF (${TD_OS_INFO} MATCHES "Alpine")
SET(TD_ALPINE TRUE)
ADD_DEFINITIONS("-D_ALPINE")
ENDIF ()
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(TD_DARWIN TRUE) SET(TD_DARWIN TRUE)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# taosws-rs # taosws-rs
ExternalProject_Add(taosws-rs ExternalProject_Add(taosws-rs
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
GIT_TAG f406d51 GIT_TAG main
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs" SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
BINARY_DIR "" BINARY_DIR ""
#BUILD_IN_SOURCE TRUE #BUILD_IN_SOURCE TRUE
......
...@@ -27,7 +27,11 @@ extern "C" { ...@@ -27,7 +27,11 @@ extern "C" {
#if !defined(WINDOWS) #if !defined(WINDOWS)
#include <dirent.h> #include <dirent.h>
#if !defined(_ALPINE)
#include <execinfo.h> #include <execinfo.h>
#endif
#include <libgen.h> #include <libgen.h>
#include <sched.h> #include <sched.h>
#include <unistd.h> #include <unistd.h>
......
...@@ -60,6 +60,13 @@ void taosSetCoreDump(bool enable); ...@@ -60,6 +60,13 @@ void taosSetCoreDump(bool enable);
#endif // WINDOWS #endif // WINDOWS
#if defined(_ALPINE)
#define _UTSNAME_LENGTH 65
#define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
#endif
typedef struct { typedef struct {
char sysname[_UTSNAME_MACHINE_LENGTH]; char sysname[_UTSNAME_MACHINE_LENGTH];
char nodename[_UTSNAME_MACHINE_LENGTH]; char nodename[_UTSNAME_MACHINE_LENGTH];
......
此差异已折叠。
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
extern "C" { extern "C" {
#endif #endif
#ifndef WINDOWS #if !defined(WINDOWS) && !defined(_ALPINE)
#ifndef __USE_XOPEN2K #ifndef __USE_XOPEN2K
#define TD_USE_SPINLOCK_AS_MUTEX #define TD_USE_SPINLOCK_AS_MUTEX
typedef pthread_mutex_t pthread_spinlock_t; typedef pthread_mutex_t pthread_spinlock_t;
...@@ -100,7 +100,11 @@ typedef pthread_key_t TdThreadKey; ...@@ -100,7 +100,11 @@ typedef pthread_key_t TdThreadKey;
#define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID #define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID
#define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID #define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID
#define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID #define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID
#if !defined(_ALPINE)
#define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID #define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID
#endif
#define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID #define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID
#define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID #define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID
#define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID #define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID
......
#!/bin/bash #!/bin/sh
# #
# 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
...@@ -340,7 +340,7 @@ function install_lib() { ...@@ -340,7 +340,7 @@ function install_lib() {
#install_avro lib64 #install_avro lib64
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
${csudo}ldconfig ${csudo}ldconfig /etc/ld.so.conf.d
fi fi
} }
......
...@@ -351,7 +351,9 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) { ...@@ -351,7 +351,9 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
if (cfgAddBool(pCfg, "SIMD-builtins", tsSIMDBuiltins, 0) != 0) return -1; if (cfgAddBool(pCfg, "SIMD-builtins", tsSIMDBuiltins, 0) != 0) return -1;
if (cfgAddInt64(pCfg, "openMax", tsOpenMax, 0, INT64_MAX, 1) != 0) return -1; if (cfgAddInt64(pCfg, "openMax", tsOpenMax, 0, INT64_MAX, 1) != 0) return -1;
#if !defined(_ALPINE)
if (cfgAddInt64(pCfg, "streamMax", tsStreamMax, 0, INT64_MAX, 1) != 0) return -1; if (cfgAddInt64(pCfg, "streamMax", tsStreamMax, 0, INT64_MAX, 1) != 0) return -1;
#endif
if (cfgAddInt32(pCfg, "pageSizeKB", tsPageSizeKB, 0, INT64_MAX, 1) != 0) return -1; if (cfgAddInt32(pCfg, "pageSizeKB", tsPageSizeKB, 0, INT64_MAX, 1) != 0) return -1;
if (cfgAddInt64(pCfg, "totalMemoryKB", tsTotalMemoryKB, 0, INT64_MAX, 1) != 0) return -1; if (cfgAddInt64(pCfg, "totalMemoryKB", tsTotalMemoryKB, 0, INT64_MAX, 1) != 0) return -1;
if (cfgAddString(pCfg, "os sysname", info.sysname, 1) != 0) return -1; if (cfgAddString(pCfg, "os sysname", info.sysname, 1) != 0) return -1;
......
...@@ -528,7 +528,12 @@ SArray *mndBuildDnodesArray(SMnode *pMnode, int32_t exceptDnodeId) { ...@@ -528,7 +528,12 @@ SArray *mndBuildDnodesArray(SMnode *pMnode, int32_t exceptDnodeId) {
return pArray; return pArray;
} }
static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { return *dnode1Id >= *dnode2Id ? 1 : 0; } static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) {
if (*dnode1Id == *dnode2Id) {
return 0;
}
return *dnode1Id > *dnode2Id ? 1 : -1;
}
static float mndGetDnodeScore(SDnodeObj *pDnode, int32_t additionDnodes, float ratio) { static float mndGetDnodeScore(SDnodeObj *pDnode, int32_t additionDnodes, float ratio) {
float totalDnodes = pDnode->numOfVnodes + (float)pDnode->numOfOtherNodes * ratio + additionDnodes; float totalDnodes = pDnode->numOfVnodes + (float)pDnode->numOfOtherNodes * ratio + additionDnodes;
...@@ -536,9 +541,12 @@ static float mndGetDnodeScore(SDnodeObj *pDnode, int32_t additionDnodes, float r ...@@ -536,9 +541,12 @@ static float mndGetDnodeScore(SDnodeObj *pDnode, int32_t additionDnodes, float r
} }
static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) { static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) {
float d1Score = mndGetDnodeScore(pDnode1, 0, 0.9); float d1Score = mndGetDnodeScore(pDnode1, 0, 0.9);
float d2Score = mndGetDnodeScore(pDnode2, 0, 0.9); float d2Score = mndGetDnodeScore(pDnode2, 0, 0.9);
return d1Score >= d2Score ? 1 : 0; if (d1Score == d2Score) {
return 0;
}
return d1Score > d2Score ? 1 : -1;
} }
void mndSortVnodeGid(SVgObj *pVgroup) { void mndSortVnodeGid(SVgObj *pVgroup) {
......
...@@ -51,6 +51,10 @@ elseif(TD_DARWIN_64) ...@@ -51,6 +51,10 @@ elseif(TD_DARWIN_64)
target_link_libraries( target_link_libraries(
os PUBLIC dl m iconv os PUBLIC dl m iconv
) )
elseif(TD_ALPINE)
target_link_libraries(
os PUBLIC dl m rt unwind
)
else() else()
target_link_libraries( target_link_libraries(
os PUBLIC dl m rt os PUBLIC dl m rt
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define ALLOW_FORBID_FUNC #define ALLOW_FORBID_FUNC
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include <stdlib.h> #include <stdlib.h>
#include "os.h" #include "talgo.h"
#ifdef WINDOWS #ifdef WINDOWS
void swapStr(char* j, char* J, int width) { void swapStr(char* j, char* J, int width) {
...@@ -41,7 +41,7 @@ int32_t qsortHelper(const void* p1, const void* p2, const void* param) { ...@@ -41,7 +41,7 @@ int32_t qsortHelper(const void* p1, const void* p2, const void* param) {
void taosSort(void* base, int64_t sz, int64_t width, __compar_fn_t compar) { void taosSort(void* base, int64_t sz, int64_t width, __compar_fn_t compar) {
#ifdef _ALPINE #ifdef _ALPINE
void* param = compar; void* param = compar;
taosqsort(base, width, sz, param, qsortHelper); taosqsort(base, sz, width, param, qsortHelper);
#else #else
qsort(base, sz, width, compar); qsort(base, sz, width, compar);
#endif #endif
......
...@@ -346,7 +346,7 @@ int64_t taosMemorySize(void *ptr) { ...@@ -346,7 +346,7 @@ int64_t taosMemorySize(void *ptr) {
} }
void taosMemoryTrim(int32_t size) { void taosMemoryTrim(int32_t size) {
#if defined(WINDOWS) || defined(DARWIN) #if defined(WINDOWS) || defined(DARWIN) || defined(_ALPINE)
// do nothing // do nothing
return; return;
#else #else
......
...@@ -351,7 +351,7 @@ char *taosStrCaseStr(const char *str, const char *pattern) { ...@@ -351,7 +351,7 @@ char *taosStrCaseStr(const char *str, const char *pattern) {
int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) { int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) {
int64_t tmp = strtoll(str, pEnd, radix); int64_t tmp = strtoll(str, pEnd, radix);
#ifdef DARWIN #if defined(DARWIN) || defined(_ALPINE)
if (errno == EINVAL) errno = 0; if (errno == EINVAL) errno = 0;
#endif #endif
#ifdef TD_CHECK_STR_TO_INT_ERROR #ifdef TD_CHECK_STR_TO_INT_ERROR
...@@ -363,7 +363,7 @@ int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) { ...@@ -363,7 +363,7 @@ int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) {
uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) { uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) {
uint64_t tmp = strtoull(str, pEnd, radix); uint64_t tmp = strtoull(str, pEnd, radix);
#ifdef DARWIN #if defined(DARWIN) || defined(_ALPINE)
if (errno == EINVAL) errno = 0; if (errno == EINVAL) errno = 0;
#endif #endif
#ifdef TD_CHECK_STR_TO_INT_ERROR #ifdef TD_CHECK_STR_TO_INT_ERROR
...@@ -375,7 +375,7 @@ uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) { ...@@ -375,7 +375,7 @@ uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) {
int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) { int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) {
int32_t tmp = strtol(str, pEnd, radix); int32_t tmp = strtol(str, pEnd, radix);
#ifdef DARWIN #if defined(DARWIN) || defined(_ALPINE)
if (errno == EINVAL) errno = 0; if (errno == EINVAL) errno = 0;
#endif #endif
#ifdef TD_CHECK_STR_TO_INT_ERROR #ifdef TD_CHECK_STR_TO_INT_ERROR
...@@ -387,7 +387,7 @@ int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) { ...@@ -387,7 +387,7 @@ int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) {
uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) { uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) {
uint32_t tmp = strtol(str, pEnd, radix); uint32_t tmp = strtol(str, pEnd, radix);
#ifdef DARWIN #if defined(DARWIN) || defined(_ALPINE)
if (errno == EINVAL) errno = 0; if (errno == EINVAL) errno = 0;
#endif #endif
#ifdef TD_CHECK_STR_TO_INT_ERROR #ifdef TD_CHECK_STR_TO_INT_ERROR
...@@ -399,7 +399,7 @@ uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) { ...@@ -399,7 +399,7 @@ uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) {
int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) { int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) {
int32_t tmp = strtol(str, pEnd, radix); int32_t tmp = strtol(str, pEnd, radix);
#ifdef DARWIN #if defined(DARWIN) || defined(_ALPINE)
if (errno == EINVAL) errno = 0; if (errno == EINVAL) errno = 0;
#endif #endif
#ifdef TD_CHECK_STR_TO_INT_ERROR #ifdef TD_CHECK_STR_TO_INT_ERROR
...@@ -413,7 +413,7 @@ int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) { ...@@ -413,7 +413,7 @@ int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) {
uint16_t taosStr2UInt16(const char *str, char **pEnd, int32_t radix) { uint16_t taosStr2UInt16(const char *str, char **pEnd, int32_t radix) {
uint32_t tmp = strtoul(str, pEnd, radix); uint32_t tmp = strtoul(str, pEnd, radix);
#ifdef DARWIN #if defined(DARWIN) || defined(_ALPINE)
if (errno == EINVAL) errno = 0; if (errno == EINVAL) errno = 0;
#endif #endif
#ifdef TD_CHECK_STR_TO_INT_ERROR #ifdef TD_CHECK_STR_TO_INT_ERROR
...@@ -437,7 +437,7 @@ int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix) { ...@@ -437,7 +437,7 @@ int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix) {
uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix) { uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix) {
uint32_t tmp = strtoul(str, pEnd, radix); uint32_t tmp = strtoul(str, pEnd, radix);
#ifdef DARWIN #if defined(DARWIN) || defined(_ALPINE)
if (errno == EINVAL) errno = 0; if (errno == EINVAL) errno = 0;
#endif #endif
#ifdef TD_CHECK_STR_TO_INT_ERROR #ifdef TD_CHECK_STR_TO_INT_ERROR
......
...@@ -124,7 +124,7 @@ static char tsProcIOFile[25] = {0}; ...@@ -124,7 +124,7 @@ static char tsProcIOFile[25] = {0};
static void taosGetProcIOnfos() { static void taosGetProcIOnfos() {
tsPageSizeKB = sysconf(_SC_PAGESIZE) / 1024; tsPageSizeKB = sysconf(_SC_PAGESIZE) / 1024;
tsOpenMax = sysconf(_SC_OPEN_MAX); tsOpenMax = sysconf(_SC_OPEN_MAX);
tsStreamMax = sysconf(_SC_STREAM_MAX); tsStreamMax = TMAX(sysconf(_SC_STREAM_MAX), 0);
tsProcId = (pid_t)syscall(SYS_gettid); tsProcId = (pid_t)syscall(SYS_gettid);
snprintf(tsProcMemFile, sizeof(tsProcMemFile), "/proc/%d/status", tsProcId); snprintf(tsProcMemFile, sizeof(tsProcMemFile), "/proc/%d/status", tsProcId);
......
...@@ -99,8 +99,8 @@ static void *taosProcessAlarmSignal(void *tharg) { ...@@ -99,8 +99,8 @@ static void *taosProcessAlarmSignal(void *tharg) {
setThreadName("tmr"); setThreadName("tmr");
#ifdef _ALPINE #ifdef _ALPINE
sevent.sigev_notify = SIGEV_THREAD; sevent.sigev_notify = SIGEV_THREAD_ID;
sevent.sigev_value.sival_int = syscall(__NR_gettid); sevent.sigev_notify_thread_id = syscall(__NR_gettid);
#else #else
sevent.sigev_notify = SIGEV_THREAD_ID; sevent.sigev_notify = SIGEV_THREAD_ID;
sevent._sigev_un._tid = syscall(__NR_gettid); sevent._sigev_un._tid = syscall(__NR_gettid);
......
...@@ -15,6 +15,7 @@ import sys ...@@ -15,6 +15,7 @@ import sys
import os import os
import os.path import os.path
import platform import platform
import distro
import subprocess import subprocess
from time import sleep from time import sleep
import base64 import base64
...@@ -22,6 +23,7 @@ import json ...@@ -22,6 +23,7 @@ import json
import copy import copy
from fabric2 import Connection from fabric2 import Connection
from util.log import * from util.log import *
from shutil import which
class TDSimClient: class TDSimClient:
...@@ -166,9 +168,9 @@ class TDDnode: ...@@ -166,9 +168,9 @@ class TDDnode:
if value: if value:
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
self.execPath = os.path.abspath(self.path + "/community/tests/script/sh/exec.sh") self.execPath = os.path.abspath(self.path + "/community/tests/script/sh/exec.sh")
else: else:
self.execPath = os.path.abspath(self.path + "/tests/script/sh/exec.sh") self.execPath = os.path.abspath(self.path + "/tests/script/sh/exec.sh")
def getDataSize(self): def getDataSize(self):
totalSize = 0 totalSize = 0
...@@ -686,7 +688,7 @@ class TDDnodes: ...@@ -686,7 +688,7 @@ class TDDnodes:
if ("community" in selfPath): if ("community" in selfPath):
self.stopDnodesPath = os.path.abspath(self.path + "/community/tests/script/sh/stop_dnodes.sh") self.stopDnodesPath = os.path.abspath(self.path + "/community/tests/script/sh/stop_dnodes.sh")
self.stopDnodesSigintPath = os.path.abspath(self.path + "/community/tests/script/sh/sigint_stop_dnodes.sh") self.stopDnodesSigintPath = os.path.abspath(self.path + "/community/tests/script/sh/sigint_stop_dnodes.sh")
else: else:
self.stopDnodesPath = os.path.abspath(self.path + "/tests/script/sh/stop_dnodes.sh") self.stopDnodesPath = os.path.abspath(self.path + "/tests/script/sh/stop_dnodes.sh")
self.stopDnodesSigintPath = os.path.abspath(self.path + "/tests/script/sh/sigint_stop_dnodes.sh") self.stopDnodesSigintPath = os.path.abspath(self.path + "/tests/script/sh/sigint_stop_dnodes.sh")
tdLog.info("run in address sanitizer mode") tdLog.info("run in address sanitizer mode")
...@@ -765,7 +767,8 @@ class TDDnodes: ...@@ -765,7 +767,8 @@ class TDDnodes:
def stopAll(self): def stopAll(self):
tdLog.info("stop all dnodes, asan:%d" % self.asan) tdLog.info("stop all dnodes, asan:%d" % self.asan)
if self.asan: distro_id = distro.id()
if self.asan and distro_id != "alpine":
tdLog.info("execute script: %s" % self.stopDnodesPath) tdLog.info("execute script: %s" % self.stopDnodesPath)
os.system(self.stopDnodesPath) os.system(self.stopDnodesPath)
tdLog.info("execute finished") tdLog.info("execute finished")
...@@ -777,24 +780,41 @@ class TDDnodes: ...@@ -777,24 +780,41 @@ class TDDnodes:
for i in range(len(self.dnodes)): for i in range(len(self.dnodes)):
self.dnodes[i].stop() self.dnodes[i].stop()
psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs"
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() if (distro_id == "alpine"):
if processID: print(distro_id)
cmd = "sudo systemctl stop taosd" psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs"
os.system(cmd) processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()
# if os.system(cmd) != 0 : while(processID):
# tdLog.exit(cmd) print(processID)
psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}' | xargs" if platform.system().lower() == 'windows':
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() killCmd = "kill -9 %s > nul 2>&1" % processID
while(processID): else:
if platform.system().lower() == 'windows': killCmd = "kill -9 %s > /dev/null 2>&1" % processID
killCmd = "kill -9 %s > nul 2>&1" % processID os.system(killCmd)
else: time.sleep(1)
killCmd = "kill -9 %s > /dev/null 2>&1" % processID processID = subprocess.check_output(
os.system(killCmd) psCmd, shell=True).decode("utf-8").strip()
time.sleep(1)
processID = subprocess.check_output( else:
psCmd, shell=True).decode("utf-8").strip() psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs"
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()
if processID:
cmd = "sudo systemctl stop taosd"
os.system(cmd)
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}' | xargs"
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()
while(processID):
if platform.system().lower() == 'windows':
killCmd = "kill -9 %s > nul 2>&1" % processID
else:
killCmd = "kill -9 %s > /dev/null 2>&1" % processID
os.system(killCmd)
time.sleep(1)
processID = subprocess.check_output(
psCmd, shell=True).decode("utf-8").strip()
if self.killValgrind == 1: if self.killValgrind == 1:
psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs" psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs"
......
...@@ -4,3 +4,7 @@ fabric2 ...@@ -4,3 +4,7 @@ fabric2
psutil psutil
pandas pandas
toml toml
distro
requests
pexpect
faker
\ No newline at end of file
...@@ -45,11 +45,7 @@ fi ...@@ -45,11 +45,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -2,7 +2,19 @@ ...@@ -2,7 +2,19 @@
set +e set +e
#set -x #set -x
if [[ "$OSTYPE" == "darwin"* ]]; then
TD_OS="Darwin"
else
OS=$(cat /etc/*-release | grep "^NAME=" | cut -d= -f2)
len=$(echo ${#OS})
len=$((len-2))
TD_OS=$(echo -ne ${OS:1:${len}} | cut -d" " -f1)
fi
if [[ "$TD_OS" == "Alpine" ]]; then
echo -e "os is Alpine,skip check Asan"
exit 0
fi
unset LD_PRELOAD unset LD_PRELOAD
SCRIPT_DIR=`dirname $0` SCRIPT_DIR=`dirname $0`
cd $SCRIPT_DIR/../ cd $SCRIPT_DIR/../
......
...@@ -48,11 +48,7 @@ fi ...@@ -48,11 +48,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -39,11 +39,7 @@ fi ...@@ -39,11 +39,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -54,11 +54,7 @@ fi ...@@ -54,11 +54,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -54,11 +54,7 @@ fi ...@@ -54,11 +54,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -54,11 +54,7 @@ fi ...@@ -54,11 +54,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -10,6 +10,14 @@ ...@@ -10,6 +10,14 @@
set +e set +e
#set -x #set -x
if [[ "$OSTYPE" == "darwin"* ]]; then
TD_OS="Darwin"
else
OS=$(cat /etc/*-release | grep "^NAME=" | cut -d= -f2)
len=$(echo ${#OS})
len=$((len-2))
TD_OS=$(echo -ne ${OS:1:${len}} | cut -d" " -f1)
fi
unset LD_PRELOAD unset LD_PRELOAD
UNAME_BIN=`which uname` UNAME_BIN=`which uname`
...@@ -44,7 +52,10 @@ do ...@@ -44,7 +52,10 @@ do
;; ;;
esac esac
done done
if [[ "$VALGRIND_OPTION" = "true" ]] && [[ "$TD_OS" == "Alpine" ]]; then
echo alpine skip valgrind
VALGRIND_OPTION="false"
fi
SCRIPT_DIR=`dirname $0` SCRIPT_DIR=`dirname $0`
cd $SCRIPT_DIR/../ cd $SCRIPT_DIR/../
SCRIPT_DIR=`pwd` SCRIPT_DIR=`pwd`
...@@ -59,11 +70,7 @@ fi ...@@ -59,11 +70,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -51,11 +51,7 @@ fi ...@@ -51,11 +51,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -20,11 +20,7 @@ fi ...@@ -20,11 +20,7 @@ fi
TAOS_DIR=`pwd` TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -51,11 +51,7 @@ fi ...@@ -51,11 +51,7 @@ fi
TOP_DIR=`pwd` TOP_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
......
...@@ -130,13 +130,13 @@ print dnode4 openVnodes $data(4)[2] ...@@ -130,13 +130,13 @@ print dnode4 openVnodes $data(4)[2]
if $data(1)[2] != 1 then if $data(1)[2] != 1 then
return -1 return -1
endi endi
if $data(2)[2] != 1 then if $data(2)[2] != 2 then
return -1 return -1
endi endi
if $data(3)[2] != 2 then if $data(3)[2] != 2 then
return -1 return -1
endi endi
if $data(4)[2] != 2 then if $data(4)[2] != 1 then
return -1 return -1
endi endi
...@@ -216,7 +216,7 @@ endi ...@@ -216,7 +216,7 @@ endi
print ========== step4 print ========== step4
sql create database d3 replica 3 vgroups 1 sql create database d3 replica 3 vgroups 1
sql create table d3.t3 (t timestamp, i int) sql create table d3.t3 (t timestamp, i int)
sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+1s, 35)
sql insert into d3.t3 values(now+2s, 34) sql insert into d3.t3 values(now+2s, 34)
sql insert into d3.t3 values(now+3s, 33) sql insert into d3.t3 values(now+3s, 33)
...@@ -231,10 +231,10 @@ print dnode5 openVnodes $data(5)[2] ...@@ -231,10 +231,10 @@ print dnode5 openVnodes $data(5)[2]
if $data(1)[2] != 2 then if $data(1)[2] != 2 then
return -1 return -1
endi endi
if $data(3)[2] != 2 then if $data(3)[2] != 3 then
return -1 return -1
endi endi
if $data(4)[2] != 3 then if $data(4)[2] != 2 then
return -1 return -1
endi endi
if $data(5)[2] != 2 then if $data(5)[2] != 2 then
...@@ -315,10 +315,10 @@ endi ...@@ -315,10 +315,10 @@ endi
if $data(3)[2] != null then if $data(3)[2] != null then
return -1 return -1
endi endi
if $data(4)[2] != 2 then if $data(4)[2] != 3 then
return -1 return -1
endi endi
if $data(5)[2] != 3 then if $data(5)[2] != 2 then
return -1 return -1
endi endi
if $data(6)[2] != 2 then if $data(6)[2] != 2 then
......
...@@ -145,10 +145,10 @@ print dnode2 openVnodes $data(4)[2] ...@@ -145,10 +145,10 @@ print dnode2 openVnodes $data(4)[2]
if $data(1)[2] != 1 then if $data(1)[2] != 1 then
return -1 return -1
endi endi
if $data(2)[2] != 1 then if $data(2)[2] != 2 then
return -1 return -1
endi endi
if $data(3)[2] != 2 then if $data(3)[2] != 1 then
return -1 return -1
endi endi
if $data(4)[2] != 1 then if $data(4)[2] != 1 then
......
...@@ -120,9 +120,9 @@ if $rows != 12 then ...@@ -120,9 +120,9 @@ if $rows != 12 then
return -1 return -1
endi endi
print =============== step3: create qnode snode on dnode 2 print =============== step3: create qnode snode on dnode 3
sql create qnode on dnode 2 sql create qnode on dnode 3
sql create snode on dnode 2 sql create snode on dnode 3
sql select * from information_schema.ins_qnodes sql select * from information_schema.ins_qnodes
if $rows != 1 then if $rows != 1 then
return -1 return -1
...@@ -136,16 +136,16 @@ print =============== step4: create mnode on dnode 2 ...@@ -136,16 +136,16 @@ print =============== step4: create mnode on dnode 2
sql create mnode on dnode 3 sql create mnode on dnode 3
sql create mnode on dnode 2 sql create mnode on dnode 2
$x = 0 $x = 0
step4: step4:
$x = $x + 1 $x = $x + 1
sleep 1000 sleep 1000
if $x == 10 then if $x == 10 then
return -1 return -1
endi endi
sql select * from information_schema.ins_mnodes -x step4 sql select * from information_schema.ins_mnodes -x step4
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[1][4] print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[1][4]
#if $data(1)[2] != leader then #if $data(1)[2] != leader then
# goto step4 # goto step4
#endi #endi
...@@ -157,7 +157,7 @@ endi ...@@ -157,7 +157,7 @@ endi
#endi #endi
print =============== step5: create dnode 5 print =============== step5: create dnode 5
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode5 -s start system sh/exec.sh -n dnode5 -s start
$x = 0 $x = 0
step5: step5:
...@@ -179,10 +179,10 @@ endi ...@@ -179,10 +179,10 @@ endi
if $data(1)[4] != ready then if $data(1)[4] != ready then
goto step5 goto step5
endi endi
if $data(2)[4] != offline then if $data(2)[4] != ready then
goto step5 goto step5
endi endi
if $data(3)[4] != ready then if $data(3)[4] != offline then
goto step5 goto step5
endi endi
if $data(4)[4] != ready then if $data(4)[4] != ready then
...@@ -192,9 +192,9 @@ if $data(5)[4] != ready then ...@@ -192,9 +192,9 @@ if $data(5)[4] != ready then
goto step5 goto step5
endi endi
print =============== step5a: drop dnode 2 print =============== step5a: drop dnode 3
sql_error drop dnode 2 sql_error drop dnode 3
sql drop dnode 2 force sql drop dnode 3 force
print select * from information_schema.ins_dnodes; print select * from information_schema.ins_dnodes;
sql select * from information_schema.ins_dnodes; sql select * from information_schema.ins_dnodes;
......
...@@ -207,10 +207,10 @@ print dnode2 openVnodes $data(4)[2] ...@@ -207,10 +207,10 @@ print dnode2 openVnodes $data(4)[2]
if $data(1)[2] != 1 then if $data(1)[2] != 1 then
return -1 return -1
endi endi
if $data(3)[2] != 1 then if $data(3)[2] != 2 then
return -1 return -1
endi endi
if $data(4)[2] != 2 then if $data(4)[2] != 1 then
return -1 return -1
endi endi
......
...@@ -13,7 +13,7 @@ sql insert into tb1 values ('2022-07-10 16:31:00', 1, '1'); ...@@ -13,7 +13,7 @@ sql insert into tb1 values ('2022-07-10 16:31:00', 1, '1');
sql insert into tb1 values ('2022-07-10 16:32:00', 2, '2'); sql insert into tb1 values ('2022-07-10 16:32:00', 2, '2');
sql insert into tb1 values ('2022-07-10 16:33:00', 3, '3'); sql insert into tb1 values ('2022-07-10 16:33:00', 3, '3');
sql insert into tb1 values ('2022-07-10 16:34:00', 4, '4'); sql insert into tb1 values ('2022-07-10 16:34:00', 4, '4');
sql select * from (select ts,TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),timediff(TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),1h) as td from tb1 where ts >='2022-06-01 00:00:00' and ts <=' 2022-11-3 23:59:59' ) t where td >12; sql select * from (select ts,TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),timediff(TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),1h) as td from tb1 where ts >='2022-06-01 00:00:00' and ts <='2022-11-3 23:59:59' ) t where td >12;
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
......
...@@ -99,6 +99,10 @@ class TDTestCase: ...@@ -99,6 +99,10 @@ class TDTestCase:
def run(self): def run(self):
distro_id = distro.id()
if distro_id == "alpine":
tdLog.info(f"alpine skip compatibility test")
return True
bPath = self.getBuildPath() bPath = self.getBuildPath()
cPath = self.getCfgPath() cPath = self.getCfgPath()
dbname = "test" dbname = "test"
......
...@@ -97,7 +97,7 @@ class TDTestCase: ...@@ -97,7 +97,7 @@ class TDTestCase:
tdSql.execute( tdSql.execute(
f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )')
for i in range(9): for i in range(1,10):
tdSql.execute( tdSql.execute(
f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )"
) )
......
...@@ -145,8 +145,8 @@ class TDTestCase: ...@@ -145,8 +145,8 @@ class TDTestCase:
tdSql.query("show db.alive;") tdSql.query("show db.alive;")
tdSql.checkData(0, 0, 1) tdSql.checkData(0, 0, 1)
# stop 5 dnode # stop 3 dnode
self.TDDnodes.stoptaosd(5) self.TDDnodes.stoptaosd(3)
tdSql.checkDataLoop(0, 0, 2, "show cluster alive;", 20, 0.5) tdSql.checkDataLoop(0, 0, 2, "show cluster alive;", 20, 0.5)
tdSql.query("show db.alive;") tdSql.query("show db.alive;")
......
...@@ -236,8 +236,8 @@ class TDTestCase: ...@@ -236,8 +236,8 @@ class TDTestCase:
tdDnodes[0].starttaosd() tdDnodes[0].starttaosd()
self.check3mnode() self.check3mnode()
tdLog.info("3. stop dnode 1") tdLog.info("3. stop dnode 2")
tdDnodes[1].stoptaosd() tdDnodes[2].stoptaosd()
time.sleep(10) time.sleep(10)
self.check3mnode1off() self.check3mnode1off()
......
...@@ -192,7 +192,7 @@ class TDTestCase: ...@@ -192,7 +192,7 @@ class TDTestCase:
topicList = topicNameList[0] topicList = topicNameList[0]
ifcheckdata = 1 ifcheckdata = 1
ifManualCommit = 1 ifManualCommit = 1
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:300, auto.offset.reset:earliest' keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:100, auto.offset.reset:earliest'
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor 0") tdLog.info("start consume processor 0")
......
...@@ -8,15 +8,23 @@ ...@@ -8,15 +8,23 @@
set +e set +e
#set -x #set -x
if [[ "$OSTYPE" == "darwin"* ]]; then
TD_OS="Darwin"
else
OS=$(cat /etc/*-release | grep "^NAME=" | cut -d= -f2)
len=$(echo ${#OS})
len=$((len - 2))
TD_OS=$(echo -ne ${OS:1:${len}} | cut -d" " -f1)
fi
UNAME_BIN=`which uname` UNAME_BIN=$(which uname)
OS_TYPE=`$UNAME_BIN` OS_TYPE=$($UNAME_BIN)
cd . cd .
# Get responsible directories # Get responsible directories
CODE_DIR=`dirname $0` CODE_DIR=$(dirname $0)
CODE_DIR=`pwd` CODE_DIR=$(pwd)
IN_TDINTERNAL="community" IN_TDINTERNAL="community"
if [[ "$CODE_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$CODE_DIR" == *"$IN_TDINTERNAL"* ]]; then
...@@ -25,19 +33,15 @@ else ...@@ -25,19 +33,15 @@ else
cd ../../ cd ../../
fi fi
TOP_DIR=`pwd` TOP_DIR=$(pwd)
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` TAOSD_DIR=$(find . -name "taosd" | grep bin | head -n1)
if [[ "$OS_TYPE" != "Darwin" ]]; then cut_opt="-f "
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` BIN_DIR=$(find . -name "taosd" | grep bin | head -n1 | cut -d '/' ${cut_opt}2,3)
else else
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2` BIN_DIR=$(find . -name "taosd" | grep bin | head -n1 | cut -d '/' ${cut_opt}2)
fi fi
declare -x BUILD_DIR=$TOP_DIR/$BIN_DIR declare -x BUILD_DIR=$TOP_DIR/$BIN_DIR
...@@ -66,35 +70,38 @@ ulimit -c unlimited ...@@ -66,35 +70,38 @@ ulimit -c unlimited
#sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e #sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e
echo "ExcuteCmd:" $* echo "ExcuteCmd:" $*
AsanFile=$ASAN_DIR/psim.info
echo "AsanFile:" $AsanFile
unset LD_PRELOAD
#export LD_PRELOAD=libasan.so.5
export LD_PRELOAD=`gcc -print-file-name=libasan.so`
echo "Preload AsanSo:" $?
$* -a 2> $AsanFile
unset LD_PRELOAD
for ((i=1;i<=20;i++))
do
AsanFileLen=`cat $AsanFile | wc -l`
echo "AsanFileLen:" $AsanFileLen
if [ $AsanFileLen -gt 10 ]; then
break
fi
sleep 1
done
AsanFileSuccessLen=`grep -w successfully $AsanFile | wc -l`
echo "AsanFileSuccessLen:" $AsanFileSuccessLen
if [ $AsanFileSuccessLen -gt 0 ]; then if [[ "$TD_OS" == "Alpine" ]]; then
echo "Execute script successfully and check asan" $*
$CODE_DIR/../script/sh/checkAsan.sh
else else
echo "Execute script failure" AsanFile=$ASAN_DIR/psim.info
exit 1 echo "AsanFile:" $AsanFile
unset LD_PRELOAD
#export LD_PRELOAD=libasan.so.5
export LD_PRELOAD=$(gcc -print-file-name=libasan.so)
echo "Preload AsanSo:" $?
$* -a 2>$AsanFile
unset LD_PRELOAD
for ((i = 1; i <= 20; i++)); do
AsanFileLen=$(cat $AsanFile | wc -l)
echo "AsanFileLen:" $AsanFileLen
if [ $AsanFileLen -gt 10 ]; then
break
fi
sleep 1
done
AsanFileSuccessLen=$(grep -w successfully $AsanFile | wc -l)
echo "AsanFileSuccessLen:" $AsanFileSuccessLen
if [ $AsanFileSuccessLen -gt 0 ]; then
echo "Execute script successfully and check asan"
$CODE_DIR/../script/sh/checkAsan.sh
else
echo "Execute script failure"
exit 1
fi
fi fi
...@@ -7,25 +7,45 @@ IF (TD_WEBSOCKET) ...@@ -7,25 +7,45 @@ IF (TD_WEBSOCKET)
SET(websocket_lib_file "{taosws.dll,taosws.dll.lib}") SET(websocket_lib_file "{taosws.dll,taosws.dll.lib}")
ENDIF () ENDIF ()
MESSAGE("${Green} use libtaos-ws${ColourReset}") MESSAGE("${Green} use libtaos-ws${ColourReset}")
IF (TD_ALPINE)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(taosws-rs ExternalProject_Add(taosws-rs
PREFIX "taosws-rs" PREFIX "taosws-rs"
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs
BUILD_ALWAYS off BUILD_ALWAYS off
DEPENDS taos DEPENDS taos
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
CONFIGURE_COMMAND cmake -E echo "taosws-rs no need cmake to config" CONFIGURE_COMMAND cmake -E echo "taosws-rs no need cmake to config"
PATCH_COMMAND PATCH_COMMAND
COMMAND git clean -f -d COMMAND git clean -f -d
BUILD_COMMAND BUILD_COMMAND
COMMAND cargo update COMMAND cargo update
COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored COMMAND RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release -p taos-ws-sys --features native-tls
INSTALL_COMMAND INSTALL_COMMAND
COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib
COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include
COMMAND cmake -E copy target/release/taosws.h ${CMAKE_BINARY_DIR}/build/include COMMAND cmake -E copy target/release/taosws.h ${CMAKE_BINARY_DIR}/build/include
) )
ELSE()
include(ExternalProject)
ExternalProject_Add(taosws-rs
PREFIX "taosws-rs"
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs
BUILD_ALWAYS off
DEPENDS taos
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND cmake -E echo "taosws-rs no need cmake to config"
PATCH_COMMAND
COMMAND git clean -f -d
BUILD_COMMAND
COMMAND cargo update
COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored
INSTALL_COMMAND
COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib
COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include
COMMAND cmake -E copy target/release/taosws.h ${CMAKE_BINARY_DIR}/build/include
)
ENDIF ()
ENDIF () ENDIF ()
IF (TD_TAOS_TOOLS) IF (TD_TAOS_TOOLS)
......
...@@ -30,15 +30,23 @@ IF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL) ...@@ -30,15 +30,23 @@ IF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL)
ADD_DEFINITIONS(-I${CMAKE_CURRENT_SOURCE_DIR}/../../../enterprise/packaging) ADD_DEFINITIONS(-I${CMAKE_CURRENT_SOURCE_DIR}/../../../enterprise/packaging)
ENDIF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL) ENDIF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL)
IF (TD_LINUX AND TD_ALPINE)
SET(LINK_ARGP "/usr/lib/libargp.a")
ELSE ()
SET(LINK_ARGP "")
ENDIF ()
if(TD_WINDOWS) if(TD_WINDOWS)
target_link_libraries(shell PUBLIC taos_static ${LINK_WEBSOCKET}) target_link_libraries(shell PUBLIC taos_static ${LINK_WEBSOCKET})
else() else()
target_link_libraries(shell PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC}) target_link_libraries(shell PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC} ${LINK_ARGP})
endif () endif ()
target_link_libraries( target_link_libraries(
shell shell
PRIVATE os common transport util PRIVATE os common transport util
) )
target_include_directories( target_include_directories(
shell shell
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
......
...@@ -97,7 +97,11 @@ void shellPrintHelp() { ...@@ -97,7 +97,11 @@ void shellPrintHelp() {
#ifdef LINUX #ifdef LINUX
#include <argp.h> #include <argp.h>
#ifdef _ALPINE
#include <termios.h>
#else
#include <termio.h> #include <termio.h>
#endif
const char *argp_program_version = version; const char *argp_program_version = version;
const char *argp_program_bug_address = cusEmail; const char *argp_program_bug_address = cusEmail;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册