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: t_max <1172915550@qq.com>
This commit is contained in:
parent
703c4066eb
commit
ea5d925c50
|
@ -37,6 +37,21 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
|
|||
SET(TD_LINUX_32 TRUE)
|
||||
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")
|
||||
|
||||
SET(TD_DARWIN TRUE)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taosws-rs
|
||||
ExternalProject_Add(taosws-rs
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
||||
GIT_TAG f406d51
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -27,7 +27,11 @@ extern "C" {
|
|||
|
||||
#if !defined(WINDOWS)
|
||||
#include <dirent.h>
|
||||
|
||||
#if !defined(_ALPINE)
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
#include <libgen.h>
|
||||
#include <sched.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -60,6 +60,13 @@ void taosSetCoreDump(bool enable);
|
|||
|
||||
#endif // WINDOWS
|
||||
|
||||
#if defined(_ALPINE)
|
||||
|
||||
#define _UTSNAME_LENGTH 65
|
||||
#define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char sysname[_UTSNAME_MACHINE_LENGTH];
|
||||
char nodename[_UTSNAME_MACHINE_LENGTH];
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
#ifndef _TD_OS_SYSTEM_H_
|
||||
#define _TD_OS_SYSTEM_H_
|
||||
|
||||
#ifdef _ALPINE
|
||||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -29,46 +34,124 @@ extern "C" {
|
|||
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
typedef struct TdCmd* TdCmdPtr;
|
||||
typedef struct TdCmd *TdCmdPtr;
|
||||
|
||||
TdCmdPtr taosOpenCmd(const char* cmd);
|
||||
int64_t taosGetsCmd(TdCmdPtr pCmd, int32_t maxSize, char* __restrict buf);
|
||||
int64_t taosGetLineCmd(TdCmdPtr pCmd, char** __restrict ptrBuf);
|
||||
int32_t taosEOFCmd(TdCmdPtr pCmd);
|
||||
int64_t taosCloseCmd(TdCmdPtr* ppCmd);
|
||||
TdCmdPtr taosOpenCmd(const char *cmd);
|
||||
|
||||
void* taosLoadDll(const char* filename);
|
||||
void* taosLoadSym(void* handle, char* name);
|
||||
void taosCloseDll(void* handle);
|
||||
int64_t taosGetsCmd(TdCmdPtr pCmd, int32_t maxSize, char *__restrict buf);
|
||||
|
||||
int64_t taosGetLineCmd(TdCmdPtr pCmd, char **__restrict ptrBuf);
|
||||
|
||||
int32_t taosEOFCmd(TdCmdPtr pCmd);
|
||||
|
||||
int64_t taosCloseCmd(TdCmdPtr *ppCmd);
|
||||
|
||||
void *taosLoadDll(const char *filename);
|
||||
|
||||
void *taosLoadSym(void *handle, char *name);
|
||||
|
||||
void taosCloseDll(void *handle);
|
||||
|
||||
int32_t taosSetConsoleEcho(bool on);
|
||||
void taosSetTerminalMode();
|
||||
|
||||
void taosSetTerminalMode();
|
||||
|
||||
int32_t taosGetOldTerminalMode();
|
||||
void taosResetTerminalMode();
|
||||
|
||||
void taosResetTerminalMode();
|
||||
|
||||
#define STACKSIZE 100
|
||||
|
||||
#if !defined(WINDOWS)
|
||||
#define taosLogTraceToBuf(buf, bufSize, ignoreNum) { \
|
||||
void* array[STACKSIZE]; \
|
||||
int32_t size = backtrace(array, STACKSIZE); \
|
||||
char** strings = backtrace_symbols(array, size); \
|
||||
int32_t offset = 0; \
|
||||
if (strings != NULL) { \
|
||||
offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \
|
||||
for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \
|
||||
offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, strings[i]); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
taosMemoryFree(strings); \
|
||||
}
|
||||
#if defined(_ALPINE)
|
||||
#define taosLogTraceToBuf(buf, bufSize, ignoreNum) \
|
||||
{ \
|
||||
unw_cursor_t cursor; \
|
||||
unw_context_t context; \
|
||||
\
|
||||
unw_getcontext(&context); \
|
||||
unw_init_local(&cursor, &context); \
|
||||
\
|
||||
char *array[STACKSIZE]; \
|
||||
int32_t size = 0; \
|
||||
int32_t ignores = ignoreNum; \
|
||||
int32_t offset = 0; \
|
||||
while (unw_step(&cursor) > 0 && size < STACKSIZE) { \
|
||||
unw_word_t offset, pc; \
|
||||
char fname[64]; \
|
||||
unw_get_reg(&cursor, UNW_REG_IP, &pc); \
|
||||
fname[0] = '\0'; \
|
||||
(void)unw_get_proc_name(&cursor, fname, sizeof(fname), &offset); \
|
||||
size += 1; \
|
||||
array[size] = (char *)taosMemoryMalloc(sizeof(char) * STACKSIZE + 1); \
|
||||
snprintf(array[size], STACKSIZE, "0x%lx : (%s+0x%lx) [0x%lx]\n", (long)pc, fname, (long)offset, (long)pc); \
|
||||
} \
|
||||
if (ignoreNum < size && size > 0) { \
|
||||
offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \
|
||||
for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \
|
||||
offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, \
|
||||
array[i]); \
|
||||
} \
|
||||
} \
|
||||
for (int i = 0; i < size; i++) { \
|
||||
taosMemoryFree(array[i]); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define taosPrintTrace(flags, level, dflag, ignoreNum) \
|
||||
{ \
|
||||
unw_cursor_t cursor; \
|
||||
unw_context_t context; \
|
||||
\
|
||||
unw_getcontext(&context); \
|
||||
unw_init_local(&cursor, &context); \
|
||||
\
|
||||
char *array[STACKSIZE]; \
|
||||
int32_t size = 0; \
|
||||
while (unw_step(&cursor) > 0 && size < STACKSIZE) { \
|
||||
unw_word_t offset, pc; \
|
||||
char fname[64]; \
|
||||
unw_get_reg(&cursor, UNW_REG_IP, &pc); \
|
||||
fname[0] = '\0'; \
|
||||
(void)unw_get_proc_name(&cursor, fname, sizeof(fname), &offset); \
|
||||
size += 1; \
|
||||
array[size] = (char *)taosMemoryMalloc(sizeof(char) * STACKSIZE + 1); \
|
||||
snprintf(array[size], STACKSIZE, "frame:%d, 0x%lx : (%s+0x%lx) [0x%lx]\n", size, (long)pc, fname, (long)offset, \
|
||||
(long)pc); \
|
||||
} \
|
||||
if (ignoreNum < size && size > 0) { \
|
||||
taosPrintLog(flags, level, dflag, "obtained %d stack frames", (ignoreNum > 0) ? size - ignoreNum : size); \
|
||||
for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \
|
||||
taosPrintLog(flags, level, dflag, "frame:%d, %s", (ignoreNum > 0) ? i - ignoreNum : i, array[i]); \
|
||||
} \
|
||||
} \
|
||||
for (int i = 0; i < size; i++) { \
|
||||
taosMemoryFree(array[i]); \
|
||||
} \
|
||||
}
|
||||
|
||||
#elif !defined(WINDOWS)
|
||||
#define taosLogTraceToBuf(buf, bufSize, ignoreNum) \
|
||||
{ \
|
||||
void *array[STACKSIZE]; \
|
||||
int32_t size = backtrace(array, STACKSIZE); \
|
||||
char **strings = backtrace_symbols(array, size); \
|
||||
int32_t offset = 0; \
|
||||
if (strings != NULL) { \
|
||||
offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \
|
||||
for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \
|
||||
offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, \
|
||||
strings[i]); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
taosMemoryFree(strings); \
|
||||
}
|
||||
|
||||
#define taosPrintTrace(flags, level, dflag, ignoreNum) \
|
||||
{ \
|
||||
void* array[STACKSIZE]; \
|
||||
int32_t size = backtrace(array, STACKSIZE); \
|
||||
char** strings = backtrace_symbols(array, size); \
|
||||
void *array[STACKSIZE]; \
|
||||
int32_t size = backtrace(array, STACKSIZE); \
|
||||
char **strings = backtrace_symbols(array, size); \
|
||||
if (strings != NULL) { \
|
||||
taosPrintLog(flags, level, dflag, "obtained %d stack frames", (ignoreNum > 0) ? size - ignoreNum : size); \
|
||||
for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \
|
||||
|
@ -80,65 +163,70 @@ void taosResetTerminalMode();
|
|||
}
|
||||
#else
|
||||
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define taosLogTraceToBuf(buf, bufSize, ignoreNum) { \
|
||||
unsigned int i; \
|
||||
void* stack[STACKSIZE]; \
|
||||
unsigned short frames; \
|
||||
SYMBOL_INFO* symbol; \
|
||||
HANDLE process; \
|
||||
int32_t offset = 0; \
|
||||
\
|
||||
process = GetCurrentProcess(); \
|
||||
\
|
||||
SymInitialize(process, NULL, TRUE); \
|
||||
\
|
||||
frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \
|
||||
symbol = (SYMBOL_INFO*)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \
|
||||
if (symbol != NULL) { \
|
||||
symbol->MaxNameLen = 255; \
|
||||
symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \
|
||||
\
|
||||
if (frames > 0) { \
|
||||
offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? frames - ignoreNum : frames); \
|
||||
for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \
|
||||
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \
|
||||
offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%i, %s - 0x%0X\n", (ignoreNum > 0) ? i - ignoreNum : i, symbol->Name, symbol->Address); \
|
||||
} \
|
||||
} \
|
||||
free(symbol); \
|
||||
} \
|
||||
#define taosLogTraceToBuf(buf, bufSize, ignoreNum) \
|
||||
{ \
|
||||
unsigned int i; \
|
||||
void *stack[STACKSIZE]; \
|
||||
unsigned short frames; \
|
||||
SYMBOL_INFO *symbol; \
|
||||
HANDLE process; \
|
||||
int32_t offset = 0; \
|
||||
\
|
||||
process = GetCurrentProcess(); \
|
||||
\
|
||||
SymInitialize(process, NULL, TRUE); \
|
||||
\
|
||||
frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \
|
||||
symbol = (SYMBOL_INFO *)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \
|
||||
if (symbol != NULL) { \
|
||||
symbol->MaxNameLen = 255; \
|
||||
symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \
|
||||
\
|
||||
if (frames > 0) { \
|
||||
offset = \
|
||||
snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? frames - ignoreNum : frames); \
|
||||
for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \
|
||||
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \
|
||||
offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%i, %s - 0x%0X\n", \
|
||||
(ignoreNum > 0) ? i - ignoreNum : i, symbol->Name, symbol->Address); \
|
||||
} \
|
||||
} \
|
||||
free(symbol); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define taosPrintTrace(flags, level, dflag, ignoreNum) \
|
||||
#define taosPrintTrace(flags, level, dflag, ignoreNum) \
|
||||
{ \
|
||||
unsigned int i; \
|
||||
void* stack[STACKSIZE]; \
|
||||
unsigned short frames; \
|
||||
SYMBOL_INFO* symbol; \
|
||||
HANDLE process; \
|
||||
\
|
||||
process = GetCurrentProcess(); \
|
||||
\
|
||||
SymInitialize(process, NULL, TRUE); \
|
||||
\
|
||||
frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \
|
||||
symbol = (SYMBOL_INFO*)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \
|
||||
if (symbol != NULL) { \
|
||||
symbol->MaxNameLen = 255; \
|
||||
symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \
|
||||
\
|
||||
if (frames > 0) { \
|
||||
taosPrintLog(flags, level, dflag, "obtained %d stack frames\n", (ignoreNum > 0) ? frames - ignoreNum : frames); \
|
||||
for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \
|
||||
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \
|
||||
taosPrintLog(flags, level, dflag, "frame:%i, %s - 0x%0X\n", (ignoreNum > 0) ? i - ignoreNum : i, symbol->Name, symbol->Address); \
|
||||
} \
|
||||
} \
|
||||
free(symbol); \
|
||||
} \
|
||||
unsigned int i; \
|
||||
void *stack[STACKSIZE]; \
|
||||
unsigned short frames; \
|
||||
SYMBOL_INFO *symbol; \
|
||||
HANDLE process; \
|
||||
\
|
||||
process = GetCurrentProcess(); \
|
||||
\
|
||||
SymInitialize(process, NULL, TRUE); \
|
||||
\
|
||||
frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \
|
||||
symbol = (SYMBOL_INFO *)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \
|
||||
if (symbol != NULL) { \
|
||||
symbol->MaxNameLen = 255; \
|
||||
symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \
|
||||
\
|
||||
if (frames > 0) { \
|
||||
taosPrintLog(flags, level, dflag, "obtained %d stack frames\n", \
|
||||
(ignoreNum > 0) ? frames - ignoreNum : frames); \
|
||||
for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \
|
||||
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \
|
||||
taosPrintLog(flags, level, dflag, "frame:%i, %s - 0x%0X\n", (ignoreNum > 0) ? i - ignoreNum : i, \
|
||||
symbol->Name, symbol->Address); \
|
||||
} \
|
||||
} \
|
||||
free(symbol); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef WINDOWS
|
||||
#if !defined(WINDOWS) && !defined(_ALPINE)
|
||||
#ifndef __USE_XOPEN2K
|
||||
#define TD_USE_SPINLOCK_AS_MUTEX
|
||||
typedef pthread_mutex_t pthread_spinlock_t;
|
||||
|
@ -100,7 +100,11 @@ typedef pthread_key_t TdThreadKey;
|
|||
#define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID
|
||||
|
||||
#if !defined(_ALPINE)
|
||||
#define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
#define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID
|
||||
#define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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
|
||||
|
@ -340,7 +340,7 @@ function install_lib() {
|
|||
#install_avro lib64
|
||||
|
||||
if [ "$osType" != "Darwin" ]; then
|
||||
${csudo}ldconfig
|
||||
${csudo}ldconfig /etc/ld.so.conf.d
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -351,7 +351,9 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
|
|||
if (cfgAddBool(pCfg, "SIMD-builtins", tsSIMDBuiltins, 0) != 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;
|
||||
#endif
|
||||
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 (cfgAddString(pCfg, "os sysname", info.sysname, 1) != 0) return -1;
|
||||
|
|
|
@ -528,7 +528,12 @@ SArray *mndBuildDnodesArray(SMnode *pMnode, int32_t exceptDnodeId) {
|
|||
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) {
|
||||
float totalDnodes = pDnode->numOfVnodes + (float)pDnode->numOfOtherNodes * ratio + additionDnodes;
|
||||
|
@ -536,9 +541,12 @@ static float mndGetDnodeScore(SDnodeObj *pDnode, int32_t additionDnodes, float r
|
|||
}
|
||||
|
||||
static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) {
|
||||
float d1Score = mndGetDnodeScore(pDnode1, 0, 0.9);
|
||||
float d2Score = mndGetDnodeScore(pDnode2, 0, 0.9);
|
||||
return d1Score >= d2Score ? 1 : 0;
|
||||
float d1Score = mndGetDnodeScore(pDnode1, 0, 0.9);
|
||||
float d2Score = mndGetDnodeScore(pDnode2, 0, 0.9);
|
||||
if (d1Score == d2Score) {
|
||||
return 0;
|
||||
}
|
||||
return d1Score > d2Score ? 1 : -1;
|
||||
}
|
||||
|
||||
void mndSortVnodeGid(SVgObj *pVgroup) {
|
||||
|
|
|
@ -51,6 +51,10 @@ elseif(TD_DARWIN_64)
|
|||
target_link_libraries(
|
||||
os PUBLIC dl m iconv
|
||||
)
|
||||
elseif(TD_ALPINE)
|
||||
target_link_libraries(
|
||||
os PUBLIC dl m rt unwind
|
||||
)
|
||||
else()
|
||||
target_link_libraries(
|
||||
os PUBLIC dl m rt
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#define ALLOW_FORBID_FUNC
|
||||
#define _DEFAULT_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include "os.h"
|
||||
#include "talgo.h"
|
||||
|
||||
#ifdef WINDOWS
|
||||
void swapStr(char* j, char* J, int width) {
|
||||
|
@ -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) {
|
||||
#ifdef _ALPINE
|
||||
void* param = compar;
|
||||
taosqsort(base, width, sz, param, qsortHelper);
|
||||
taosqsort(base, sz, width, param, qsortHelper);
|
||||
#else
|
||||
qsort(base, sz, width, compar);
|
||||
#endif
|
||||
|
|
|
@ -346,7 +346,7 @@ int64_t taosMemorySize(void *ptr) {
|
|||
}
|
||||
|
||||
void taosMemoryTrim(int32_t size) {
|
||||
#if defined(WINDOWS) || defined(DARWIN)
|
||||
#if defined(WINDOWS) || defined(DARWIN) || defined(_ALPINE)
|
||||
// do nothing
|
||||
return;
|
||||
#else
|
||||
|
|
|
@ -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 tmp = strtoll(str, pEnd, radix);
|
||||
#ifdef DARWIN
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
|
@ -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 tmp = strtoull(str, pEnd, radix);
|
||||
#ifdef DARWIN
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
|
@ -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 tmp = strtol(str, pEnd, radix);
|
||||
#ifdef DARWIN
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
|
@ -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 tmp = strtol(str, pEnd, radix);
|
||||
#ifdef DARWIN
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
|
@ -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) {
|
||||
int32_t tmp = strtol(str, pEnd, radix);
|
||||
#ifdef DARWIN
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
|
@ -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) {
|
||||
uint32_t tmp = strtoul(str, pEnd, radix);
|
||||
#ifdef DARWIN
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
|
@ -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) {
|
||||
uint32_t tmp = strtoul(str, pEnd, radix);
|
||||
#ifdef DARWIN
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
|
|
|
@ -124,7 +124,7 @@ static char tsProcIOFile[25] = {0};
|
|||
static void taosGetProcIOnfos() {
|
||||
tsPageSizeKB = sysconf(_SC_PAGESIZE) / 1024;
|
||||
tsOpenMax = sysconf(_SC_OPEN_MAX);
|
||||
tsStreamMax = sysconf(_SC_STREAM_MAX);
|
||||
tsStreamMax = TMAX(sysconf(_SC_STREAM_MAX), 0);
|
||||
tsProcId = (pid_t)syscall(SYS_gettid);
|
||||
|
||||
snprintf(tsProcMemFile, sizeof(tsProcMemFile), "/proc/%d/status", tsProcId);
|
||||
|
|
|
@ -99,8 +99,8 @@ static void *taosProcessAlarmSignal(void *tharg) {
|
|||
setThreadName("tmr");
|
||||
|
||||
#ifdef _ALPINE
|
||||
sevent.sigev_notify = SIGEV_THREAD;
|
||||
sevent.sigev_value.sival_int = syscall(__NR_gettid);
|
||||
sevent.sigev_notify = SIGEV_THREAD_ID;
|
||||
sevent.sigev_notify_thread_id = syscall(__NR_gettid);
|
||||
#else
|
||||
sevent.sigev_notify = SIGEV_THREAD_ID;
|
||||
sevent._sigev_un._tid = syscall(__NR_gettid);
|
||||
|
|
|
@ -15,6 +15,7 @@ import sys
|
|||
import os
|
||||
import os.path
|
||||
import platform
|
||||
import distro
|
||||
import subprocess
|
||||
from time import sleep
|
||||
import base64
|
||||
|
@ -22,6 +23,7 @@ import json
|
|||
import copy
|
||||
from fabric2 import Connection
|
||||
from util.log import *
|
||||
from shutil import which
|
||||
|
||||
|
||||
class TDSimClient:
|
||||
|
@ -765,7 +767,8 @@ class TDDnodes:
|
|||
|
||||
def stopAll(self):
|
||||
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)
|
||||
os.system(self.stopDnodesPath)
|
||||
tdLog.info("execute finished")
|
||||
|
@ -777,24 +780,41 @@ class TDDnodes:
|
|||
for i in range(len(self.dnodes)):
|
||||
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 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 (distro_id == "alpine"):
|
||||
print(distro_id)
|
||||
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()
|
||||
while(processID):
|
||||
print(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()
|
||||
|
||||
else:
|
||||
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:
|
||||
psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs"
|
||||
|
|
|
@ -4,3 +4,7 @@ fabric2
|
|||
psutil
|
||||
pandas
|
||||
toml
|
||||
distro
|
||||
requests
|
||||
pexpect
|
||||
faker
|
|
@ -45,11 +45,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -2,7 +2,19 @@
|
|||
|
||||
set +e
|
||||
#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
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
cd $SCRIPT_DIR/../
|
||||
|
|
|
@ -48,11 +48,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -39,11 +39,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -54,11 +54,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -54,11 +54,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -54,11 +54,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
|
||||
set +e
|
||||
#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
|
||||
UNAME_BIN=`which uname`
|
||||
|
@ -44,7 +52,10 @@ do
|
|||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$VALGRIND_OPTION" = "true" ]] && [[ "$TD_OS" == "Alpine" ]]; then
|
||||
echo alpine skip valgrind
|
||||
VALGRIND_OPTION="false"
|
||||
fi
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
cd $SCRIPT_DIR/../
|
||||
SCRIPT_DIR=`pwd`
|
||||
|
@ -59,11 +70,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -51,11 +51,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -20,11 +20,7 @@ fi
|
|||
TAOS_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
|
||||
|
|
|
@ -51,11 +51,7 @@ fi
|
|||
TOP_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
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]
|
|||
if $data(1)[2] != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data(2)[2] != 1 then
|
||||
if $data(2)[2] != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data(3)[2] != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data(4)[2] != 2 then
|
||||
if $data(4)[2] != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -231,10 +231,10 @@ print dnode5 openVnodes $data(5)[2]
|
|||
if $data(1)[2] != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data(3)[2] != 2 then
|
||||
if $data(3)[2] != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data(4)[2] != 3 then
|
||||
if $data(4)[2] != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data(5)[2] != 2 then
|
||||
|
@ -315,10 +315,10 @@ endi
|
|||
if $data(3)[2] != null then
|
||||
return -1
|
||||
endi
|
||||
if $data(4)[2] != 2 then
|
||||
if $data(4)[2] != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data(5)[2] != 3 then
|
||||
if $data(5)[2] != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data(6)[2] != 2 then
|
||||
|
|
|
@ -145,10 +145,10 @@ print dnode2 openVnodes $data(4)[2]
|
|||
if $data(1)[2] != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data(2)[2] != 1 then
|
||||
if $data(2)[2] != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data(3)[2] != 2 then
|
||||
if $data(3)[2] != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data(4)[2] != 1 then
|
||||
|
|
|
@ -120,9 +120,9 @@ if $rows != 12 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
print =============== step3: create qnode snode on dnode 2
|
||||
sql create qnode on dnode 2
|
||||
sql create snode on dnode 2
|
||||
print =============== step3: create qnode snode on dnode 3
|
||||
sql create qnode on dnode 3
|
||||
sql create snode on dnode 3
|
||||
sql select * from information_schema.ins_qnodes
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
|
@ -157,7 +157,7 @@ endi
|
|||
#endi
|
||||
|
||||
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
|
||||
$x = 0
|
||||
step5:
|
||||
|
@ -179,10 +179,10 @@ endi
|
|||
if $data(1)[4] != ready then
|
||||
goto step5
|
||||
endi
|
||||
if $data(2)[4] != offline then
|
||||
if $data(2)[4] != ready then
|
||||
goto step5
|
||||
endi
|
||||
if $data(3)[4] != ready then
|
||||
if $data(3)[4] != offline then
|
||||
goto step5
|
||||
endi
|
||||
if $data(4)[4] != ready then
|
||||
|
@ -192,9 +192,9 @@ if $data(5)[4] != ready then
|
|||
goto step5
|
||||
endi
|
||||
|
||||
print =============== step5a: drop dnode 2
|
||||
sql_error drop dnode 2
|
||||
sql drop dnode 2 force
|
||||
print =============== step5a: drop dnode 3
|
||||
sql_error drop dnode 3
|
||||
sql drop dnode 3 force
|
||||
|
||||
print select * from information_schema.ins_dnodes;
|
||||
sql select * from information_schema.ins_dnodes;
|
||||
|
|
|
@ -207,10 +207,10 @@ print dnode2 openVnodes $data(4)[2]
|
|||
if $data(1)[2] != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data(3)[2] != 1 then
|
||||
if $data(3)[2] != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data(4)[2] != 2 then
|
||||
if $data(4)[2] != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -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:33:00', 3, '3');
|
||||
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
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -99,6 +99,10 @@ class TDTestCase:
|
|||
|
||||
|
||||
def run(self):
|
||||
distro_id = distro.id()
|
||||
if distro_id == "alpine":
|
||||
tdLog.info(f"alpine skip compatibility test")
|
||||
return True
|
||||
bPath = self.getBuildPath()
|
||||
cPath = self.getCfgPath()
|
||||
dbname = "test"
|
||||
|
|
|
@ -97,7 +97,7 @@ class TDTestCase:
|
|||
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}" )')
|
||||
|
||||
for i in range(9):
|
||||
for i in range(1,10):
|
||||
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 )"
|
||||
)
|
||||
|
|
|
@ -145,8 +145,8 @@ class TDTestCase:
|
|||
tdSql.query("show db.alive;")
|
||||
tdSql.checkData(0, 0, 1)
|
||||
|
||||
# stop 5 dnode
|
||||
self.TDDnodes.stoptaosd(5)
|
||||
# stop 3 dnode
|
||||
self.TDDnodes.stoptaosd(3)
|
||||
tdSql.checkDataLoop(0, 0, 2, "show cluster alive;", 20, 0.5)
|
||||
|
||||
tdSql.query("show db.alive;")
|
||||
|
|
|
@ -236,8 +236,8 @@ class TDTestCase:
|
|||
tdDnodes[0].starttaosd()
|
||||
self.check3mnode()
|
||||
|
||||
tdLog.info("3. stop dnode 1")
|
||||
tdDnodes[1].stoptaosd()
|
||||
tdLog.info("3. stop dnode 2")
|
||||
tdDnodes[2].stoptaosd()
|
||||
time.sleep(10)
|
||||
self.check3mnode1off()
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ class TDTestCase:
|
|||
topicList = topicNameList[0]
|
||||
ifcheckdata = 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)
|
||||
|
||||
tdLog.info("start consume processor 0")
|
||||
|
|
|
@ -8,15 +8,23 @@
|
|||
|
||||
set +e
|
||||
#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`
|
||||
OS_TYPE=`$UNAME_BIN`
|
||||
UNAME_BIN=$(which uname)
|
||||
OS_TYPE=$($UNAME_BIN)
|
||||
|
||||
cd .
|
||||
|
||||
# Get responsible directories
|
||||
CODE_DIR=`dirname $0`
|
||||
CODE_DIR=`pwd`
|
||||
CODE_DIR=$(dirname $0)
|
||||
CODE_DIR=$(pwd)
|
||||
|
||||
IN_TDINTERNAL="community"
|
||||
if [[ "$CODE_DIR" == *"$IN_TDINTERNAL"* ]]; then
|
||||
|
@ -25,19 +33,15 @@ else
|
|||
cd ../../
|
||||
fi
|
||||
|
||||
TOP_DIR=`pwd`
|
||||
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
|
||||
TOP_DIR=$(pwd)
|
||||
TAOSD_DIR=$(find . -name "taosd" | grep bin | head -n1)
|
||||
|
||||
if [[ "$OS_TYPE" != "Darwin" ]]; then
|
||||
cut_opt="--field="
|
||||
else
|
||||
cut_opt="-f "
|
||||
fi
|
||||
cut_opt="-f "
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
declare -x BUILD_DIR=$TOP_DIR/$BIN_DIR
|
||||
|
@ -66,35 +70,38 @@ ulimit -c unlimited
|
|||
#sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e
|
||||
|
||||
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
|
||||
echo "Execute script successfully and check asan"
|
||||
$CODE_DIR/../script/sh/checkAsan.sh
|
||||
if [[ "$TD_OS" == "Alpine" ]]; then
|
||||
$*
|
||||
else
|
||||
echo "Execute script failure"
|
||||
exit 1
|
||||
fi
|
||||
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
|
||||
echo "Execute script successfully and check asan"
|
||||
$CODE_DIR/../script/sh/checkAsan.sh
|
||||
else
|
||||
echo "Execute script failure"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -7,25 +7,45 @@ IF (TD_WEBSOCKET)
|
|||
SET(websocket_lib_file "{taosws.dll,taosws.dll.lib}")
|
||||
ENDIF ()
|
||||
MESSAGE("${Green} use libtaos-ws${ColourReset}")
|
||||
|
||||
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
|
||||
)
|
||||
IF (TD_ALPINE)
|
||||
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 RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release -p taos-ws-sys --features native-tls
|
||||
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
|
||||
)
|
||||
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 ()
|
||||
|
||||
IF (TD_TAOS_TOOLS)
|
||||
|
|
|
@ -30,15 +30,23 @@ IF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL)
|
|||
ADD_DEFINITIONS(-I${CMAKE_CURRENT_SOURCE_DIR}/../../../enterprise/packaging)
|
||||
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)
|
||||
target_link_libraries(shell PUBLIC taos_static ${LINK_WEBSOCKET})
|
||||
else()
|
||||
target_link_libraries(shell PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC})
|
||||
target_link_libraries(shell PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC} ${LINK_ARGP})
|
||||
endif ()
|
||||
|
||||
target_link_libraries(
|
||||
shell
|
||||
PRIVATE os common transport util
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
shell
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
|
|
|
@ -97,7 +97,11 @@ void shellPrintHelp() {
|
|||
|
||||
#ifdef LINUX
|
||||
#include <argp.h>
|
||||
#ifdef _ALPINE
|
||||
#include <termios.h>
|
||||
#else
|
||||
#include <termio.h>
|
||||
#endif
|
||||
|
||||
const char *argp_program_version = version;
|
||||
const char *argp_program_bug_address = cusEmail;
|
||||
|
|
Loading…
Reference in New Issue