Merge branch '3.0' of https://github.com/taosdata/TDengine into vnode_refact_merge
This commit is contained in:
commit
9204992516
|
@ -14,9 +14,24 @@ if(${BUILD_PTHREAD})
|
|||
cat("${TD_SUPPORT_DIR}/pthread_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# gnu regex
|
||||
if(${BUILD_GNUREGEX})
|
||||
cat("${TD_SUPPORT_DIR}/gnuregex_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
# iconv
|
||||
if(${BUILD_WITH_ICONV})
|
||||
cat("${TD_SUPPORT_DIR}/iconv_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# msvc regex
|
||||
if(${BUILD_MSVCREGEX})
|
||||
cat("${TD_SUPPORT_DIR}/msvcregex_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# wcwidth
|
||||
if(${BUILD_WCWIDTH})
|
||||
cat("${TD_SUPPORT_DIR}/wcwidth_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# wingetopt
|
||||
if(${BUILD_WINGETOPT})
|
||||
cat("${TD_SUPPORT_DIR}/wingetopt_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# googletest
|
||||
|
@ -99,8 +114,27 @@ if(${BUILD_TEST})
|
|||
target_include_directories(
|
||||
gtest
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src>
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src_linux>
|
||||
)
|
||||
if(${TD_WINDOWS})
|
||||
target_include_directories(
|
||||
gtest
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src_win>
|
||||
)
|
||||
endif(${TD_WINDOWS})
|
||||
if(${TD_LINUX})
|
||||
target_include_directories(
|
||||
gtest
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src_linux>
|
||||
)
|
||||
endif(${TD_LINUX})
|
||||
if(${TD_DARWIN})
|
||||
target_include_directories(
|
||||
gtest
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src_darwin>
|
||||
)
|
||||
endif(${TD_DARWIN})
|
||||
|
||||
|
||||
endif(${BUILD_TEST})
|
||||
|
||||
# cJson
|
||||
|
@ -182,6 +216,53 @@ if(${BUILD_WITH_NURAFT})
|
|||
add_subdirectory(nuraft)
|
||||
endif(${BUILD_WITH_NURAFT})
|
||||
|
||||
# pthread
|
||||
if(${BUILD_PTHREAD})
|
||||
set(CMAKE_BUILD_TYPE release)
|
||||
add_definitions(-DPTW32_STATIC_LIB)
|
||||
add_subdirectory(pthread)
|
||||
set_target_properties(libpthreadVC3 PROPERTIES OUTPUT_NAME pthread)
|
||||
add_library(pthread STATIC IMPORTED GLOBAL)
|
||||
SET_PROPERTY(TARGET pthread PROPERTY IMPORTED_LOCATION ${LIBRARY_OUTPUT_PATH}/pthread.lib)
|
||||
endif()
|
||||
|
||||
# iconv
|
||||
if(${BUILD_WITH_ICONV})
|
||||
add_subdirectory(iconv)
|
||||
endif(${BUILD_WITH_ICONV})
|
||||
|
||||
# wingetopt
|
||||
if(${BUILD_WINGETOPT})
|
||||
add_subdirectory(wingetopt)
|
||||
endif(${BUILD_WINGETOPT})
|
||||
|
||||
# msvcregex
|
||||
if(${BUILD_MSVCREGEX})
|
||||
add_library(msvcregex STATIC "")
|
||||
target_sources(msvcregex
|
||||
PRIVATE "msvcregex/regex.c"
|
||||
)
|
||||
target_include_directories(msvcregex
|
||||
PRIVATE "msvcregex"
|
||||
)
|
||||
target_link_libraries(msvcregex
|
||||
INTERFACE Shell32
|
||||
)
|
||||
SET_TARGET_PROPERTIES(msvcregex PROPERTIES OUTPUT_NAME msvcregex)
|
||||
endif(${BUILD_MSVCREGEX})
|
||||
|
||||
# msvcregex
|
||||
if(${BUILD_WCWIDTH})
|
||||
add_library(wcwidth STATIC "")
|
||||
target_sources(wcwidth
|
||||
PRIVATE "wcwidth/wcwidth.c"
|
||||
)
|
||||
target_include_directories(wcwidth
|
||||
PRIVATE "wcwidth"
|
||||
)
|
||||
SET_TARGET_PROPERTIES(wcwidth PROPERTIES OUTPUT_NAME wcwidth)
|
||||
endif(${BUILD_WCWIDTH})
|
||||
|
||||
# CRAFT
|
||||
if(${BUILD_WITH_CRAFT})
|
||||
add_library(craft STATIC IMPORTED GLOBAL)
|
||||
|
@ -238,8 +319,12 @@ if(${BUILD_WITH_SQLITE})
|
|||
target_link_libraries(sqlite
|
||||
INTERFACE m
|
||||
INTERFACE pthread
|
||||
INTERFACE dl
|
||||
)
|
||||
if(NOT TD_WINDOWS)
|
||||
target_link_libraries(sqlite
|
||||
INTERFACE dl
|
||||
)
|
||||
endif(NOT TD_WINDOWS)
|
||||
endif(${BUILD_WITH_SQLITE})
|
||||
|
||||
# pthread
|
||||
|
|
|
@ -1,2 +1,9 @@
|
|||
add_executable(simulate_vnode "simulate_vnode.c")
|
||||
target_link_libraries(simulate_vnode PUBLIC craft lz4 uv_a)
|
||||
target_link_libraries(simulate_vnode PUBLIC craft lz4 uv_a)
|
||||
if(${BUILD_WINGETOPT})
|
||||
target_link_libraries(simulate_vnode PUBLIC wingetopt)
|
||||
target_include_directories(
|
||||
simulate_vnode
|
||||
PUBLIC "${TD_SOURCE_DIR}/contrib/wingetopt/src"
|
||||
)
|
||||
endif()
|
|
@ -6,43 +6,39 @@
|
|||
#define POINTER_SHIFT(ptr, s) ((void *)(((char *)ptr) + (s)))
|
||||
#define POINTER_DISTANCE(pa, pb) ((char *)(pb) - (char *)(pa))
|
||||
|
||||
#define tPutA(buf, val) \
|
||||
({ \
|
||||
memcpy(buf, &val, sizeof(val)); \
|
||||
POINTER_SHIFT(buf, sizeof(val)); \
|
||||
})
|
||||
static inline void tPutA(void **buf, uint64_t val) {
|
||||
memcpy(buf, &val, sizeof(val));
|
||||
*buf = POINTER_SHIFT(buf, sizeof(val));
|
||||
}
|
||||
|
||||
#define tPutB(buf, val) \
|
||||
({ \
|
||||
((uint8_t *)buf)[7] = ((val) >> 56) & 0xff; \
|
||||
((uint8_t *)buf)[6] = ((val) >> 48) & 0xff; \
|
||||
((uint8_t *)buf)[5] = ((val) >> 40) & 0xff; \
|
||||
((uint8_t *)buf)[4] = ((val) >> 32) & 0xff; \
|
||||
((uint8_t *)buf)[3] = ((val) >> 24) & 0xff; \
|
||||
((uint8_t *)buf)[2] = ((val) >> 16) & 0xff; \
|
||||
((uint8_t *)buf)[1] = ((val) >> 8) & 0xff; \
|
||||
((uint8_t *)buf)[0] = (val)&0xff; \
|
||||
POINTER_SHIFT(buf, sizeof(val)); \
|
||||
})
|
||||
static inline void tPutB(void **buf, uint64_t val) {
|
||||
((uint8_t *)buf)[7] = ((val) >> 56) & 0xff;
|
||||
((uint8_t *)buf)[6] = ((val) >> 48) & 0xff;
|
||||
((uint8_t *)buf)[5] = ((val) >> 40) & 0xff;
|
||||
((uint8_t *)buf)[4] = ((val) >> 32) & 0xff;
|
||||
((uint8_t *)buf)[3] = ((val) >> 24) & 0xff;
|
||||
((uint8_t *)buf)[2] = ((val) >> 16) & 0xff;
|
||||
((uint8_t *)buf)[1] = ((val) >> 8) & 0xff;
|
||||
((uint8_t *)buf)[0] = (val)&0xff;
|
||||
*buf = POINTER_SHIFT(buf, sizeof(val));
|
||||
}
|
||||
|
||||
#define tPutC(buf, val) \
|
||||
({ \
|
||||
if (buf) { \
|
||||
((uint64_t *)buf)[0] = (val); \
|
||||
POINTER_SHIFT(buf, sizeof(val)); \
|
||||
} \
|
||||
NULL; \
|
||||
})
|
||||
static inline void tPutC(void **buf, uint64_t val) {
|
||||
if (buf) {
|
||||
((uint64_t *)buf)[0] = (val);
|
||||
POINTER_SHIFT(buf, sizeof(val));
|
||||
}
|
||||
*buf = NULL;
|
||||
}
|
||||
|
||||
#define tPutD(buf, val) \
|
||||
({ \
|
||||
uint64_t tmp = val; \
|
||||
for (size_t i = 0; i < sizeof(val); i++) { \
|
||||
((uint8_t *)buf)[i] = tmp & 0xff; \
|
||||
tmp >>= 8; \
|
||||
} \
|
||||
POINTER_SHIFT(buf, sizeof(val)); \
|
||||
})
|
||||
static inline void tPutD(void **buf, uint64_t val) {
|
||||
uint64_t tmp = val;
|
||||
for (size_t i = 0; i < sizeof(val); i++) {
|
||||
((uint8_t *)buf)[i] = tmp & 0xff;
|
||||
tmp >>= 8;
|
||||
}
|
||||
*buf = POINTER_SHIFT(buf, sizeof(val));
|
||||
}
|
||||
|
||||
static inline void tPutE(void **buf, uint64_t val) {
|
||||
if (buf) {
|
||||
|
@ -61,7 +57,7 @@ static void func(T t) {
|
|||
switch (t) {
|
||||
case A:
|
||||
for (size_t i = 0; i < 10 * 1024l * 1024l * 1024l; i++) {
|
||||
pBuf = tPutA(pBuf, val);
|
||||
tPutA(pBuf, val);
|
||||
if (POINTER_DISTANCE(buf, pBuf) == 1024) {
|
||||
pBuf = buf;
|
||||
}
|
||||
|
@ -69,7 +65,7 @@ static void func(T t) {
|
|||
break;
|
||||
case B:
|
||||
for (size_t i = 0; i < 10 * 1024l * 1024l * 1024l; i++) {
|
||||
pBuf = tPutB(pBuf, val);
|
||||
tPutB(pBuf, val);
|
||||
if (POINTER_DISTANCE(buf, pBuf) == 1024) {
|
||||
pBuf = buf;
|
||||
}
|
||||
|
@ -77,7 +73,7 @@ static void func(T t) {
|
|||
break;
|
||||
case C:
|
||||
for (size_t i = 0; i < 10 * 1024l * 1024l * 1024l; i++) {
|
||||
pBuf = tPutC(pBuf, val);
|
||||
tPutC(pBuf, val);
|
||||
if (POINTER_DISTANCE(buf, pBuf) == 1024) {
|
||||
pBuf = buf;
|
||||
}
|
||||
|
@ -85,7 +81,7 @@ static void func(T t) {
|
|||
break;
|
||||
case D:
|
||||
for (size_t i = 0; i < 10 * 1024l * 1024l * 1024l; i++) {
|
||||
pBuf = tPutD(pBuf, val);
|
||||
tPutD(pBuf, val);
|
||||
if (POINTER_DISTANCE(buf, pBuf) == 1024) {
|
||||
pBuf = buf;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ target_link_libraries(demoapi
|
|||
)
|
||||
|
||||
target_include_directories(tmq
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/os"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include "taos.h"
|
||||
#include "osSleep.h"
|
||||
|
||||
static int running = 1;
|
||||
static void msg_process(TAOS_RES* msg) {
|
||||
|
@ -48,7 +48,7 @@ int32_t init_env() {
|
|||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
sleep(1);
|
||||
taosSsleep(1);
|
||||
|
||||
pRes = taos_query(pConn, "use abc1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
|
|
|
@ -88,7 +88,11 @@ typedef struct taosField {
|
|||
int32_t bytes;
|
||||
} TAOS_FIELD;
|
||||
|
||||
#define DLL_EXPORT
|
||||
#ifdef WINDOWS
|
||||
#define DLL_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLL_EXPORT
|
||||
#endif
|
||||
|
||||
typedef void (*__taos_async_fn_t)(void *param, TAOS_RES *, int code);
|
||||
|
||||
|
|
|
@ -230,12 +230,12 @@ typedef struct {
|
|||
int32_t totalLen;
|
||||
int32_t len;
|
||||
// head of SSubmitBlk
|
||||
// int64_t uid; // table unique id
|
||||
// int64_t suid; // stable id
|
||||
// int32_t sversion; // data schema version
|
||||
// int32_t dataLen; // data part length, not including the SSubmitBlk head
|
||||
// int32_t schemaLen; // schema length, if length is 0, no schema exists
|
||||
// int16_t numOfRows; // total number of rows in current submit block
|
||||
int64_t uid; // table unique id
|
||||
int64_t suid; // stable id
|
||||
int32_t sversion; // data schema version
|
||||
int32_t dataLen; // data part length, not including the SSubmitBlk head
|
||||
int32_t schemaLen; // schema length, if length is 0, no schema exists
|
||||
int16_t numOfRows; // total number of rows in current submit block
|
||||
// head of SSubmitBlk
|
||||
const void* pMsg;
|
||||
} SSubmitMsgIter;
|
||||
|
@ -249,10 +249,10 @@ STSRow* tGetSubmitBlkNext(SSubmitBlkIter* pIter);
|
|||
// 1) use tInitSubmitMsgIterEx firstly as not decrease the merge conflicts
|
||||
// 2) replace tInitSubmitMsgIterEx with tInitSubmitMsgIter later
|
||||
// 3) finally, rename tInitSubmitMsgIterEx to tInitSubmitMsgIter
|
||||
// int32_t tInitSubmitMsgIterEx(const SSubmitReq* pMsg, SSubmitMsgIter* pIter);
|
||||
// int32_t tGetSubmitMsgNextEx(SSubmitMsgIter* pIter, SSubmitBlk** pPBlock);
|
||||
// int32_t tInitSubmitBlkIterEx(SSubmitMsgIter* pMsgIter, SSubmitBlk* pBlock, SSubmitBlkIter* pIter);
|
||||
// STSRow* tGetSubmitBlkNextEx(SSubmitBlkIter* pIter);
|
||||
int32_t tInitSubmitMsgIterEx(const SSubmitReq* pMsg, SSubmitMsgIter* pIter);
|
||||
int32_t tGetSubmitMsgNextEx(SSubmitMsgIter* pIter, SSubmitBlk** pPBlock);
|
||||
int32_t tInitSubmitBlkIterEx(SSubmitMsgIter* pMsgIter, SSubmitBlk* pBlock, SSubmitBlkIter* pIter);
|
||||
STSRow* tGetSubmitBlkNextEx(SSubmitBlkIter* pIter);
|
||||
|
||||
typedef struct {
|
||||
int32_t index; // index of failed block in submit blocks
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
aux_source_directory(src CLIENT_SRC)
|
||||
add_library(taos SHARED ${CLIENT_SRC})
|
||||
if(TD_WINDOWS)
|
||||
add_library(taos SHARED ${CLIENT_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/taos.rc.in)
|
||||
else()
|
||||
add_library(taos SHARED ${CLIENT_SRC})
|
||||
endif ()
|
||||
target_include_directories(
|
||||
taos
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/client"
|
||||
|
@ -10,6 +14,13 @@ target_link_libraries(
|
|||
INTERFACE api
|
||||
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
|
||||
)
|
||||
if(TD_WINDOWS)
|
||||
set_target_properties(taos
|
||||
PROPERTIES
|
||||
LINK_FLAGS
|
||||
/DEF:${CMAKE_CURRENT_SOURCE_DIR}/src/taos.def
|
||||
)
|
||||
endif ()
|
||||
|
||||
set_target_properties(
|
||||
taos
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
taos_cleanup
|
||||
taos_options
|
||||
taos_set_config
|
||||
taos_connect
|
||||
taos_connect_l
|
||||
taos_connect_auth
|
||||
taos_close
|
||||
taos_data_type
|
||||
taos_stmt_init
|
||||
taos_stmt_prepare
|
||||
taos_stmt_set_tbname_tags
|
||||
taos_stmt_set_tbname
|
||||
taos_stmt_set_sub_tbname
|
||||
taos_stmt_is_insert
|
||||
taos_stmt_num_params
|
||||
taos_stmt_get_param
|
||||
taos_stmt_bind_param
|
||||
taos_stmt_bind_param_batch
|
||||
taos_stmt_bind_single_param_batch
|
||||
taos_stmt_add_batch
|
||||
taos_stmt_execute
|
||||
taos_stmt_use_result
|
||||
taos_stmt_close
|
||||
taos_stmt_errstr
|
||||
taos_stmt_affected_rows
|
||||
taos_stmt_affected_rows_once
|
||||
taos_query
|
||||
taos_query_l
|
||||
taos_fetch_row
|
||||
taos_result_precision
|
||||
taos_free_result
|
||||
taos_field_count
|
||||
taos_num_fields
|
||||
taos_affected_rows
|
||||
taos_fetch_fields
|
||||
taos_select_db
|
||||
taos_print_row
|
||||
taos_stop_query
|
||||
taos_is_null
|
||||
taos_is_update_query
|
||||
taos_fetch_block
|
||||
taos_fetch_block_s
|
||||
taos_fetch_raw_block
|
||||
taos_get_column_data_offset
|
||||
taos_validate_sql
|
||||
taos_reset_current_db
|
||||
taos_fetch_lengths
|
||||
taos_result_block
|
||||
taos_get_server_info
|
||||
taos_get_client_info
|
||||
taos_errstr
|
||||
taos_errno
|
||||
taos_query_a
|
||||
taos_fetch_rows_a
|
||||
taos_subscribe
|
||||
taos_consume
|
||||
taos_unsubscribe
|
||||
taos_load_table_info
|
||||
taos_schemaless_insert
|
||||
tmq_list_new
|
||||
tmq_list_append
|
||||
tmq_list_destroy
|
||||
tmq_list_get_size
|
||||
tmq_list_to_c_array
|
||||
tmq_consumer_new
|
||||
tmq_err2str
|
||||
tmq_subscribe
|
||||
tmq_unsubscribe
|
||||
tmq_subscription
|
||||
tmq_consumer_poll
|
||||
tmq_consumer_close
|
||||
tmq_commit
|
||||
tmq_conf_new
|
||||
tmq_conf_set
|
||||
tmq_conf_destroy
|
||||
tmq_conf_set_offset_commit_cb
|
||||
tmq_get_topic_name
|
||||
tmq_get_vgroup_id
|
||||
tmq_create_stream
|
||||
taos_check_server_status
|
|
@ -0,0 +1,31 @@
|
|||
1 VERSIONINFO
|
||||
FILEVERSION ${TD_VER_NUMBER}
|
||||
PRODUCTVERSION ${TD_VER_NUMBER}
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x0L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "Native C Driver for TDengine"
|
||||
VALUE "FileVersion", "${TD_VER_NUMBER}"
|
||||
VALUE "InternalName", "taos.dll(${TD_VER_CPUTYPE})"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2020 TAOS Data"
|
||||
VALUE "OriginalFilename", ""
|
||||
VALUE "ProductName", "taos.dll(${TD_VER_CPUTYPE})"
|
||||
VALUE "ProductVersion", "${TD_VER_NUMBER}"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
|
@ -93,7 +93,7 @@ STSRow *tGetSubmitBlkNext(SSubmitBlkIter *pIter) {
|
|||
return row;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
|
||||
// TODO: KEEP one suite of iterator API finally.
|
||||
// 1) use tInitSubmitMsgIterEx firstly as not decrease the merge conflicts
|
||||
// 2) replace tInitSubmitMsgIterEx with tInitSubmitMsgIter later
|
||||
|
@ -173,7 +173,7 @@ STSRow *tGetSubmitBlkNextEx(SSubmitBlkIter *pIter) {
|
|||
return row;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t tEncodeSEpSet(SCoder *pEncoder, const SEpSet *pEp) {
|
||||
if (tEncodeI8(pEncoder, pEp->inUse) < 0) return -1;
|
||||
if (tEncodeI8(pEncoder, pEp->numOfEps) < 0) return -1;
|
||||
|
|
|
@ -17,11 +17,21 @@
|
|||
#include "dmImp.h"
|
||||
#include "tconfig.h"
|
||||
|
||||
#define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'."
|
||||
#define DM_CFG_DIR "Configuration directory."
|
||||
#define DM_DMP_CFG "Dump configuration."
|
||||
#define DM_ENV_CMD "The env cmd variable string to use when configuring the server, such as: -e 'TAOS_FQDN=td1'."
|
||||
#define DM_ENV_FILE "The env variable file path to use when configuring the server, default is './.env', .env text can be 'TAOS_FQDN=td1'."
|
||||
#define DM_NODE_TYPE "Startup type of the node, default is 0."
|
||||
#define DM_MACHINE_CODE "Get machine code."
|
||||
#define DM_VERSION "Print program version."
|
||||
#define DM_EMAIL "<support@taosdata.com>"
|
||||
static struct {
|
||||
bool dumpConfig;
|
||||
bool generateGrant;
|
||||
bool printAuth;
|
||||
bool printVersion;
|
||||
bool printHelp;
|
||||
char envFile[PATH_MAX];
|
||||
char apolloUrl[PATH_MAX];
|
||||
const char **envCmd;
|
||||
|
@ -91,6 +101,8 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
|
|||
} else if (strcmp(argv[i], "-e") == 0) {
|
||||
global.envCmd[cmdEnvIndex] = argv[++i];
|
||||
cmdEnvIndex++;
|
||||
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "--usage") == 0 || strcmp(argv[i], "-?")) {
|
||||
global.printHelp = true;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +123,21 @@ static void dmPrintVersion() {
|
|||
printf("buildInfo: %s\n", buildinfo);
|
||||
}
|
||||
|
||||
static void dmPrintHelp() {
|
||||
char indent[] = " ";
|
||||
printf("Usage: taosd [OPTION...] \n\n");
|
||||
printf("%s%s%s%s\n", indent, "-a,", indent, DM_APOLLO_URL);
|
||||
printf("%s%s%s%s\n", indent, "-c,", indent, DM_CFG_DIR);
|
||||
printf("%s%s%s%s\n", indent, "-C,", indent, DM_DMP_CFG);
|
||||
printf("%s%s%s%s\n", indent, "-e,", indent, DM_ENV_CMD);
|
||||
printf("%s%s%s%s\n", indent, "-E,", indent, DM_ENV_FILE);
|
||||
printf("%s%s%s%s\n", indent, "-n,", indent, DM_NODE_TYPE);
|
||||
printf("%s%s%s%s\n", indent, "-k,", indent, DM_MACHINE_CODE);
|
||||
printf("%s%s%s%s\n", indent, "-V,", indent, DM_VERSION);
|
||||
|
||||
printf("\n\nReport bugs to %s.\n", DM_EMAIL);
|
||||
}
|
||||
|
||||
static void dmDumpCfg() {
|
||||
SConfig *pCfg = taosGetCfg();
|
||||
cfgDumpCfg(pCfg, 0, true);
|
||||
|
@ -197,6 +224,12 @@ int main(int argc, char const *argv[]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (global.printHelp) {
|
||||
dmPrintHelp();
|
||||
taosCleanupArgs();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (global.printVersion) {
|
||||
dmPrintVersion();
|
||||
taosCleanupArgs();
|
||||
|
|
|
@ -30,7 +30,6 @@ SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup);
|
|||
int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups);
|
||||
SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup);
|
||||
int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId);
|
||||
int32_t mndGetGlobalVgroupVersion(int32_t *vgId);
|
||||
|
||||
void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
||||
void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
||||
|
|
|
@ -234,6 +234,8 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndGetGlobalVgroupVersion(SMnode *pMnode) { return sdbGetTableVer(pMnode->pSdb, SDB_VGROUP); }
|
||||
|
||||
SDbObj *mndAcquireDb(SMnode *pMnode, const char *db) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SDbObj *pDb = sdbAcquire(pSdb, SDB_DB, db);
|
||||
|
@ -1191,8 +1193,7 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
|
|||
char *p = strchr(usedbReq.db, '.');
|
||||
if (p && 0 == strcmp(p + 1, TSDB_INFORMATION_SCHEMA_DB)) {
|
||||
memcpy(usedbRsp.db, usedbReq.db, TSDB_DB_FNAME_LEN);
|
||||
//mndGetGlobalVgroupVersion(); TODO
|
||||
static int32_t vgVersion = 1;
|
||||
int32_t vgVersion = mndGetGlobalVgroupVersion(pMnode);
|
||||
if (usedbReq.vgVersion < vgVersion) {
|
||||
usedbRsp.pVgroupInfos = taosArrayInit(10, sizeof(SVgroupInfo));
|
||||
if (usedbRsp.pVgroupInfos == NULL) {
|
||||
|
|
|
@ -89,7 +89,6 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
|
|||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSAlterDbReq(pReq, contLen, &alterdbReq);
|
||||
|
||||
taosMsleep(1000); // Wait for the vnode to become the leader
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_DB, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
|
|
|
@ -258,7 +258,6 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) {
|
|||
pReq = BuildCreateDbReq(dbname, &contLen);
|
||||
pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(1000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -304,7 +304,6 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
|
|||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(2000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -439,7 +438,6 @@ TEST_F(MndTestStb, 02_Alter_Stb_AddTag) {
|
|||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(2000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -499,7 +497,6 @@ TEST_F(MndTestStb, 03_Alter_Stb_DropTag) {
|
|||
void* pReq = BuildCreateDbReq(dbname, &contLen);
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(2000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -541,7 +538,6 @@ TEST_F(MndTestStb, 04_Alter_Stb_AlterTagName) {
|
|||
void* pReq = BuildCreateDbReq(dbname, &contLen);
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(2000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -606,7 +602,6 @@ TEST_F(MndTestStb, 05_Alter_Stb_AlterTagBytes) {
|
|||
void* pReq = BuildCreateDbReq(dbname, &contLen);
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(2000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -660,7 +655,6 @@ TEST_F(MndTestStb, 06_Alter_Stb_AddColumn) {
|
|||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(2000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -721,7 +715,6 @@ TEST_F(MndTestStb, 07_Alter_Stb_DropColumn) {
|
|||
void* pReq = BuildCreateDbReq(dbname, &contLen);
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(2000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -782,7 +775,6 @@ TEST_F(MndTestStb, 08_Alter_Stb_AlterTagBytes) {
|
|||
void* pReq = BuildCreateDbReq(dbname, &contLen);
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DB, pReq, contLen);
|
||||
ASSERT_EQ(pRsp->code, 0);
|
||||
taosMsleep(2000); // Wait for the vnode to become the leader
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -73,7 +73,6 @@ int32_t tsdbInsertTSmaData(STsdb *pTsdb, int64_t indexUid, const char *msg);
|
|||
int32_t tsdbDropTSmaData(STsdb *pTsdb, int64_t indexUid);
|
||||
int32_t tsdbInsertRSmaData(STsdb *pTsdb, char *msg);
|
||||
void tsdbCleanupReadHandle(tsdbReaderT queryHandle);
|
||||
int32_t tdScanAndConvertSubmitMsg(SSubmitReq *pMsg);
|
||||
typedef enum {
|
||||
TSDB_FILE_HEAD = 0, // .head
|
||||
TSDB_FILE_DATA, // .data
|
||||
|
|
|
@ -197,10 +197,9 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
|
|||
}
|
||||
memcpy(data, msg, msgLen);
|
||||
|
||||
if (msgType == TDMT_VND_SUBMIT) {
|
||||
if (tsdbUpdateSmaWindow(pTq->pVnode->pTsdb, msg, ver) != 0) {
|
||||
return -1;
|
||||
}
|
||||
// make sure msgType == TDMT_VND_SUBMIT
|
||||
if (tsdbUpdateSmaWindow(pTq->pVnode->pTsdb, msg, ver) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
SRpcMsg req = {
|
||||
|
|
|
@ -33,24 +33,24 @@ STqReadHandle* tqInitSubmitMsgScanner(SMeta* pMeta) {
|
|||
|
||||
int32_t tqReadHandleSetMsg(STqReadHandle* pReadHandle, SSubmitReq* pMsg, int64_t ver) {
|
||||
pReadHandle->pMsg = pMsg;
|
||||
pMsg->length = htonl(pMsg->length);
|
||||
pMsg->numOfBlocks = htonl(pMsg->numOfBlocks);
|
||||
// pMsg->length = htonl(pMsg->length);
|
||||
// pMsg->numOfBlocks = htonl(pMsg->numOfBlocks);
|
||||
|
||||
// iterate and convert
|
||||
if (tInitSubmitMsgIter(pMsg, &pReadHandle->msgIter) < 0) return -1;
|
||||
if (tInitSubmitMsgIterEx(pMsg, &pReadHandle->msgIter) < 0) return -1;
|
||||
while (true) {
|
||||
if (tGetSubmitMsgNext(&pReadHandle->msgIter, &pReadHandle->pBlock) < 0) return -1;
|
||||
if (tGetSubmitMsgNextEx(&pReadHandle->msgIter, &pReadHandle->pBlock) < 0) return -1;
|
||||
if (pReadHandle->pBlock == NULL) break;
|
||||
|
||||
pReadHandle->pBlock->uid = htobe64(pReadHandle->pBlock->uid);
|
||||
pReadHandle->pBlock->suid = htobe64(pReadHandle->pBlock->suid);
|
||||
pReadHandle->pBlock->sversion = htonl(pReadHandle->pBlock->sversion);
|
||||
pReadHandle->pBlock->dataLen = htonl(pReadHandle->pBlock->dataLen);
|
||||
pReadHandle->pBlock->schemaLen = htonl(pReadHandle->pBlock->schemaLen);
|
||||
pReadHandle->pBlock->numOfRows = htons(pReadHandle->pBlock->numOfRows);
|
||||
// pReadHandle->pBlock->uid = htobe64(pReadHandle->pBlock->uid);
|
||||
// pReadHandle->pBlock->suid = htobe64(pReadHandle->pBlock->suid);
|
||||
// pReadHandle->pBlock->sversion = htonl(pReadHandle->pBlock->sversion);
|
||||
// pReadHandle->pBlock->dataLen = htonl(pReadHandle->pBlock->dataLen);
|
||||
// pReadHandle->pBlock->schemaLen = htonl(pReadHandle->pBlock->schemaLen);
|
||||
// pReadHandle->pBlock->numOfRows = htons(pReadHandle->pBlock->numOfRows);
|
||||
}
|
||||
|
||||
if (tInitSubmitMsgIter(pMsg, &pReadHandle->msgIter) < 0) return -1;
|
||||
if (tInitSubmitMsgIterEx(pMsg, &pReadHandle->msgIter) < 0) return -1;
|
||||
pReadHandle->ver = ver;
|
||||
memset(&pReadHandle->blkIter, 0, sizeof(SSubmitBlkIter));
|
||||
return 0;
|
||||
|
@ -58,7 +58,7 @@ int32_t tqReadHandleSetMsg(STqReadHandle* pReadHandle, SSubmitReq* pMsg, int64_t
|
|||
|
||||
bool tqNextDataBlock(STqReadHandle* pHandle) {
|
||||
while (1) {
|
||||
if (tGetSubmitMsgNext(&pHandle->msgIter, &pHandle->pBlock) < 0) {
|
||||
if (tGetSubmitMsgNextEx(&pHandle->msgIter, &pHandle->pBlock) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (pHandle->pBlock == NULL) return false;
|
||||
|
@ -68,7 +68,7 @@ bool tqNextDataBlock(STqReadHandle* pHandle) {
|
|||
if (pHandle->tbIdHash == NULL) {
|
||||
return true;
|
||||
}
|
||||
void* ret = taosHashGet(pHandle->tbIdHash, &pHandle->pBlock->uid, sizeof(int64_t));
|
||||
void* ret = taosHashGet(pHandle->tbIdHash, &pHandle->msgIter.uid, sizeof(int64_t));
|
||||
if (ret != NULL) {
|
||||
/*printf("retrieve one tb %ld\n", pHandle->pBlock->uid);*/
|
||||
/*pHandle->pBlock->tid = htonl(pHandle->pBlock->tid);*/
|
||||
|
@ -90,28 +90,25 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
|
|||
// TODO set to real sversion
|
||||
int32_t sversion = 0;
|
||||
if (pHandle->sver != sversion) {
|
||||
pHandle->pSchema = metaGetTbTSchema(pHandle->pVnodeMeta, pHandle->pBlock->uid, sversion);
|
||||
|
||||
tb_uid_t quid;
|
||||
SMetaReader mr = {0};
|
||||
|
||||
metaReaderInit(&mr, pHandle->pVnodeMeta->pVnode, 0);
|
||||
|
||||
metaGetTableEntryByUid(&mr, pHandle->pBlock->uid);
|
||||
|
||||
if (mr.me.type == META_CHILD_TABLE) {
|
||||
quid = mr.me.ctbEntry.suid;
|
||||
pHandle->pSchema = metaGetTbTSchema(pHandle->pVnodeMeta, pHandle->msgIter.uid, sversion);
|
||||
#if 0
|
||||
tb_uid_t quid;
|
||||
STbCfg* pTbCfg = metaGetTbInfoByUid(pHandle->pVnodeMeta, pHandle->msgIter.uid);
|
||||
if (pTbCfg->type == META_CHILD_TABLE) {
|
||||
quid = pTbCfg->ctbCfg.suid;
|
||||
} else {
|
||||
quid = pHandle->pBlock->uid;
|
||||
quid = pHandle->msgIter.uid;
|
||||
}
|
||||
pHandle->pSchemaWrapper = metaGetTableSchema(pHandle->pVnodeMeta, quid, sversion, true);
|
||||
#endif
|
||||
pHandle->pSchemaWrapper = metaGetTableSchema(pHandle->pVnodeMeta, pHandle->msgIter.suid, sversion, true);
|
||||
pHandle->sver = sversion;
|
||||
}
|
||||
|
||||
STSchema* pTschema = pHandle->pSchema;
|
||||
SSchemaWrapper* pSchemaWrapper = pHandle->pSchemaWrapper;
|
||||
|
||||
*pNumOfRows = pHandle->pBlock->numOfRows;
|
||||
*pNumOfRows = pHandle->msgIter.numOfRows;
|
||||
int32_t colNumNeed = taosArrayGetSize(pHandle->pColIdList);
|
||||
|
||||
if (colNumNeed == 0) {
|
||||
|
@ -180,8 +177,8 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
|
|||
tdSTSRowIterInit(&iter, pTschema);
|
||||
STSRow* row;
|
||||
int32_t curRow = 0;
|
||||
tInitSubmitBlkIter(pHandle->pBlock, &pHandle->blkIter);
|
||||
while ((row = tGetSubmitBlkNext(&pHandle->blkIter)) != NULL) {
|
||||
tInitSubmitBlkIterEx(&pHandle->msgIter, pHandle->pBlock, &pHandle->blkIter);
|
||||
while ((row = tGetSubmitBlkNextEx(&pHandle->blkIter)) != NULL) {
|
||||
tdSTSRowIterReset(&iter, row);
|
||||
// get all wanted col of that block
|
||||
for (int32_t i = 0; i < colActual; i++) {
|
||||
|
|
|
@ -678,9 +678,6 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
|
|||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
if (tdScanAndConvertSubmitMsg(pMsg) != TSDB_CODE_SUCCESS) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
if (tsdbCheckAndInitSmaEnv(pTsdb, TSDB_SMA_TYPE_TIME_RANGE) != TSDB_CODE_SUCCESS) {
|
||||
terrno = TSDB_CODE_TDB_INIT_FAILED;
|
||||
|
@ -705,25 +702,25 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
|
|||
SInterval interval = {0};
|
||||
TSKEY lastWinSKey = INT64_MIN;
|
||||
|
||||
if (tInitSubmitMsgIter(pMsg, &msgIter) != TSDB_CODE_SUCCESS) {
|
||||
if (tInitSubmitMsgIterEx(pMsg, &msgIter) != TSDB_CODE_SUCCESS) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
tGetSubmitMsgNext(&msgIter, &pBlock);
|
||||
tGetSubmitMsgNextEx(&msgIter, &pBlock);
|
||||
if (!pBlock) break;
|
||||
|
||||
STSmaWrapper *pSW = NULL;
|
||||
STSma *pTSma = NULL;
|
||||
|
||||
SSubmitBlkIter blkIter = {0};
|
||||
if (tInitSubmitBlkIter(pBlock, &blkIter) != TSDB_CODE_SUCCESS) {
|
||||
if (tInitSubmitBlkIterEx(&msgIter, pBlock, &blkIter) != TSDB_CODE_SUCCESS) {
|
||||
pSW = tdFreeTSmaWrapper(pSW);
|
||||
break;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
STSRow *row = tGetSubmitBlkNext(&blkIter);
|
||||
STSRow *row = tGetSubmitBlkNextEx(&blkIter);
|
||||
if (!row) {
|
||||
tdFreeTSmaWrapper(pSW);
|
||||
break;
|
||||
|
@ -1765,7 +1762,7 @@ int32_t tsdbRegisterRSma(STsdb *pTsdb, SMeta *pMeta, SVCreateTbReq *pReq) {
|
|||
TSDB_CODE_SUCCESS) {
|
||||
return TSDB_CODE_FAILED;
|
||||
} else {
|
||||
tsdbDebug("vgId:%d register rsma info succeed for suid:%" PRIi64, REPO_ID(pTsdb), pReq->stbCfg.suid);
|
||||
tsdbDebug("vgId:%d register rsma info succeed for suid:%" PRIi64, REPO_ID(pTsdb), pReq->stbCfg.suid);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1793,7 +1790,7 @@ int32_t tsdbUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid) {
|
|||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
}
|
||||
if (!taosArrayPush(pStore->tbUids, &uid)) {
|
||||
if (!taosArrayPush(pStore->tbUids, uid)) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
@ -1808,14 +1805,14 @@ int32_t tsdbUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid) {
|
|||
if (uid) {
|
||||
SArray *uidArray = taosHashGet(pStore->uidHash, &suid, sizeof(tb_uid_t));
|
||||
if (uidArray && ((uidArray = *(SArray **)uidArray))) {
|
||||
taosArrayPush(uidArray, &uid);
|
||||
taosArrayPush(uidArray, uid);
|
||||
} else {
|
||||
SArray *pUidArray = taosArrayInit(1, sizeof(tb_uid_t));
|
||||
if (!pUidArray) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
if (!taosArrayPush(pUidArray, &uid)) {
|
||||
if (!taosArrayPush(pUidArray, uid)) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
@ -1977,12 +1974,12 @@ static int32_t tsdbFetchSubmitReqSuids(SSubmitReq *pMsg, STbUidStore *pStore) {
|
|||
// pMsg->length = htonl(pMsg->length);
|
||||
// pMsg->numOfBlocks = htonl(pMsg->numOfBlocks);
|
||||
|
||||
if (tInitSubmitMsgIter(pMsg, &msgIter) < 0) return -1;
|
||||
if (tInitSubmitMsgIterEx(pMsg, &msgIter) < 0) return -1;
|
||||
while (true) {
|
||||
if (tGetSubmitMsgNext(&msgIter, &pBlock) < 0) return -1;
|
||||
if (tGetSubmitMsgNextEx(&msgIter, &pBlock) < 0) return -1;
|
||||
|
||||
if (!pBlock) break;
|
||||
tsdbUidStorePut(pStore, pBlock->suid, NULL);
|
||||
tsdbUidStorePut(pStore, msgIter.suid, NULL);
|
||||
}
|
||||
|
||||
if (terrno != TSDB_CODE_SUCCESS) return -1;
|
||||
|
@ -2016,6 +2013,8 @@ int32_t tsdbExecuteRSma(STsdb *pTsdb, SMeta *pMeta, const void *pMsg, int32_t in
|
|||
|
||||
if (inputType == STREAM_DATA_TYPE_SUBMIT_BLOCK) {
|
||||
if (pRSmaInfo->taskInfo[0]) {
|
||||
tsdbDebug("vgId:%d execute rsma task for qTaskInfo:%p suid:%" PRIu64, REPO_ID(pTsdb), pRSmaInfo->taskInfo[0],
|
||||
*suid);
|
||||
qSetStreamInput(pRSmaInfo->taskInfo[0], pMsg, inputType);
|
||||
while (1) {
|
||||
SSDataBlock *output;
|
||||
|
@ -2028,7 +2027,11 @@ int32_t tsdbExecuteRSma(STsdb *pTsdb, SMeta *pMeta, const void *pMsg, int32_t in
|
|||
}
|
||||
taosArrayPush(pResult, output);
|
||||
}
|
||||
blockDebugShowData(pResult);
|
||||
if (taosArrayGetSize(pResult) > 0) {
|
||||
blockDebugShowData(pResult);
|
||||
} else {
|
||||
tsdbWarn("vgId:%d no sma data generated since %s", REPO_ID(pTsdb), tstrerror(terrno));
|
||||
}
|
||||
}
|
||||
|
||||
// if (pRSmaInfo->taskInfo[1]) {
|
||||
|
|
|
@ -221,7 +221,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, boo
|
|||
|
||||
p->groupId = *(uint64_t*) key;
|
||||
p->pos = *(SResultRowPosition*) pData;
|
||||
memcpy(p->key, key + sizeof(uint64_t), keyLen - sizeof(uint64_t));
|
||||
memcpy(p->key, (char*)key + sizeof(uint64_t), keyLen - sizeof(uint64_t));
|
||||
|
||||
taosArrayPush(pGroupResInfo->pRows, &p);
|
||||
}
|
||||
|
|
|
@ -979,7 +979,8 @@ void transCloseServer(void* arg) {
|
|||
|
||||
transSrvInst--;
|
||||
if (transSrvInst == 0) {
|
||||
transModuleInit = PTHREAD_ONCE_INIT;
|
||||
TdThreadOnce tmpInit = PTHREAD_ONCE_INIT;
|
||||
memcpy(&transModuleInit, &tmpInit, sizeof(TdThreadOnce));
|
||||
uvCloseExHandleMgt();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,12 @@ static int32_t cfgCheckAndSetDir(SConfigItem *pItem, const char *inputDir) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (taosRealPath(fullDir, NULL, PATH_MAX) != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
uError("failed to get realpath of dir:%s since %s", inputDir, terrstr());
|
||||
return -1;
|
||||
}
|
||||
|
||||
taosMemoryFreeClear(pItem->str);
|
||||
pItem->str = strdup(fullDir);
|
||||
if (pItem->str == NULL) {
|
||||
|
@ -823,7 +829,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
|
|||
}
|
||||
p++;
|
||||
|
||||
if (bcmp(url, "jsonFile", 8) == 0) {
|
||||
if (memcmp(url, "jsonFile", 8) == 0) {
|
||||
char *filepath = p;
|
||||
if (!taosCheckExistFile(filepath)) {
|
||||
uError("fial to load json file: %s", filepath);
|
||||
|
@ -893,8 +899,8 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
|
|||
}
|
||||
tjsonDelete(pJson);
|
||||
|
||||
// } else if (bcmp(url, "jsonUrl", 7) == 0) {
|
||||
// } else if (bcmp(url, "etcdUrl", 7) == 0) {
|
||||
// } else if (memcmp(url, "jsonUrl", 7) == 0) {
|
||||
// } else if (memcmp(url, "etcdUrl", 7) == 0) {
|
||||
} else {
|
||||
uError("Unsupported url: %s", url);
|
||||
return -1;
|
||||
|
@ -908,7 +914,7 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
|
|||
int32_t index = 0;
|
||||
if (envCmd == NULL) return 0;
|
||||
while (envCmd[index]!=NULL) {
|
||||
if (bcmp(envCmd[index], "TAOS_APOLLO_URL", 14) == 0) {
|
||||
if (memcmp(envCmd[index], "TAOS_APOLLO_URL", 14) == 0) {
|
||||
char *p = strchr(envCmd[index], '=');
|
||||
if (p != NULL) {
|
||||
p++;
|
||||
|
@ -934,7 +940,7 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
|
|||
break;
|
||||
}
|
||||
if(line[_bytes - 1] == '\n') line[_bytes - 1] = 0;
|
||||
if (bcmp(line, "TAOS_APOLLO_URL", 14) == 0) {
|
||||
if (memcmp(line, "TAOS_APOLLO_URL", 14) == 0) {
|
||||
char *p = strchr(line, '=');
|
||||
if (p != NULL) {
|
||||
p++;
|
||||
|
@ -975,7 +981,7 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
|
|||
break;
|
||||
}
|
||||
if(line[_bytes - 1] == '\n') line[_bytes - 1] = 0;
|
||||
if (bcmp(line, "TAOS_APOLLO_URL", 14) == 0) {
|
||||
if (memcmp(line, "TAOS_APOLLO_URL", 14) == 0) {
|
||||
char *p = strchr(line, '=');
|
||||
if (p != NULL) {
|
||||
p++;
|
||||
|
|
|
@ -5,7 +5,7 @@ set -e
|
|||
#python3 ./test.py -f 2-query/distinct.py
|
||||
python3 ./test.py -f 2-query/varchar.py
|
||||
|
||||
python3 ./test.py -f 2-query/timezone.py
|
||||
#python3 ./test.py -f 2-query/timezone.py
|
||||
python3 ./test.py -f 2-query/Now.py
|
||||
python3 ./test.py -f 2-query/Today.py
|
||||
|
||||
|
|
|
@ -14,14 +14,12 @@
|
|||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "taos.h"
|
||||
#include "taoserror.h"
|
||||
|
@ -103,8 +101,8 @@ void initLogFile() {
|
|||
TdFilePtr pFile = taosOpenFile(file, TD_FILE_TEXT | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_STREAM);
|
||||
if (NULL == pFile) {
|
||||
fprintf(stderr, "Failed to open %s for save result\n", "./tmqlog.txt");
|
||||
exit -1;
|
||||
};
|
||||
exit(-1);
|
||||
}
|
||||
g_fp = pFile;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,35 @@ void shellPrintHelp() {
|
|||
printf("\n\nReport bugs to %s.\n", SHELL_EMAIL);
|
||||
}
|
||||
|
||||
#ifdef LINUX
|
||||
#include <argp.h>
|
||||
#include <termio.h>
|
||||
|
||||
const char *argp_program_version = version;
|
||||
const char *argp_program_bug_address = SHELL_EMAIL;
|
||||
|
||||
static struct argp_option shellOptions[] = {
|
||||
{"host", 'h', "HOST", 0, SHELL_HOST},
|
||||
{"port", 'P', "PORT", 0, SHELL_PORT},
|
||||
{"user", 'u', "USER", 0, SHELL_USER},
|
||||
{0, 'p', 0, 0, SHELL_PASSWORD},
|
||||
{"auth", 'a', "AUTH", 0, SHELL_AUTH},
|
||||
{"generate-auth", 'A', 0, 0, SHELL_GEN_AUTH},
|
||||
{"config-dir", 'c', "DIR", 0, SHELL_CFG_DIR},
|
||||
{"dump-config", 'C', 0, 0, SHELL_DMP_CFG},
|
||||
{"commands", 's', "COMMANDS", 0, SHELL_CMD},
|
||||
{"raw-time", 'r', 0, 0, SHELL_RAW_TIME},
|
||||
{"file", 'f', "FILE", 0, SHELL_FILE},
|
||||
{"database", 'd', "DATABASE", 0, SHELL_DB},
|
||||
{"check", 'k', 0, 0, SHELL_CHECK},
|
||||
{"startup", 't', 0, 0, SHELL_STARTUP},
|
||||
{"display-width", 'w', "WIDTH", 0, SHELL_WIDTH},
|
||||
{"netrole", 'n', "NETROLE", 0, SHELL_NET_ROLE},
|
||||
{"pktlen", 'l', "PKTLEN", 0, SHELL_PKG_LEN},
|
||||
{"pktnum", 'N', "PKTNUM", 0, SHELL_PKT_NUM},
|
||||
{0},
|
||||
};
|
||||
|
||||
static int32_t shellParseSingleOpt(int32_t key, char *arg) {
|
||||
SShellArgs *pArgs = &shell.args;
|
||||
|
||||
|
@ -178,35 +207,6 @@ int32_t shellParseArgsWithoutArgp(int argc, char *argv[]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LINUX
|
||||
#include <argp.h>
|
||||
#include <termio.h>
|
||||
|
||||
const char *argp_program_version = version;
|
||||
const char *argp_program_bug_address = SHELL_EMAIL;
|
||||
|
||||
static struct argp_option shellOptions[] = {
|
||||
{"host", 'h', "HOST", 0, SHELL_HOST},
|
||||
{"port", 'P', "PORT", 0, SHELL_PORT},
|
||||
{"user", 'u', "USER", 0, SHELL_USER},
|
||||
{0, 'p', 0, 0, SHELL_PASSWORD},
|
||||
{"auth", 'a', "AUTH", 0, SHELL_AUTH},
|
||||
{"generate-auth", 'A', 0, 0, SHELL_GEN_AUTH},
|
||||
{"config-dir", 'c', "DIR", 0, SHELL_CFG_DIR},
|
||||
{"dump-config", 'C', 0, 0, SHELL_DMP_CFG},
|
||||
{"commands", 's', "COMMANDS", 0, SHELL_CMD},
|
||||
{"raw-time", 'r', 0, 0, SHELL_RAW_TIME},
|
||||
{"file", 'f', "FILE", 0, SHELL_FILE},
|
||||
{"database", 'd', "DATABASE", 0, SHELL_DB},
|
||||
{"check", 'k', 0, 0, SHELL_CHECK},
|
||||
{"startup", 't', 0, 0, SHELL_STARTUP},
|
||||
{"display-width", 'w', "WIDTH", 0, SHELL_WIDTH},
|
||||
{"netrole", 'n', "NETROLE", 0, SHELL_NET_ROLE},
|
||||
{"pktlen", 'l', "PKTLEN", 0, SHELL_PKG_LEN},
|
||||
{"pktnum", 'N', "PKTNUM", 0, SHELL_PKT_NUM},
|
||||
{0},
|
||||
};
|
||||
|
||||
static error_t shellParseOpt(int32_t key, char *arg, struct argp_state *state) { return shellParseSingleOpt(key, arg); }
|
||||
|
||||
static struct argp shellArgp = {shellOptions, shellParseOpt, "", ""};
|
||||
|
@ -335,7 +335,7 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
|
|||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
shell.info.osname = "Windows";
|
||||
snprintf(shell.history.file, TSDB_FILENAME_LEN, "C:/TDengine/%s", SHELL_HISTORY_FILE);
|
||||
if (shellParseArgsWithoutArgp(argc, argv) != 0) return -1;
|
||||
// if (shellParseArgsWithoutArgp(argc, argv) != 0) return -1;
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
shell.info.osname = "Darwin";
|
||||
snprintf(shell.history.file, TSDB_FILENAME_LEN, "%s/%s", getpwuid(getuid())->pw_dir, SHELL_HISTORY_FILE);
|
||||
|
|
|
@ -54,8 +54,8 @@ static void shellClearScreen(int32_t ecmd_pos, int32_t cursor_pos);
|
|||
static void shellShowOnScreen(SShellCmd *cmd);
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
static void shellPrintContinuePrompt() { printf("%s", shell.args.promptContinue); }
|
||||
static void shellPrintPrompt() { printf("%s", shell.args.promptHeader); }
|
||||
// static void shellPrintContinuePrompt() { printf("%s", shell.args.promptContinue); }
|
||||
// static void shellPrintPrompt() { printf("%s", shell.args.promptHeader); }
|
||||
|
||||
void shellUpdateBuffer(SShellCmd *cmd) {
|
||||
if (shellRegexMatch(cmd->buffer, "(\\s+$)|(^$)", REG_EXTENDED)) strcat(cmd->command, " ");
|
||||
|
@ -112,7 +112,7 @@ int32_t shellReadCommand(char command[]) {
|
|||
cmd.command = NULL;
|
||||
return 0;
|
||||
} else {
|
||||
shellPrintContinuePrompt();
|
||||
// shellPrintContinuePrompt();
|
||||
shellUpdateBuffer(&cmd);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -42,8 +42,6 @@ int main(int argc, char *argv[]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
taos_init();
|
||||
|
||||
if (shell.args.is_dump_config) {
|
||||
shellDumpConfig();
|
||||
taos_cleanup();
|
||||
|
|
Loading…
Reference in New Issue