Merge branch '3.0' into cpwu/3.0
This commit is contained in:
commit
02b31dd01d
|
@ -6,13 +6,17 @@ project(
|
|||
DESCRIPTION "An open-source big data platform designed and optimized for the Internet of Things(IOT)"
|
||||
)
|
||||
|
||||
set(CMAKE_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(CMAKE_CONTRIB_DIR "${CMAKE_SOURCE_DIR}/contrib")
|
||||
if (NOT DEFINED TD_SOURCE_DIR)
|
||||
set( TD_SOURCE_DIR ${CMAKE_SOURCE_DIR} )
|
||||
endif()
|
||||
|
||||
include(${CMAKE_SUPPORT_DIR}/cmake.platform)
|
||||
include(${CMAKE_SUPPORT_DIR}/cmake.define)
|
||||
include(${CMAKE_SUPPORT_DIR}/cmake.options)
|
||||
include(${CMAKE_SUPPORT_DIR}/cmake.version)
|
||||
set(TD_SUPPORT_DIR "${TD_SOURCE_DIR}/cmake")
|
||||
set(TD_CONTRIB_DIR "${TD_SOURCE_DIR}/contrib")
|
||||
|
||||
include(${TD_SUPPORT_DIR}/cmake.platform)
|
||||
include(${TD_SUPPORT_DIR}/cmake.define)
|
||||
include(${TD_SUPPORT_DIR}/cmake.options)
|
||||
include(${TD_SUPPORT_DIR}/cmake.version)
|
||||
|
||||
# contrib
|
||||
add_subdirectory(contrib)
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
ExternalProject_Add(bdb
|
||||
GIT_REPOSITORY https://github.com/berkeleydb/libdb.git
|
||||
GIT_TAG v5.3.28
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/bdb"
|
||||
BINARY_DIR "${CMAKE_CONTRIB_DIR}/bdb"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/bdb"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/bdb"
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND COMMAND ./dist/configure --enable-debug
|
||||
BUILD_COMMAND "$(MAKE)"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(cjson
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/cJSON.git
|
||||
GIT_TAG v1.7.15
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/cJson"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/cJson"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
ExternalProject_Add(craft
|
||||
GIT_REPOSITORY https://github.com/canonical/raft.git
|
||||
GIT_TAG v0.11.2
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/craft"
|
||||
BINARY_DIR "${CMAKE_CONTRIB_DIR}/craft"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/craft"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/craft"
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
# https://answers.ros.org/question/333125/how-to-include-external-automakeautoconf-projects-into-ament_cmake/
|
||||
CONFIGURE_COMMAND COMMAND autoreconf -i COMMAND ./configure --enable-example
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(gnuregex
|
||||
URL https://launchpad.net/gnuregex/trunk/2.9/+download/libgnurx-src-2.9.zip
|
||||
DOWNLOAD_NAME libgnurx-src.zip
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/gnuregex"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/gnuregex"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/googletest.git
|
||||
GIT_TAG release-1.11.0
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/googletest"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/googletest"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(iconv
|
||||
GIT_REPOSITORY https://github.com/win-iconv/win-iconv.git
|
||||
GIT_TAG v0.0.8
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/iconv"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/iconv"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(leveldb
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/leveldb.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/leveldb"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/leveldb"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
ExternalProject_Add(libuv
|
||||
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
||||
GIT_TAG v1.42.0
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/libuv"
|
||||
BINARY_DIR "${CMAKE_CONTRIB_DIR}/libuv"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/libuv"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/libuv"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# lucene
|
||||
ExternalProject_Add(lucene
|
||||
GIT_REPOSITORY https://github.com/yihaoDeng/LucenePlusPlus.git
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/lucene"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/lucene"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(lz4
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/lz4.git
|
||||
GIT_TAG v1.9.3
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/lz4"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/lz4"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
ExternalProject_Add(NuRaft
|
||||
GIT_REPOSITORY https://github.com/eBay/NuRaft.git
|
||||
GIT_TAG v1.3.0
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/nuraft"
|
||||
BINARY_DIR "${CMAKE_CONTRIB_DIR}/nuraft"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/nuraft"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/nuraft"
|
||||
CONFIGURE_COMMAND "./prepare.sh"
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(pthread
|
||||
GIT_REPOSITORY https://github.com/GerHobbelt/pthread-win32
|
||||
GIT_TAG v3.0.3.1
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/pthread-win32"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/pthread-win32"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(rocksdb
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/rocksdb.git
|
||||
GIT_TAG v6.23.3
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/rocksdb"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/rocksdb"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
ExternalProject_Add(sqlite
|
||||
GIT_REPOSITORY https://github.com/sqlite/sqlite.git
|
||||
GIT_TAG version-3.36.0
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/sqlite"
|
||||
BINARY_DIR "${CMAKE_CONTRIB_DIR}/sqlite"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/sqlite"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/sqlite"
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND "./configure"
|
||||
BUILD_COMMAND "$(MAKE)"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
ExternalProject_Add(stub
|
||||
GIT_REPOSITORY https://github.com/coolxv/cpp-stub.git
|
||||
GIT_SUBMODULES "src"
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/cpp-stub"
|
||||
BINARY_DIR "${CMAKE_CONTRIB_DIR}/cpp-stub/src"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/cpp-stub"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/cpp-stub/src"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
ExternalProject_Add(traft
|
||||
GIT_REPOSITORY https://github.com/taosdata/traft.git
|
||||
GIT_TAG for_3.0
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/traft"
|
||||
BINARY_DIR "${CMAKE_CONTRIB_DIR}/traft"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/traft"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/traft"
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
# https://answers.ros.org/question/333125/how-to-include-external-automakeautoconf-projects-into-ament_cmake/
|
||||
CONFIGURE_COMMAND COMMAND autoreconf -i COMMAND ./configure
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ExternalProject_Add(zlib
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/zlib.git
|
||||
GIT_TAG v1.2.11
|
||||
SOURCE_DIR "${CMAKE_CONTRIB_DIR}/zlib"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/zlib"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
|
|
|
@ -7,88 +7,88 @@ function(cat IN_FILE OUT_FILE)
|
|||
endfunction(cat IN_FILE OUT_FILE)
|
||||
|
||||
set(CONTRIB_TMP_FILE "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in")
|
||||
configure_file("${CMAKE_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# pthread
|
||||
if(${BUILD_PTHREAD})
|
||||
cat("${CMAKE_SUPPORT_DIR}/pthread_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/pthread_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# gnu regex
|
||||
if(${BUILD_GNUREGEX})
|
||||
cat("${CMAKE_SUPPORT_DIR}/gnuregex_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/gnuregex_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# googletest
|
||||
if(${BUILD_TEST})
|
||||
cat("${CMAKE_SUPPORT_DIR}/gtest_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${CMAKE_SUPPORT_DIR}/stub_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/gtest_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/stub_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_TEST})
|
||||
|
||||
# lz4
|
||||
cat("${CMAKE_SUPPORT_DIR}/lz4_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/lz4_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# zlib
|
||||
cat("${CMAKE_SUPPORT_DIR}/zlib_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/zlib_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# cJson
|
||||
cat("${CMAKE_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# leveldb
|
||||
if(${BUILD_WITH_LEVELDB})
|
||||
cat("${CMAKE_SUPPORT_DIR}/leveldb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/leveldb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_LEVELDB})
|
||||
|
||||
# rocksdb
|
||||
if(${BUILD_WITH_ROCKSDB})
|
||||
cat("${CMAKE_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
add_definitions(-DUSE_ROCKSDB)
|
||||
endif(${BUILD_WITH_ROCKSDB})
|
||||
|
||||
# canonical-raft
|
||||
if(${BUILD_WITH_CRAFT})
|
||||
cat("${CMAKE_SUPPORT_DIR}/craft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/craft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
SET(BUILD_WITH_UV ON CACHE BOOL "craft need libuv" FORCE)
|
||||
endif(${BUILD_WITH_CRAFT})
|
||||
|
||||
# traft
|
||||
if(${BUILD_WITH_TRAFT})
|
||||
cat("${CMAKE_SUPPORT_DIR}/traft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/traft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
SET(BUILD_WITH_UV ON CACHE BOOL "traft need libuv" FORCE)
|
||||
endif(${BUILD_WITH_TRAFT})
|
||||
|
||||
#libuv
|
||||
if(${BUILD_WITH_UV})
|
||||
cat("${CMAKE_SUPPORT_DIR}/libuv_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/libuv_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_UV})
|
||||
|
||||
# bdb
|
||||
#if(${BUILD_WITH_BDB})
|
||||
#cat("${CMAKE_SUPPORT_DIR}/bdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
#cat("${TD_SUPPORT_DIR}/bdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
#endif(${BUILD_WITH_BDB})
|
||||
|
||||
# sqlite
|
||||
if(${BUILD_WITH_SQLITE})
|
||||
cat("${CMAKE_SUPPORT_DIR}/sqlite_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/sqlite_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_SQLITE})
|
||||
|
||||
# lucene
|
||||
if(${BUILD_WITH_LUCENE})
|
||||
cat("${CMAKE_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
add_definitions(-DUSE_LUCENE)
|
||||
endif(${BUILD_WITH_LUCENE})
|
||||
|
||||
# NuRaft
|
||||
if(${BUILD_WITH_NURAFT})
|
||||
cat("${CMAKE_SUPPORT_DIR}/nuraft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/nuraft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_NURAFT})
|
||||
|
||||
# download dependencies
|
||||
configure_file(${CONTRIB_TMP_FILE} "${CMAKE_CONTRIB_DIR}/deps-download/CMakeLists.txt")
|
||||
configure_file(${CONTRIB_TMP_FILE} "${TD_CONTRIB_DIR}/deps-download/CMakeLists.txt")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY "${CMAKE_CONTRIB_DIR}/deps-download")
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY "${CMAKE_CONTRIB_DIR}/deps-download")
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
|
||||
|
||||
# ================================================================================================
|
||||
# Build
|
||||
|
@ -105,7 +105,7 @@ endif(${BUILD_TEST})
|
|||
|
||||
# cJson
|
||||
# see https://stackoverflow.com/questions/37582508/silence-cmp0048-warnings-in-vendored-projects
|
||||
set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_SUPPORT_DIR}/EnableCMP0048.txt.in")
|
||||
set(CMAKE_PROJECT_INCLUDE_BEFORE "${TD_SUPPORT_DIR}/EnableCMP0048.txt.in")
|
||||
option(ENABLE_CJSON_TEST "Enable building cJSON test" OFF)
|
||||
option(CJSON_OVERRIDE_BUILD_SHARED_LIBS "Override BUILD_SHARED_LIBS with CJSON_BUILD_SHARED_LIBS" ON)
|
||||
option(CJSON_BUILD_SHARED_LIBS "Overrides BUILD_SHARED_LIBS if CJSON_OVERRIDE_BUILD_SHARED_LIBS is enabled" OFF)
|
||||
|
@ -125,7 +125,7 @@ target_include_directories(
|
|||
)
|
||||
|
||||
# zlib
|
||||
set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_SUPPORT_DIR}/EnableCMP0048.txt.in")
|
||||
set(CMAKE_PROJECT_INCLUDE_BEFORE "${TD_SUPPORT_DIR}/EnableCMP0048.txt.in")
|
||||
add_subdirectory(zlib)
|
||||
target_include_directories(
|
||||
zlibstatic
|
||||
|
|
|
@ -4,7 +4,7 @@ if(${BUILD_DOCS})
|
|||
find_package(Doxygen)
|
||||
if (DOXYGEN_FOUND)
|
||||
# Build the doc
|
||||
set(DOXYGEN_IN ${CMAKE_SOURCE_DIR}/docs/Doxyfile.in)
|
||||
set(DOXYGEN_IN ${TD_SOURCE_DIR}/docs/Doxyfile.in)
|
||||
set(DOXYGEN_OUT ${CMAKE_BINARY_DIR}/Doxyfile)
|
||||
|
||||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
||||
|
|
|
@ -829,7 +829,7 @@ WARN_LOGFILE =
|
|||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = @CMAKE_SOURCE_DIR@/include @CMAKE_SOURCE_DIR@/source
|
||||
INPUT = @TD_SOURCE_DIR@/include @TD_SOURCE_DIR@/source
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
|
|
|
@ -65,13 +65,14 @@ typedef struct SDataBlockInfo {
|
|||
STimeWindow window;
|
||||
int32_t rows;
|
||||
int32_t rowSize;
|
||||
int16_t numOfCols;
|
||||
int16_t hasVarCol;
|
||||
union {
|
||||
int64_t uid;
|
||||
int64_t uid; // from which table of uid, comes from this data block
|
||||
int64_t blockId;
|
||||
};
|
||||
uint64_t groupId; // no need to serialize
|
||||
int16_t numOfCols;
|
||||
int16_t hasVarCol;
|
||||
int16_t capacity;
|
||||
} SDataBlockInfo;
|
||||
|
||||
typedef struct SSDataBlock {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#define _TD_COMMON_EP_H_
|
||||
|
||||
#include "tcommon.h"
|
||||
#include "tcompression.h"
|
||||
#include "tmsg.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -196,7 +197,10 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
|
|||
|
||||
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows);
|
||||
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
||||
|
||||
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows);
|
||||
void blockDataCleanup(SSDataBlock* pDataBlock);
|
||||
|
||||
size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
|
||||
void* blockDataDestroy(SSDataBlock* pBlock);
|
||||
|
||||
|
@ -206,6 +210,52 @@ SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock);
|
|||
|
||||
void blockDebugShowData(const SArray* dataBlocks);
|
||||
|
||||
static FORCE_INLINE int32_t blockCompressColData(SColumnInfoData* pColRes, int32_t numOfRows, char* data,
|
||||
int8_t compressed) {
|
||||
int32_t colSize = colDataGetLength(pColRes, numOfRows);
|
||||
return (*(tDataTypes[pColRes->info.type].compFunc))(pColRes->pData, colSize, numOfRows, data,
|
||||
colSize + COMP_OVERFLOW_BYTES, compressed, NULL, 0);
|
||||
}
|
||||
|
||||
static FORCE_INLINE void blockCompressEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols,
|
||||
int8_t needCompress) {
|
||||
int32_t* colSizes = (int32_t*)data;
|
||||
|
||||
data += numOfCols * sizeof(int32_t);
|
||||
*dataLen = (numOfCols * sizeof(int32_t));
|
||||
|
||||
int32_t numOfRows = pBlock->info.rows;
|
||||
for (int32_t col = 0; col < numOfCols; ++col) {
|
||||
SColumnInfoData* pColRes = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, col);
|
||||
|
||||
// copy the null bitmap
|
||||
if (IS_VAR_DATA_TYPE(pColRes->info.type)) {
|
||||
size_t metaSize = numOfRows * sizeof(int32_t);
|
||||
memcpy(data, pColRes->varmeta.offset, metaSize);
|
||||
data += metaSize;
|
||||
(*dataLen) += metaSize;
|
||||
} else {
|
||||
int32_t len = BitmapLen(numOfRows);
|
||||
memcpy(data, pColRes->nullbitmap, len);
|
||||
data += len;
|
||||
(*dataLen) += len;
|
||||
}
|
||||
|
||||
if (needCompress) {
|
||||
colSizes[col] = blockCompressColData(pColRes, numOfRows, data, needCompress);
|
||||
data += colSizes[col];
|
||||
(*dataLen) += colSizes[col];
|
||||
} else {
|
||||
colSizes[col] = colDataGetLength(pColRes, numOfRows);
|
||||
(*dataLen) += colSizes[col];
|
||||
memmove(data, pColRes->pData, colSizes[col]);
|
||||
data += colSizes[col];
|
||||
}
|
||||
|
||||
colSizes[col] = htonl(colSizes[col]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -131,12 +131,17 @@ typedef struct {
|
|||
STColumn *columns;
|
||||
} STSchemaBuilder;
|
||||
|
||||
#define TD_VTYPE_BITS 2 // val type
|
||||
#define TD_VTYPE_PARTS 4 // 8 bits / TD_VTYPE_BITS = 4
|
||||
#define TD_VTYPE_OPTR 3 // TD_VTYPE_PARTS - 1, utilize to get remainder
|
||||
// use 2 bits for bitmap(default: STSRow/sub block)
|
||||
#define TD_VTYPE_BITS 2
|
||||
#define TD_VTYPE_PARTS 4 // PARTITIONS: 1 byte / 2 bits
|
||||
#define TD_VTYPE_OPTR 3 // OPERATOR: 4 - 1, utilize to get remainder
|
||||
#define TD_BITMAP_BYTES(cnt) (((cnt) + TD_VTYPE_OPTR) >> 2)
|
||||
|
||||
#define TD_BITMAP_BYTES(cnt) (ceil((double)(cnt) / TD_VTYPE_PARTS))
|
||||
#define TD_BIT_TO_BYTES(cnt) (ceil((double)(cnt) / 8))
|
||||
// use 1 bit for bitmap(super block)
|
||||
#define TD_VTYPE_BITS_I 1
|
||||
#define TD_VTYPE_PARTS_I 8 // PARTITIONS: 1 byte / 1 bit
|
||||
#define TD_VTYPE_OPTR_I 7 // OPERATOR: 8 - 1, utilize to get remainder
|
||||
#define TD_BITMAP_BYTES_I(cnt) (((cnt) + TD_VTYPE_OPTR_I) >> 3)
|
||||
|
||||
int32_t tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version);
|
||||
void tdDestroyTSchemaBuilder(STSchemaBuilder *pBuilder);
|
||||
|
@ -368,8 +373,9 @@ static FORCE_INLINE void tdCopyColOfRowBySchema(SDataRow dst, STSchema *pDstSche
|
|||
// SDataCol arrangement: data => bitmap => dataOffset
|
||||
typedef struct SDataCol {
|
||||
int8_t type; // column type
|
||||
uint8_t bitmap : 1; // 0: has bitmap if has NULL/NORM rows, 1: no bitmap if all rows are NORM
|
||||
uint8_t reserve : 7;
|
||||
uint8_t bitmap : 1; // 0: no bitmap if all rows are NORM, 1: has bitmap if has NULL/NORM rows
|
||||
uint8_t bitmapMode : 1; // default is 0(2 bits), otherwise 1(1 bit)
|
||||
uint8_t reserve : 6;
|
||||
int16_t colId; // column ID
|
||||
int32_t bytes; // column data bytes defined
|
||||
int32_t offset; // data offset in a SDataRow (including the header size)
|
||||
|
@ -381,6 +387,8 @@ typedef struct SDataCol {
|
|||
TSKEY ts; // only used in last NULL column
|
||||
} SDataCol;
|
||||
|
||||
|
||||
|
||||
#define isAllRowsNull(pCol) ((pCol)->len == 0)
|
||||
#define isAllRowsNone(pCol) ((pCol)->len == 0)
|
||||
static FORCE_INLINE void dataColReset(SDataCol *pDataCol) { pDataCol->len = 0; }
|
||||
|
@ -421,10 +429,14 @@ typedef struct {
|
|||
col_id_t numOfCols; // Total number of cols
|
||||
int32_t maxPoints; // max number of points
|
||||
int32_t numOfRows;
|
||||
int32_t sversion; // TODO: set sversion
|
||||
int32_t bitmapMode : 1; // default is 0(2 bits), otherwise 1(1 bit)
|
||||
int32_t sversion : 31; // TODO: set sversion(not used yet)
|
||||
SDataCol *cols;
|
||||
} SDataCols;
|
||||
|
||||
static FORCE_INLINE bool tdDataColsIsBitmapI(SDataCols *pCols) { return pCols->bitmapMode != 0; }
|
||||
static FORCE_INLINE void tdDataColsSetBitmapI(SDataCols *pCols) { pCols->bitmapMode = 1; }
|
||||
|
||||
#define keyCol(pCols) (&((pCols)->cols[0])) // Key column
|
||||
#define dataColsTKeyAt(pCols, idx) ((TKEY *)(keyCol(pCols)->pData))[(idx)] // the idx row of column-wised data
|
||||
#define dataColsKeyAt(pCols, idx) tdGetKey(dataColsTKeyAt(pCols, idx))
|
||||
|
|
|
@ -126,6 +126,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
|
|||
int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloUrl, SArray *pArgs, bool tsc);
|
||||
void taosCleanupCfg();
|
||||
void taosCfgDynamicOptions(const char *option, const char *value);
|
||||
void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary);
|
||||
|
||||
struct SConfig *taosGetCfg();
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_GTANT_H
|
||||
#define TDENGINE_GTANT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
"C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TSDB_GRANT_ALL,
|
||||
TSDB_GRANT_TIME,
|
||||
TSDB_GRANT_USER,
|
||||
TSDB_GRANT_DB,
|
||||
TSDB_GRANT_TIMESERIES,
|
||||
TSDB_GRANT_DNODE,
|
||||
TSDB_GRANT_ACCT,
|
||||
TSDB_GRANT_STORAGE,
|
||||
TSDB_GRANT_SPEED,
|
||||
TSDB_GRANT_QUERY_TIME,
|
||||
TSDB_GRANT_CONNS,
|
||||
TSDB_GRANT_STREAMS,
|
||||
TSDB_GRANT_CPU_CORES,
|
||||
} EGrantType;
|
||||
|
||||
int32_t grantInit();
|
||||
void grantCleanUp();
|
||||
void grantParseParameter();
|
||||
int32_t grantCheck(EGrantType grant);
|
||||
void grantReset(EGrantType grant, uint64_t value);
|
||||
void grantAdd(EGrantType grant, uint64_t value);
|
||||
void grantRestore(EGrantType grant, uint64_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -622,7 +622,6 @@ typedef struct {
|
|||
int32_t tSerializeSDbCfgRsp(void* buf, int32_t bufLen, const SDbCfgRsp* pRsp);
|
||||
int32_t tDeserializeSDbCfgRsp(void* buf, int32_t bufLen, SDbCfgRsp* pRsp);
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32_t rowNum;
|
||||
} SQnodeListReq;
|
||||
|
@ -1023,10 +1022,12 @@ int32_t tDeserializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq
|
|||
|
||||
typedef struct {
|
||||
int32_t dnodeId;
|
||||
} SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq;
|
||||
} SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq, SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq,
|
||||
SMCreateSnodeReq, SMDropSnodeReq, SDCreateSnodeReq, SDDropSnodeReq, SMCreateBnodeReq, SMDropBnodeReq,
|
||||
SDCreateBnodeReq, SDDropBnodeReq;
|
||||
|
||||
int32_t tSerializeSMCreateDropMnodeReq(void* buf, int32_t bufLen, SMCreateMnodeReq* pReq);
|
||||
int32_t tDeserializeSMCreateDropMnodeReq(void* buf, int32_t bufLen, SMCreateMnodeReq* pReq);
|
||||
int32_t tSerializeSCreateDropMQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
||||
int32_t tDeserializeSCreateDropMQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
int32_t dnodeId;
|
||||
|
@ -1037,14 +1038,6 @@ typedef struct {
|
|||
int32_t tSerializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
||||
int32_t tDeserializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
int32_t dnodeId;
|
||||
} SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq, SMCreateSnodeReq, SMDropSnodeReq,
|
||||
SDCreateSnodeReq, SDDropSnodeReq, SMCreateBnodeReq, SMDropBnodeReq, SDCreateBnodeReq, SDDropBnodeReq;
|
||||
|
||||
int32_t tSerializeSMCreateDropQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
||||
int32_t tDeserializeSMCreateDropQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
char sql[TSDB_SHOW_SQL_LEN];
|
||||
int32_t queryId;
|
||||
|
@ -2305,6 +2298,22 @@ static FORCE_INLINE void* tDecodeTSmaWrapper(void* buf, STSmaWrapper* pSW) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int idx;
|
||||
} SMCreateFullTextReq;
|
||||
|
||||
int32_t tSerializeSMCreateFullTextReq(void* buf, int32_t bufLen, SMCreateFullTextReq* pReq);
|
||||
int32_t tDeserializeSMCreateFullTextReq(void* buf, int32_t bufLen, SMCreateFullTextReq* pReq);
|
||||
void tFreeSMCreateFullTextReq(SMCreateFullTextReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
char name[TSDB_TABLE_FNAME_LEN];
|
||||
int8_t igNotExists;
|
||||
} SMDropFullTextReq;
|
||||
|
||||
int32_t tSerializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
|
||||
int32_t tDeserializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
char indexFName[TSDB_INDEX_FNAME_LEN];
|
||||
} SUserIndexReq;
|
||||
|
|
|
@ -155,6 +155,8 @@ enum {
|
|||
TD_DEF_MSG_TYPE(TDMT_MND_CREATE_STREAM, "mnode-create-stream", SCMCreateStreamReq, SCMCreateStreamRsp)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_ALTER_STREAM, "mnode-alter-stream", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_DROP_STREAM, "mnode-drop-stream", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_CREATE_INDEX, "mnode-create-index", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_DROP_INDEX, "mnode-drop-index", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_GET_DB_CFG, "mnode-get-db-cfg", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_GET_INDEX, "mnode-get-index", NULL, NULL)
|
||||
|
||||
|
|
|
@ -40,21 +40,20 @@ extern "C" {
|
|||
#define TD_ROW_KV 0x01U
|
||||
|
||||
/**
|
||||
* @brief val type
|
||||
* - for data from client input and STSRow in memory, 3 types of val none/null/norm available
|
||||
* - for data in
|
||||
* @brief value type
|
||||
* - for data from client input and STSRow in memory, 3 types of value none/null/norm available
|
||||
*/
|
||||
#define TD_VTYPE_NONE 0x0U // none or unknown/undefined
|
||||
#define TD_VTYPE_NORM 0x00U // normal val: not none, not null(no need assign value)
|
||||
#define TD_VTYPE_NULL 0x01U // null val
|
||||
#define TD_VTYPE_NORM 0x02U // normal val: not none, not null
|
||||
#define TD_VTYPE_NONE 0x02U // none or unknown/undefined
|
||||
#define TD_VTYPE_MAX 0x03U //
|
||||
|
||||
#define TD_VTYPE_NONE_BYTE 0x0U
|
||||
#define TD_VTYPE_NORM_BYTE 0x0U
|
||||
#define TD_VTYPE_NULL_BYTE 0x55U
|
||||
#define TD_VTYPE_NORM_BYTE 0xAAU
|
||||
#define TD_VTYPE_NONE_BYTE 0xAAU
|
||||
|
||||
#define TD_ROWS_ALL_NORM 0x01U
|
||||
#define TD_ROWS_NULL_NORM 0x0U
|
||||
#define TD_ROWS_ALL_NORM 0x00U
|
||||
#define TD_ROWS_NULL_NORM 0x01U
|
||||
|
||||
#define TD_COL_ROWS_NORM(c) ((c)->bitmap == TD_ROWS_ALL_NORM) // all rows of SDataCol/SBlockCol is NORM
|
||||
#define TD_SET_COL_ROWS_BTIMAP(c, v) ((c)->bitmap = (v))
|
||||
|
@ -126,15 +125,15 @@ typedef struct {
|
|||
uint32_t info;
|
||||
struct {
|
||||
/// row type
|
||||
uint32_t type : 2;
|
||||
uint16_t type : 2;
|
||||
/// is delete row(0 not delete, 1 delete)
|
||||
uint32_t del : 1;
|
||||
uint16_t del : 1;
|
||||
/// endian(0 little endian, 1 big endian)
|
||||
uint32_t endian : 1;
|
||||
uint16_t endian : 1;
|
||||
/// reserved for back compatibility
|
||||
uint32_t reserve : 12;
|
||||
uint16_t reserve : 12;
|
||||
/// row schema version
|
||||
uint32_t sver : 16;
|
||||
uint16_t sver;
|
||||
};
|
||||
};
|
||||
/// row total length
|
||||
|
@ -216,11 +215,16 @@ static FORCE_INLINE void *tdKVRowColVal(STSRow *pRow, SKvRowIdx *pIdx) { return
|
|||
|
||||
#define TD_ROW_OFFSET(p) ((p)->toffset); // During ParseInsert when without STSchema, how to get the offset for STpRow?
|
||||
|
||||
void tdMergeBitmap(uint8_t *srcBitmap, int32_t srcLen, uint8_t *dstBitmap);
|
||||
static FORCE_INLINE void tdRowCopy(void *dst, STSRow *row) { memcpy(dst, row, TD_ROW_LEN(row)); }
|
||||
static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType);
|
||||
int32_t tdSetBitmapValTypeN(void *pBitmap, int16_t nEle, TDRowValT valType);
|
||||
static FORCE_INLINE int32_t tdGetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT *pValType);
|
||||
int32_t tdAppendValToDataCol(SDataCol *pCol, TDRowValT valType, const void *val, int32_t numOfRows, int32_t maxPoints);
|
||||
static FORCE_INLINE int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType);
|
||||
static FORCE_INLINE int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType);
|
||||
static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType, int8_t bitmapMode);
|
||||
int32_t tdSetBitmapValTypeN(void *pBitmap, int16_t nEle, TDRowValT valType, int8_t bitmapMode);
|
||||
static FORCE_INLINE int32_t tdGetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT *pValType);
|
||||
static FORCE_INLINE int32_t tdGetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT *pValType);
|
||||
int32_t tdAppendValToDataCol(SDataCol *pCol, TDRowValT valType, const void *val, int32_t numOfRows, int32_t maxPoints,
|
||||
int8_t bitmapMode);
|
||||
static FORCE_INLINE int32_t tdAppendColValToTpRow(SRowBuilder *pBuilder, TDRowValT valType, const void *val,
|
||||
bool isCopyVarData, int8_t colType, int16_t colIdx, int32_t offset);
|
||||
static FORCE_INLINE int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowValT valType, const void *val,
|
||||
|
@ -259,15 +263,32 @@ static FORCE_INLINE void *tdGetBitmapAddr(STSRow *pRow, uint8_t rowType, uint32_
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType, int8_t bitmapMode) {
|
||||
switch (bitmapMode) {
|
||||
case 0:
|
||||
tdSetBitmapValTypeII(pBitmap, colIdx, valType);
|
||||
break;
|
||||
case -1:
|
||||
case 1:
|
||||
tdSetBitmapValTypeI(pBitmap, colIdx, valType);
|
||||
break;
|
||||
default:
|
||||
TASSERT(0);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @brief Use 2 bits at default
|
||||
*
|
||||
* @param pBitmap
|
||||
* @param colIdx The relative index of colId, may have minus value as parameter.
|
||||
* @param valType
|
||||
* @return FORCE_INLINE
|
||||
*/
|
||||
static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
||||
static FORCE_INLINE int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
TASSERT(0);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
|
@ -276,18 +297,140 @@ static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TD
|
|||
int16_t nBytes = colIdx / TD_VTYPE_PARTS;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR;
|
||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||
// use literal value directly and not use formula to simplify the codes
|
||||
switch (nOffset) {
|
||||
case 0:
|
||||
*pDestByte = ((*pDestByte) & 0x3F) | (valType << 6);
|
||||
// *pDestByte = ((*pDestByte) & 0x3F) | (valType << 6);
|
||||
// set the value and clear other partitions for offset 0
|
||||
*pDestByte = (valType << 6);
|
||||
break;
|
||||
case 1:
|
||||
*pDestByte = ((*pDestByte) & 0xCF) | (valType << 4);
|
||||
// *pDestByte = ((*pDestByte) & 0xCF) | (valType << 4);
|
||||
*pDestByte |= (valType << 4);
|
||||
break;
|
||||
case 2:
|
||||
*pDestByte = ((*pDestByte) & 0xF3) | (valType << 2);
|
||||
// *pDestByte = ((*pDestByte) & 0xF3) | (valType << 2);
|
||||
*pDestByte |= (valType << 2);
|
||||
break;
|
||||
case 3:
|
||||
*pDestByte = ((*pDestByte) & 0xFC) | valType;
|
||||
// *pDestByte = ((*pDestByte) & 0xFC) | valType;
|
||||
*pDestByte |= (valType);
|
||||
break;
|
||||
default:
|
||||
TASSERT(0);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tdGetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT *pValType, int8_t bitmapMode) {
|
||||
switch (bitmapMode) {
|
||||
case 0:
|
||||
tdGetBitmapValTypeII(pBitmap, colIdx, pValType);
|
||||
break;
|
||||
case -1:
|
||||
case 1:
|
||||
tdGetBitmapValTypeI(pBitmap, colIdx, pValType);
|
||||
break;
|
||||
default:
|
||||
TASSERT(0);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Use 2 bits at default
|
||||
*
|
||||
* @param pBitmap
|
||||
* @param colIdx The relative index of colId, may have minus value as parameter.
|
||||
* @param pValType
|
||||
* @return FORCE_INLINE
|
||||
*/
|
||||
static FORCE_INLINE int32_t tdGetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
TASSERT(0);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR;
|
||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||
// use literal value directly and not use formula to simplify the codes
|
||||
switch (nOffset) {
|
||||
case 0:
|
||||
*pValType = (((*pDestByte) & 0xC0) >> 6);
|
||||
break;
|
||||
case 1:
|
||||
*pValType = (((*pDestByte) & 0x30) >> 4);
|
||||
break;
|
||||
case 2:
|
||||
*pValType = (((*pDestByte) & 0x0C) >> 2);
|
||||
break;
|
||||
case 3:
|
||||
*pValType = ((*pDestByte) & 0x03);
|
||||
break;
|
||||
default:
|
||||
TASSERT(0);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param pBitmap
|
||||
* @param colIdx The relative index of colId, may have minus value as parameter.
|
||||
* @param valType
|
||||
* @return FORCE_INLINE
|
||||
*/
|
||||
static FORCE_INLINE int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
TASSERT(0);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS_I;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR_I;
|
||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||
// use literal value directly and not use formula to simplify the codes
|
||||
switch (nOffset) {
|
||||
case 0:
|
||||
// *pDestByte = ((*pDestByte) & 0x7F) | (valType << 7);
|
||||
// set the value and clear other partitions for offset 0
|
||||
*pDestByte = (valType << 7);
|
||||
break;
|
||||
case 1:
|
||||
// *pDestByte = ((*pDestByte) & 0xBF) | (valType << 6);
|
||||
*pDestByte |= (valType << 6);
|
||||
break;
|
||||
case 2:
|
||||
// *pDestByte = ((*pDestByte) & 0xDF) | (valType << 5);
|
||||
*pDestByte |= (valType << 5);
|
||||
break;
|
||||
case 3:
|
||||
// *pDestByte = ((*pDestByte) & 0xEF) | (valType << 4);
|
||||
*pDestByte |= (valType << 4);
|
||||
break;
|
||||
case 4:
|
||||
// *pDestByte = ((*pDestByte) & 0xF7) | (valType << 3);
|
||||
*pDestByte |= (valType << 3);
|
||||
break;
|
||||
case 5:
|
||||
// *pDestByte = ((*pDestByte) & 0xFB) | (valType << 2);
|
||||
*pDestByte |= (valType << 2);
|
||||
break;
|
||||
case 6:
|
||||
// *pDestByte = ((*pDestByte) & 0xFD) | (valType << 1);
|
||||
*pDestByte |= (valType << 1);
|
||||
break;
|
||||
case 7:
|
||||
// *pDestByte = ((*pDestByte) & 0xFE) | valType;
|
||||
*pDestByte |= (valType);
|
||||
break;
|
||||
default:
|
||||
TASSERT(0);
|
||||
|
@ -305,27 +448,40 @@ static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TD
|
|||
* @param pValType
|
||||
* @return FORCE_INLINE
|
||||
*/
|
||||
static FORCE_INLINE int32_t tdGetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||
static FORCE_INLINE int32_t tdGetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
TASSERT(0);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR;
|
||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS_I;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR_I;
|
||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||
// use literal value directly and not use formula to simplify the codes
|
||||
switch (nOffset) {
|
||||
case 0:
|
||||
*pValType = (((*pDestByte) & 0xC0) >> 6);
|
||||
*pValType = (((*pDestByte) & 0x80) >> 7);
|
||||
break;
|
||||
case 1:
|
||||
*pValType = (((*pDestByte) & 0x30) >> 4);
|
||||
*pValType = (((*pDestByte) & 0x40) >> 6);
|
||||
break;
|
||||
case 2:
|
||||
*pValType = (((*pDestByte) & 0x0C) >> 2);
|
||||
*pValType = (((*pDestByte) & 0x20) >> 5);
|
||||
break;
|
||||
case 3:
|
||||
*pValType = ((*pDestByte) & 0x03);
|
||||
*pValType = (((*pDestByte) & 0x10) >> 4);
|
||||
break;
|
||||
case 4:
|
||||
*pValType = (((*pDestByte) & 0x08) >> 3);
|
||||
break;
|
||||
case 5:
|
||||
*pValType = (((*pDestByte) & 0x04) >> 2);
|
||||
break;
|
||||
case 6:
|
||||
*pValType = (((*pDestByte) & 0x02) >> 1);
|
||||
break;
|
||||
case 7:
|
||||
*pValType = ((*pDestByte) & 0x01);
|
||||
break;
|
||||
default:
|
||||
TASSERT(0);
|
||||
|
@ -552,7 +708,7 @@ static FORCE_INLINE int32_t tdAppendColValToTpRow(SRowBuilder *pBuilder, TDRowVa
|
|||
--colIdx;
|
||||
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
if (tdSetBitmapValType(pBuilder->pBitmap, colIdx, valType) != TSDB_CODE_SUCCESS) {
|
||||
if (tdSetBitmapValType(pBuilder->pBitmap, colIdx, valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
return terrno;
|
||||
}
|
||||
#endif
|
||||
|
@ -610,7 +766,7 @@ static FORCE_INLINE int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowVa
|
|||
--colIdx;
|
||||
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
if (tdSetBitmapValType(pBuilder->pBitmap, colIdx, valType) != TSDB_CODE_SUCCESS) {
|
||||
if (tdSetBitmapValType(pBuilder->pBitmap, colIdx, valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
return terrno;
|
||||
}
|
||||
#endif
|
||||
|
@ -691,12 +847,6 @@ static FORCE_INLINE int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t
|
|||
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||
TD_ROW_KEY(pRow) = *(TSKEY *)val;
|
||||
// The primary TS key is Norm all the time, thus its valType is not stored in bitmap.
|
||||
// #ifdef TD_SUPPORT_BITMAP
|
||||
// pBitmap = tdGetBitmapAddr(pRow, pRow->type, pBuilder->flen, pRow->ncols);
|
||||
// if (tdSetBitmapValType(pBitmap, colIdx, valType) != TSDB_CODE_SUCCESS) {
|
||||
// return terrno;
|
||||
// }
|
||||
// #endif
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
// TODO: We can avoid the type judegement by FP, but would prevent the inline scheme.
|
||||
|
@ -712,7 +862,7 @@ static FORCE_INLINE int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t
|
|||
static FORCE_INLINE int32_t tdGetTpRowValOfCol(SCellVal *output, STSRow *pRow, void *pBitmap, int8_t colType,
|
||||
int32_t offset, int16_t colIdx) {
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
if (tdGetBitmapValType(pBitmap, colIdx, &output->valType) != TSDB_CODE_SUCCESS) {
|
||||
if (tdGetBitmapValType(pBitmap, colIdx, &output->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
output->valType = TD_VTYPE_NONE;
|
||||
return terrno;
|
||||
}
|
||||
|
@ -748,7 +898,7 @@ static FORCE_INLINE int32_t tdGetKvRowValOfCol(SCellVal *output, STSRow *pRow, v
|
|||
int16_t colIdx) {
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
TASSERT(colIdx < tdRowGetNCols(pRow) - 1);
|
||||
if (tdGetBitmapValType(pBitmap, colIdx, &output->valType) != TSDB_CODE_SUCCESS) {
|
||||
if (tdGetBitmapValType(pBitmap, colIdx, &output->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
output->valType = TD_VTYPE_NONE;
|
||||
return terrno;
|
||||
}
|
||||
|
@ -868,7 +1018,7 @@ static FORCE_INLINE bool tdGetTpRowDataOfCol(STSRowIter *pIter, col_type_t colTy
|
|||
}
|
||||
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
if (tdGetBitmapValType(pIter->pBitmap, pIter->colIdx - 1, &pVal->valType) != TSDB_CODE_SUCCESS) {
|
||||
if (tdGetBitmapValType(pIter->pBitmap, pIter->colIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
}
|
||||
#else
|
||||
|
@ -905,7 +1055,7 @@ static FORCE_INLINE bool tdGetKvRowValOfColEx(STSRowIter *pIter, col_id_t colId,
|
|||
#ifdef TD_SUPPORT_BITMAP
|
||||
int16_t colIdx = -1;
|
||||
if (pKvIdx) colIdx = POINTER_DISTANCE(TD_ROW_COL_IDX(pRow), pKvIdx) / sizeof(SKvRowIdx);
|
||||
if (tdGetBitmapValType(pIter->pBitmap, colIdx, &pVal->valType) != TSDB_CODE_SUCCESS) {
|
||||
if (tdGetBitmapValType(pIter->pBitmap, colIdx, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
}
|
||||
#else
|
||||
|
@ -962,7 +1112,7 @@ static FORCE_INLINE bool tdSTSRowIterNext(STSRowIter *pIter, col_id_t colId, col
|
|||
STSRow *mergeTwoRows(void *buffer, STSRow *row1, STSRow *row2, STSchema *pSchema1, STSchema *pSchema2);
|
||||
|
||||
// Get the data pointer from a column-wised data
|
||||
static FORCE_INLINE int32_t tdGetColDataOfRow(SCellVal *pVal, SDataCol *pCol, int32_t row) {
|
||||
static FORCE_INLINE int32_t tdGetColDataOfRow(SCellVal *pVal, SDataCol *pCol, int32_t row, int8_t bitmapMode) {
|
||||
if (isAllRowsNone(pCol)) {
|
||||
pVal->valType = TD_VTYPE_NULL;
|
||||
#ifdef TD_SUPPORT_READ2
|
||||
|
@ -975,7 +1125,7 @@ static FORCE_INLINE int32_t tdGetColDataOfRow(SCellVal *pVal, SDataCol *pCol, in
|
|||
|
||||
if (TD_COL_ROWS_NORM(pCol)) {
|
||||
pVal->valType = TD_VTYPE_NORM;
|
||||
} else if (tdGetBitmapValType(pCol->pBitmap, row, &(pVal->valType)) < 0) {
|
||||
} else if (tdGetBitmapValType(pCol->pBitmap, row, &(pVal->valType), bitmapMode) < 0) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
@ -1018,14 +1168,14 @@ static FORCE_INLINE bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, uint32_t o
|
|||
return true;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t dataColGetNEleLen(SDataCol *pDataCol, int32_t rows) {
|
||||
static FORCE_INLINE int32_t dataColGetNEleLen(SDataCol *pDataCol, int32_t rows, int8_t bitmapMode) {
|
||||
ASSERT(rows > 0);
|
||||
int32_t result = 0;
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pDataCol->type)) {
|
||||
result += pDataCol->dataOff[rows - 1];
|
||||
SCellVal val = {0};
|
||||
if (tdGetColDataOfRow(&val, pDataCol, rows - 1) < 0) {
|
||||
if (tdGetColDataOfRow(&val, pDataCol, rows - 1, bitmapMode) < 0) {
|
||||
TASSERT(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,164 +59,169 @@
|
|||
#define TK_LOCAL 41
|
||||
#define TK_QNODE 42
|
||||
#define TK_ON 43
|
||||
#define TK_DATABASE 44
|
||||
#define TK_USE 45
|
||||
#define TK_IF 46
|
||||
#define TK_NOT 47
|
||||
#define TK_EXISTS 48
|
||||
#define TK_BLOCKS 49
|
||||
#define TK_CACHE 50
|
||||
#define TK_CACHELAST 51
|
||||
#define TK_COMP 52
|
||||
#define TK_DAYS 53
|
||||
#define TK_NK_VARIABLE 54
|
||||
#define TK_FSYNC 55
|
||||
#define TK_MAXROWS 56
|
||||
#define TK_MINROWS 57
|
||||
#define TK_KEEP 58
|
||||
#define TK_PRECISION 59
|
||||
#define TK_QUORUM 60
|
||||
#define TK_REPLICA 61
|
||||
#define TK_TTL 62
|
||||
#define TK_WAL 63
|
||||
#define TK_VGROUPS 64
|
||||
#define TK_SINGLE_STABLE 65
|
||||
#define TK_STREAM_MODE 66
|
||||
#define TK_RETENTIONS 67
|
||||
#define TK_NK_COMMA 68
|
||||
#define TK_NK_COLON 69
|
||||
#define TK_TABLE 70
|
||||
#define TK_NK_LP 71
|
||||
#define TK_NK_RP 72
|
||||
#define TK_STABLE 73
|
||||
#define TK_ADD 74
|
||||
#define TK_COLUMN 75
|
||||
#define TK_MODIFY 76
|
||||
#define TK_RENAME 77
|
||||
#define TK_TAG 78
|
||||
#define TK_SET 79
|
||||
#define TK_NK_EQ 80
|
||||
#define TK_USING 81
|
||||
#define TK_TAGS 82
|
||||
#define TK_NK_DOT 83
|
||||
#define TK_COMMENT 84
|
||||
#define TK_BOOL 85
|
||||
#define TK_TINYINT 86
|
||||
#define TK_SMALLINT 87
|
||||
#define TK_INT 88
|
||||
#define TK_INTEGER 89
|
||||
#define TK_BIGINT 90
|
||||
#define TK_FLOAT 91
|
||||
#define TK_DOUBLE 92
|
||||
#define TK_BINARY 93
|
||||
#define TK_TIMESTAMP 94
|
||||
#define TK_NCHAR 95
|
||||
#define TK_UNSIGNED 96
|
||||
#define TK_JSON 97
|
||||
#define TK_VARCHAR 98
|
||||
#define TK_MEDIUMBLOB 99
|
||||
#define TK_BLOB 100
|
||||
#define TK_VARBINARY 101
|
||||
#define TK_DECIMAL 102
|
||||
#define TK_SMA 103
|
||||
#define TK_ROLLUP 104
|
||||
#define TK_FILE_FACTOR 105
|
||||
#define TK_NK_FLOAT 106
|
||||
#define TK_DELAY 107
|
||||
#define TK_SHOW 108
|
||||
#define TK_DATABASES 109
|
||||
#define TK_TABLES 110
|
||||
#define TK_STABLES 111
|
||||
#define TK_MNODES 112
|
||||
#define TK_MODULES 113
|
||||
#define TK_QNODES 114
|
||||
#define TK_FUNCTIONS 115
|
||||
#define TK_INDEXES 116
|
||||
#define TK_FROM 117
|
||||
#define TK_ACCOUNTS 118
|
||||
#define TK_APPS 119
|
||||
#define TK_CONNECTIONS 120
|
||||
#define TK_LICENCE 121
|
||||
#define TK_QUERIES 122
|
||||
#define TK_SCORES 123
|
||||
#define TK_TOPICS 124
|
||||
#define TK_VARIABLES 125
|
||||
#define TK_LIKE 126
|
||||
#define TK_INDEX 127
|
||||
#define TK_FULLTEXT 128
|
||||
#define TK_FUNCTION 129
|
||||
#define TK_INTERVAL 130
|
||||
#define TK_TOPIC 131
|
||||
#define TK_AS 132
|
||||
#define TK_DESC 133
|
||||
#define TK_DESCRIBE 134
|
||||
#define TK_RESET 135
|
||||
#define TK_QUERY 136
|
||||
#define TK_EXPLAIN 137
|
||||
#define TK_ANALYZE 138
|
||||
#define TK_VERBOSE 139
|
||||
#define TK_NK_BOOL 140
|
||||
#define TK_RATIO 141
|
||||
#define TK_COMPACT 142
|
||||
#define TK_VNODES 143
|
||||
#define TK_IN 144
|
||||
#define TK_OUTPUTTYPE 145
|
||||
#define TK_AGGREGATE 146
|
||||
#define TK_BUFSIZE 147
|
||||
#define TK_STREAM 148
|
||||
#define TK_INTO 149
|
||||
#define TK_KILL 150
|
||||
#define TK_CONNECTION 151
|
||||
#define TK_MERGE 152
|
||||
#define TK_VGROUP 153
|
||||
#define TK_REDISTRIBUTE 154
|
||||
#define TK_SPLIT 155
|
||||
#define TK_SYNCDB 156
|
||||
#define TK_NULL 157
|
||||
#define TK_FIRST 158
|
||||
#define TK_LAST 159
|
||||
#define TK_NOW 160
|
||||
#define TK_ROWTS 161
|
||||
#define TK_TBNAME 162
|
||||
#define TK_QSTARTTS 163
|
||||
#define TK_QENDTS 164
|
||||
#define TK_WSTARTTS 165
|
||||
#define TK_WENDTS 166
|
||||
#define TK_WDURATION 167
|
||||
#define TK_BETWEEN 168
|
||||
#define TK_IS 169
|
||||
#define TK_NK_LT 170
|
||||
#define TK_NK_GT 171
|
||||
#define TK_NK_LE 172
|
||||
#define TK_NK_GE 173
|
||||
#define TK_NK_NE 174
|
||||
#define TK_MATCH 175
|
||||
#define TK_NMATCH 176
|
||||
#define TK_JOIN 177
|
||||
#define TK_INNER 178
|
||||
#define TK_SELECT 179
|
||||
#define TK_DISTINCT 180
|
||||
#define TK_WHERE 181
|
||||
#define TK_PARTITION 182
|
||||
#define TK_BY 183
|
||||
#define TK_SESSION 184
|
||||
#define TK_STATE_WINDOW 185
|
||||
#define TK_SLIDING 186
|
||||
#define TK_FILL 187
|
||||
#define TK_VALUE 188
|
||||
#define TK_NONE 189
|
||||
#define TK_PREV 190
|
||||
#define TK_LINEAR 191
|
||||
#define TK_NEXT 192
|
||||
#define TK_GROUP 193
|
||||
#define TK_HAVING 194
|
||||
#define TK_ORDER 195
|
||||
#define TK_SLIMIT 196
|
||||
#define TK_SOFFSET 197
|
||||
#define TK_LIMIT 198
|
||||
#define TK_OFFSET 199
|
||||
#define TK_ASC 200
|
||||
#define TK_NULLS 201
|
||||
#define TK_BNODE 44
|
||||
#define TK_SNODE 45
|
||||
#define TK_MNODE 46
|
||||
#define TK_DATABASE 47
|
||||
#define TK_USE 48
|
||||
#define TK_IF 49
|
||||
#define TK_NOT 50
|
||||
#define TK_EXISTS 51
|
||||
#define TK_BLOCKS 52
|
||||
#define TK_CACHE 53
|
||||
#define TK_CACHELAST 54
|
||||
#define TK_COMP 55
|
||||
#define TK_DAYS 56
|
||||
#define TK_NK_VARIABLE 57
|
||||
#define TK_FSYNC 58
|
||||
#define TK_MAXROWS 59
|
||||
#define TK_MINROWS 60
|
||||
#define TK_KEEP 61
|
||||
#define TK_PRECISION 62
|
||||
#define TK_QUORUM 63
|
||||
#define TK_REPLICA 64
|
||||
#define TK_TTL 65
|
||||
#define TK_WAL 66
|
||||
#define TK_VGROUPS 67
|
||||
#define TK_SINGLE_STABLE 68
|
||||
#define TK_STREAM_MODE 69
|
||||
#define TK_RETENTIONS 70
|
||||
#define TK_NK_COMMA 71
|
||||
#define TK_NK_COLON 72
|
||||
#define TK_TABLE 73
|
||||
#define TK_NK_LP 74
|
||||
#define TK_NK_RP 75
|
||||
#define TK_STABLE 76
|
||||
#define TK_ADD 77
|
||||
#define TK_COLUMN 78
|
||||
#define TK_MODIFY 79
|
||||
#define TK_RENAME 80
|
||||
#define TK_TAG 81
|
||||
#define TK_SET 82
|
||||
#define TK_NK_EQ 83
|
||||
#define TK_USING 84
|
||||
#define TK_TAGS 85
|
||||
#define TK_NK_DOT 86
|
||||
#define TK_COMMENT 87
|
||||
#define TK_BOOL 88
|
||||
#define TK_TINYINT 89
|
||||
#define TK_SMALLINT 90
|
||||
#define TK_INT 91
|
||||
#define TK_INTEGER 92
|
||||
#define TK_BIGINT 93
|
||||
#define TK_FLOAT 94
|
||||
#define TK_DOUBLE 95
|
||||
#define TK_BINARY 96
|
||||
#define TK_TIMESTAMP 97
|
||||
#define TK_NCHAR 98
|
||||
#define TK_UNSIGNED 99
|
||||
#define TK_JSON 100
|
||||
#define TK_VARCHAR 101
|
||||
#define TK_MEDIUMBLOB 102
|
||||
#define TK_BLOB 103
|
||||
#define TK_VARBINARY 104
|
||||
#define TK_DECIMAL 105
|
||||
#define TK_SMA 106
|
||||
#define TK_ROLLUP 107
|
||||
#define TK_FILE_FACTOR 108
|
||||
#define TK_NK_FLOAT 109
|
||||
#define TK_DELAY 110
|
||||
#define TK_SHOW 111
|
||||
#define TK_DATABASES 112
|
||||
#define TK_TABLES 113
|
||||
#define TK_STABLES 114
|
||||
#define TK_MNODES 115
|
||||
#define TK_MODULES 116
|
||||
#define TK_QNODES 117
|
||||
#define TK_FUNCTIONS 118
|
||||
#define TK_INDEXES 119
|
||||
#define TK_FROM 120
|
||||
#define TK_ACCOUNTS 121
|
||||
#define TK_APPS 122
|
||||
#define TK_CONNECTIONS 123
|
||||
#define TK_LICENCE 124
|
||||
#define TK_QUERIES 125
|
||||
#define TK_SCORES 126
|
||||
#define TK_TOPICS 127
|
||||
#define TK_VARIABLES 128
|
||||
#define TK_BNODES 129
|
||||
#define TK_SNODES 130
|
||||
#define TK_LIKE 131
|
||||
#define TK_INDEX 132
|
||||
#define TK_FULLTEXT 133
|
||||
#define TK_FUNCTION 134
|
||||
#define TK_INTERVAL 135
|
||||
#define TK_TOPIC 136
|
||||
#define TK_AS 137
|
||||
#define TK_DESC 138
|
||||
#define TK_DESCRIBE 139
|
||||
#define TK_RESET 140
|
||||
#define TK_QUERY 141
|
||||
#define TK_EXPLAIN 142
|
||||
#define TK_ANALYZE 143
|
||||
#define TK_VERBOSE 144
|
||||
#define TK_NK_BOOL 145
|
||||
#define TK_RATIO 146
|
||||
#define TK_COMPACT 147
|
||||
#define TK_VNODES 148
|
||||
#define TK_IN 149
|
||||
#define TK_OUTPUTTYPE 150
|
||||
#define TK_AGGREGATE 151
|
||||
#define TK_BUFSIZE 152
|
||||
#define TK_STREAM 153
|
||||
#define TK_INTO 154
|
||||
#define TK_KILL 155
|
||||
#define TK_CONNECTION 156
|
||||
#define TK_MERGE 157
|
||||
#define TK_VGROUP 158
|
||||
#define TK_REDISTRIBUTE 159
|
||||
#define TK_SPLIT 160
|
||||
#define TK_SYNCDB 161
|
||||
#define TK_NULL 162
|
||||
#define TK_FIRST 163
|
||||
#define TK_LAST 164
|
||||
#define TK_NOW 165
|
||||
#define TK_ROWTS 166
|
||||
#define TK_TBNAME 167
|
||||
#define TK_QSTARTTS 168
|
||||
#define TK_QENDTS 169
|
||||
#define TK_WSTARTTS 170
|
||||
#define TK_WENDTS 171
|
||||
#define TK_WDURATION 172
|
||||
#define TK_BETWEEN 173
|
||||
#define TK_IS 174
|
||||
#define TK_NK_LT 175
|
||||
#define TK_NK_GT 176
|
||||
#define TK_NK_LE 177
|
||||
#define TK_NK_GE 178
|
||||
#define TK_NK_NE 179
|
||||
#define TK_MATCH 180
|
||||
#define TK_NMATCH 181
|
||||
#define TK_JOIN 182
|
||||
#define TK_INNER 183
|
||||
#define TK_SELECT 184
|
||||
#define TK_DISTINCT 185
|
||||
#define TK_WHERE 186
|
||||
#define TK_PARTITION 187
|
||||
#define TK_BY 188
|
||||
#define TK_SESSION 189
|
||||
#define TK_STATE_WINDOW 190
|
||||
#define TK_SLIDING 191
|
||||
#define TK_FILL 192
|
||||
#define TK_VALUE 193
|
||||
#define TK_NONE 194
|
||||
#define TK_PREV 195
|
||||
#define TK_LINEAR 196
|
||||
#define TK_NEXT 197
|
||||
#define TK_GROUP 198
|
||||
#define TK_HAVING 199
|
||||
#define TK_ORDER 200
|
||||
#define TK_SLIMIT 201
|
||||
#define TK_SOFFSET 202
|
||||
#define TK_LIMIT 203
|
||||
#define TK_OFFSET 204
|
||||
#define TK_ASC 205
|
||||
#define TK_NULLS 206
|
||||
|
||||
#define TK_NK_SPACE 300
|
||||
#define TK_NK_COMMENT 301
|
||||
|
|
|
@ -230,15 +230,15 @@ typedef struct SDropIndexStmt {
|
|||
char tableName[TSDB_TABLE_NAME_LEN];
|
||||
} SDropIndexStmt;
|
||||
|
||||
typedef struct SCreateQnodeStmt {
|
||||
typedef struct SCreateComponentNodeStmt {
|
||||
ENodeType type;
|
||||
int32_t dnodeId;
|
||||
} SCreateQnodeStmt;
|
||||
} SCreateComponentNodeStmt;
|
||||
|
||||
typedef struct SDropQnodeStmt {
|
||||
typedef struct SDropComponentNodeStmt {
|
||||
ENodeType type;
|
||||
int32_t dnodeId;
|
||||
} SDropQnodeStmt;
|
||||
} SDropComponentNodeStmt;
|
||||
|
||||
typedef struct SCreateTopicStmt {
|
||||
ENodeType type;
|
||||
|
|
|
@ -105,6 +105,12 @@ typedef enum ENodeType {
|
|||
QUERY_NODE_DROP_INDEX_STMT,
|
||||
QUERY_NODE_CREATE_QNODE_STMT,
|
||||
QUERY_NODE_DROP_QNODE_STMT,
|
||||
QUERY_NODE_CREATE_BNODE_STMT,
|
||||
QUERY_NODE_DROP_BNODE_STMT,
|
||||
QUERY_NODE_CREATE_SNODE_STMT,
|
||||
QUERY_NODE_DROP_SNODE_STMT,
|
||||
QUERY_NODE_CREATE_MNODE_STMT,
|
||||
QUERY_NODE_DROP_MNODE_STMT,
|
||||
QUERY_NODE_CREATE_TOPIC_STMT,
|
||||
QUERY_NODE_DROP_TOPIC_STMT,
|
||||
QUERY_NODE_ALTER_LOCAL_STMT,
|
||||
|
@ -142,6 +148,8 @@ typedef enum ENodeType {
|
|||
QUERY_NODE_SHOW_SCORES_STMT,
|
||||
QUERY_NODE_SHOW_TOPICS_STMT,
|
||||
QUERY_NODE_SHOW_VARIABLE_STMT,
|
||||
QUERY_NODE_SHOW_BNODES_STMT,
|
||||
QUERY_NODE_SHOW_SNODES_STMT,
|
||||
QUERY_NODE_KILL_CONNECTION_STMT,
|
||||
QUERY_NODE_KILL_QUERY_STMT,
|
||||
|
||||
|
|
|
@ -64,31 +64,35 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016)
|
||||
|
||||
//common & util
|
||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
|
||||
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0101)
|
||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0102)
|
||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0103)
|
||||
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104)
|
||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0106)
|
||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0107)
|
||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0108)
|
||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0109)
|
||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x010A)
|
||||
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x010B)
|
||||
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x010C)
|
||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x010D)
|
||||
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x010E)
|
||||
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x010F)
|
||||
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0110)
|
||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0111)
|
||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0112)
|
||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0113)
|
||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0114)
|
||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0115)
|
||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x0120)
|
||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x0121)
|
||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x0122)
|
||||
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0123)
|
||||
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0100)
|
||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0101)
|
||||
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0102)
|
||||
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0103)
|
||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0104)
|
||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0105)
|
||||
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0106)
|
||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0107)
|
||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0108)
|
||||
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x0109)
|
||||
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x010A)
|
||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x010B)
|
||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x010C)
|
||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x010D)
|
||||
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010E)
|
||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010F)
|
||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110)
|
||||
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0111)
|
||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0112)
|
||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0113)
|
||||
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0114)
|
||||
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x0115)
|
||||
|
||||
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0140)
|
||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0141)
|
||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0152)
|
||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0153)
|
||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0154)
|
||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0155)
|
||||
|
||||
//client
|
||||
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
||||
|
@ -191,6 +195,9 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_MND_SNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0355)
|
||||
#define TSDB_CODE_MND_BNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0356)
|
||||
#define TSDB_CODE_MND_BNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0357)
|
||||
#define TSDB_CODE_MND_TOO_FEW_MNODES TAOS_DEF_ERROR_CODE(0, 0x0358)
|
||||
#define TSDB_CODE_MND_MNODE_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0359)
|
||||
#define TSDB_CODE_MND_CANT_DROP_MASTER TAOS_DEF_ERROR_CODE(0, 0x035A)
|
||||
|
||||
// mnode-acct
|
||||
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
|
||||
|
@ -279,22 +286,15 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_MND_INVALID_STREAM_OPTION TAOS_DEF_ERROR_CODE(0, 0x03F2)
|
||||
|
||||
// mnode-sma
|
||||
#define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0400)
|
||||
#define TSDB_CODE_MND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0401)
|
||||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0402)
|
||||
#define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480)
|
||||
#define TSDB_CODE_MND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0481)
|
||||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0482)
|
||||
|
||||
// dnode
|
||||
#define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x04A0)
|
||||
#define TSDB_CODE_DND_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
|
||||
#define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x04A2)
|
||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A3)
|
||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A4)
|
||||
#define TSDB_CODE_NODE_PARSE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x04A5)
|
||||
#define TSDB_CODE_NODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A6)
|
||||
#define TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A7)
|
||||
#define TSDB_CODE_DND_VNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A8)
|
||||
#define TSDB_CODE_DND_VNODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A9)
|
||||
#define TSDB_CODE_DND_VNODE_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x04AA)
|
||||
#define TSDB_CODE_NODE_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0400)
|
||||
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0401)
|
||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0403)
|
||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0404)
|
||||
|
||||
// vnode
|
||||
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
|
||||
|
@ -428,6 +428,108 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_WAL_INVALID_VER TAOS_DEF_ERROR_CODE(0, 0x1003)
|
||||
#define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1004)
|
||||
|
||||
// http
|
||||
#define TSDB_CODE_HTTP_SERVER_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x1100) //"http server is not online"
|
||||
#define TSDB_CODE_HTTP_UNSUPPORT_URL TAOS_DEF_ERROR_CODE(0, 0x1101) //"url is not support"
|
||||
#define TSDB_CODE_HTTP_INVALID_URL TAOS_DEF_ERROR_CODE(0, 0x1102) //invalid url format"
|
||||
#define TSDB_CODE_HTTP_NO_ENOUGH_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1103) //"no enough memory"
|
||||
#define TSDB_CODE_HTTP_REQUSET_TOO_BIG TAOS_DEF_ERROR_CODE(0, 0x1104) //"request size is too big"
|
||||
#define TSDB_CODE_HTTP_NO_AUTH_INFO TAOS_DEF_ERROR_CODE(0, 0x1105) //"no auth info input"
|
||||
#define TSDB_CODE_HTTP_NO_MSG_INPUT TAOS_DEF_ERROR_CODE(0, 0x1106) //"request is empty"
|
||||
#define TSDB_CODE_HTTP_NO_SQL_INPUT TAOS_DEF_ERROR_CODE(0, 0x1107) //"no sql input"
|
||||
#define TSDB_CODE_HTTP_NO_EXEC_USEDB TAOS_DEF_ERROR_CODE(0, 0x1108) //"no need to execute use db cmd"
|
||||
#define TSDB_CODE_HTTP_SESSION_FULL TAOS_DEF_ERROR_CODE(0, 0x1109) //"session list was full"
|
||||
#define TSDB_CODE_HTTP_GEN_TAOSD_TOKEN_ERR TAOS_DEF_ERROR_CODE(0, 0x110A) //"generate taosd token error"
|
||||
#define TSDB_CODE_HTTP_INVALID_MULTI_REQUEST TAOS_DEF_ERROR_CODE(0, 0x110B) //"size of multi request is 0"
|
||||
#define TSDB_CODE_HTTP_CREATE_GZIP_FAILED TAOS_DEF_ERROR_CODE(0, 0x110C) //"failed to create gzip"
|
||||
#define TSDB_CODE_HTTP_FINISH_GZIP_FAILED TAOS_DEF_ERROR_CODE(0, 0x110D) //"failed to finish gzip"
|
||||
#define TSDB_CODE_HTTP_LOGIN_FAILED TAOS_DEF_ERROR_CODE(0, 0x110E) //"failed to login"
|
||||
|
||||
#define TSDB_CODE_HTTP_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x1120) //"invalid http version"
|
||||
#define TSDB_CODE_HTTP_INVALID_CONTENT_LENGTH TAOS_DEF_ERROR_CODE(0, 0x1121) //"invalid content length"
|
||||
#define TSDB_CODE_HTTP_INVALID_AUTH_TYPE TAOS_DEF_ERROR_CODE(0, 0x1122) //"invalid type of Authorization"
|
||||
#define TSDB_CODE_HTTP_INVALID_AUTH_FORMAT TAOS_DEF_ERROR_CODE(0, 0x1123) //"invalid format of Authorization"
|
||||
#define TSDB_CODE_HTTP_INVALID_BASIC_AUTH TAOS_DEF_ERROR_CODE(0, 0x1124) //"invalid basic Authorization"
|
||||
#define TSDB_CODE_HTTP_INVALID_TAOSD_AUTH TAOS_DEF_ERROR_CODE(0, 0x1125) //"invalid taosd Authorization"
|
||||
#define TSDB_CODE_HTTP_PARSE_METHOD_FAILED TAOS_DEF_ERROR_CODE(0, 0x1126) //"failed to parse method"
|
||||
#define TSDB_CODE_HTTP_PARSE_TARGET_FAILED TAOS_DEF_ERROR_CODE(0, 0x1127) //"failed to parse target"
|
||||
#define TSDB_CODE_HTTP_PARSE_VERSION_FAILED TAOS_DEF_ERROR_CODE(0, 0x1128) //"failed to parse http version"
|
||||
#define TSDB_CODE_HTTP_PARSE_SP_FAILED TAOS_DEF_ERROR_CODE(0, 0x1129) //"failed to parse sp"
|
||||
#define TSDB_CODE_HTTP_PARSE_STATUS_FAILED TAOS_DEF_ERROR_CODE(0, 0x112A) //"failed to parse status"
|
||||
#define TSDB_CODE_HTTP_PARSE_PHRASE_FAILED TAOS_DEF_ERROR_CODE(0, 0x112B) //"failed to parse phrase"
|
||||
#define TSDB_CODE_HTTP_PARSE_CRLF_FAILED TAOS_DEF_ERROR_CODE(0, 0x112C) //"failed to parse crlf"
|
||||
#define TSDB_CODE_HTTP_PARSE_HEADER_FAILED TAOS_DEF_ERROR_CODE(0, 0x112D) //"failed to parse header"
|
||||
#define TSDB_CODE_HTTP_PARSE_HEADER_KEY_FAILED TAOS_DEF_ERROR_CODE(0, 0x112E) //"failed to parse header key"
|
||||
#define TSDB_CODE_HTTP_PARSE_HEADER_VAL_FAILED TAOS_DEF_ERROR_CODE(0, 0x112F) //"failed to parse header val"
|
||||
#define TSDB_CODE_HTTP_PARSE_CHUNK_SIZE_FAILED TAOS_DEF_ERROR_CODE(0, 0x1130) //"failed to parse chunk size"
|
||||
#define TSDB_CODE_HTTP_PARSE_CHUNK_FAILED TAOS_DEF_ERROR_CODE(0, 0x1131) //"failed to parse chunk"
|
||||
#define TSDB_CODE_HTTP_PARSE_END_FAILED TAOS_DEF_ERROR_CODE(0, 0x1132) //"failed to parse end section"
|
||||
#define TSDB_CODE_HTTP_PARSE_INVALID_STATE TAOS_DEF_ERROR_CODE(0, 0x1134) //"invalid parse state"
|
||||
#define TSDB_CODE_HTTP_PARSE_ERROR_STATE TAOS_DEF_ERROR_CODE(0, 0x1135) //"failed to parse error section"
|
||||
|
||||
#define TSDB_CODE_HTTP_GC_QUERY_NULL TAOS_DEF_ERROR_CODE(0, 0x1150) //"query size is 0"
|
||||
#define TSDB_CODE_HTTP_GC_QUERY_SIZE TAOS_DEF_ERROR_CODE(0, 0x1151) //"query size can not more than 100"
|
||||
#define TSDB_CODE_HTTP_GC_REQ_PARSE_ERROR TAOS_DEF_ERROR_CODE(0, 0x1152) //"parse grafana json error"
|
||||
|
||||
#define TSDB_CODE_HTTP_TG_DB_NOT_INPUT TAOS_DEF_ERROR_CODE(0, 0x1160) //"database name can not be null"
|
||||
#define TSDB_CODE_HTTP_TG_DB_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x1161) //"database name too long"
|
||||
#define TSDB_CODE_HTTP_TG_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x1162) //"invalid telegraf json fromat"
|
||||
#define TSDB_CODE_HTTP_TG_METRICS_NULL TAOS_DEF_ERROR_CODE(0, 0x1163) //"metrics size is 0"
|
||||
#define TSDB_CODE_HTTP_TG_METRICS_SIZE TAOS_DEF_ERROR_CODE(0, 0x1164) //"metrics size can not more than 1K"
|
||||
#define TSDB_CODE_HTTP_TG_METRIC_NULL TAOS_DEF_ERROR_CODE(0, 0x1165) //"metric name not find"
|
||||
#define TSDB_CODE_HTTP_TG_METRIC_TYPE TAOS_DEF_ERROR_CODE(0, 0x1166) //"metric name type should be string"
|
||||
#define TSDB_CODE_HTTP_TG_METRIC_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x1167) //"metric name length is 0"
|
||||
#define TSDB_CODE_HTTP_TG_METRIC_NAME_LONG TAOS_DEF_ERROR_CODE(0, 0x1168) //"metric name length too long"
|
||||
#define TSDB_CODE_HTTP_TG_TIMESTAMP_NULL TAOS_DEF_ERROR_CODE(0, 0x1169) //"timestamp not find"
|
||||
#define TSDB_CODE_HTTP_TG_TIMESTAMP_TYPE TAOS_DEF_ERROR_CODE(0, 0x116A) //"timestamp type should be integer"
|
||||
#define TSDB_CODE_HTTP_TG_TIMESTAMP_VAL_NULL TAOS_DEF_ERROR_CODE(0, 0x116B) //"timestamp value smaller than 0"
|
||||
#define TSDB_CODE_HTTP_TG_TAGS_NULL TAOS_DEF_ERROR_CODE(0, 0x116C) //"tags not find"
|
||||
#define TSDB_CODE_HTTP_TG_TAGS_SIZE_0 TAOS_DEF_ERROR_CODE(0, 0x116D) //"tags size is 0"
|
||||
#define TSDB_CODE_HTTP_TG_TAGS_SIZE_LONG TAOS_DEF_ERROR_CODE(0, 0x116E) //"tags size too long"
|
||||
#define TSDB_CODE_HTTP_TG_TAG_NULL TAOS_DEF_ERROR_CODE(0, 0x116F) //"tag is null"
|
||||
#define TSDB_CODE_HTTP_TG_TAG_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x1170) //"tag name is null"
|
||||
#define TSDB_CODE_HTTP_TG_TAG_NAME_SIZE TAOS_DEF_ERROR_CODE(0, 0x1171) //"tag name length too long"
|
||||
#define TSDB_CODE_HTTP_TG_TAG_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x1172) //"tag value type should be number or string"
|
||||
#define TSDB_CODE_HTTP_TG_TAG_VALUE_NULL TAOS_DEF_ERROR_CODE(0, 0x1173) //"tag value is null"
|
||||
#define TSDB_CODE_HTTP_TG_TABLE_NULL TAOS_DEF_ERROR_CODE(0, 0x1174) //"table is null"
|
||||
#define TSDB_CODE_HTTP_TG_TABLE_SIZE TAOS_DEF_ERROR_CODE(0, 0x1175) //"table name length too long"
|
||||
#define TSDB_CODE_HTTP_TG_FIELDS_NULL TAOS_DEF_ERROR_CODE(0, 0x1176) //"fields not find"
|
||||
#define TSDB_CODE_HTTP_TG_FIELDS_SIZE_0 TAOS_DEF_ERROR_CODE(0, 0x1177) //"fields size is 0"
|
||||
#define TSDB_CODE_HTTP_TG_FIELDS_SIZE_LONG TAOS_DEF_ERROR_CODE(0, 0x1178) //"fields size too long"
|
||||
#define TSDB_CODE_HTTP_TG_FIELD_NULL TAOS_DEF_ERROR_CODE(0, 0x1179) //"field is null"
|
||||
#define TSDB_CODE_HTTP_TG_FIELD_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x117A) //"field name is null"
|
||||
#define TSDB_CODE_HTTP_TG_FIELD_NAME_SIZE TAOS_DEF_ERROR_CODE(0, 0x117B) //"field name length too long"
|
||||
#define TSDB_CODE_HTTP_TG_FIELD_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x117C) //"field value type should be number or string"
|
||||
#define TSDB_CODE_HTTP_TG_FIELD_VALUE_NULL TAOS_DEF_ERROR_CODE(0, 0x117D) //"field value is null"
|
||||
#define TSDB_CODE_HTTP_TG_HOST_NOT_STRING TAOS_DEF_ERROR_CODE(0, 0x117E) //"host type should be string"
|
||||
#define TSDB_CODE_HTTP_TG_STABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x117F) //"stable not exist"
|
||||
|
||||
#define TSDB_CODE_HTTP_OP_DB_NOT_INPUT TAOS_DEF_ERROR_CODE(0, 0x1190) //"database name can not be null"
|
||||
#define TSDB_CODE_HTTP_OP_DB_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x1191) //"database name too long"
|
||||
#define TSDB_CODE_HTTP_OP_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x1192) //"invalid opentsdb json fromat"
|
||||
#define TSDB_CODE_HTTP_OP_METRICS_NULL TAOS_DEF_ERROR_CODE(0, 0x1193) //"metrics size is 0"
|
||||
#define TSDB_CODE_HTTP_OP_METRICS_SIZE TAOS_DEF_ERROR_CODE(0, 0x1194) //"metrics size can not more than 10K"
|
||||
#define TSDB_CODE_HTTP_OP_METRIC_NULL TAOS_DEF_ERROR_CODE(0, 0x1195) //"metric name not find"
|
||||
#define TSDB_CODE_HTTP_OP_METRIC_TYPE TAOS_DEF_ERROR_CODE(0, 0x1196) //"metric name type should be string"
|
||||
#define TSDB_CODE_HTTP_OP_METRIC_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x1197) //"metric name length is 0"
|
||||
#define TSDB_CODE_HTTP_OP_METRIC_NAME_LONG TAOS_DEF_ERROR_CODE(0, 0x1198) //"metric name length can not more than 22"
|
||||
#define TSDB_CODE_HTTP_OP_TIMESTAMP_NULL TAOS_DEF_ERROR_CODE(0, 0x1199) //"timestamp not find"
|
||||
#define TSDB_CODE_HTTP_OP_TIMESTAMP_TYPE TAOS_DEF_ERROR_CODE(0, 0x119A) //"timestamp type should be integer"
|
||||
#define TSDB_CODE_HTTP_OP_TIMESTAMP_VAL_NULL TAOS_DEF_ERROR_CODE(0, 0x119B) //"timestamp value smaller than 0"
|
||||
#define TSDB_CODE_HTTP_OP_TAGS_NULL TAOS_DEF_ERROR_CODE(0, 0x119C) //"tags not find"
|
||||
#define TSDB_CODE_HTTP_OP_TAGS_SIZE_0 TAOS_DEF_ERROR_CODE(0, 0x119D) //"tags size is 0"
|
||||
#define TSDB_CODE_HTTP_OP_TAGS_SIZE_LONG TAOS_DEF_ERROR_CODE(0, 0x119E) //"tags size too long"
|
||||
#define TSDB_CODE_HTTP_OP_TAG_NULL TAOS_DEF_ERROR_CODE(0, 0x119F) //"tag is null"
|
||||
#define TSDB_CODE_HTTP_OP_TAG_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x11A0) //"tag name is null"
|
||||
#define TSDB_CODE_HTTP_OP_TAG_NAME_SIZE TAOS_DEF_ERROR_CODE(0, 0x11A1) //"tag name length too long"
|
||||
#define TSDB_CODE_HTTP_OP_TAG_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x11A2) //"tag value type should be boolean number or string"
|
||||
#define TSDB_CODE_HTTP_OP_TAG_VALUE_NULL TAOS_DEF_ERROR_CODE(0, 0x11A3) //"tag value is null"
|
||||
#define TSDB_CODE_HTTP_OP_TAG_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x11A4) //"tag value can not more than 64"
|
||||
#define TSDB_CODE_HTTP_OP_VALUE_NULL TAOS_DEF_ERROR_CODE(0, 0x11A5) //"value not find"
|
||||
#define TSDB_CODE_HTTP_OP_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x11A6) //"value type should be boolean number or string"
|
||||
|
||||
#define TSDB_CODE_HTTP_REQUEST_JSON_ERROR TAOS_DEF_ERROR_CODE(0, 0x1F00) //"http request json error"
|
||||
|
||||
// tfs
|
||||
#define TSDB_CODE_FS_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x2200)
|
||||
#define TSDB_CODE_FS_INVLD_CFG TAOS_DEF_ERROR_CODE(0, 0x2201)
|
||||
|
|
|
@ -99,6 +99,8 @@ extern const int32_t TYPE_BYTES[15];
|
|||
#define TSDB_INS_TABLE_MNODES "mnodes"
|
||||
#define TSDB_INS_TABLE_MODULES "modules"
|
||||
#define TSDB_INS_TABLE_QNODES "qnodes"
|
||||
#define TSDB_INS_TABLE_BNODES "bnodes"
|
||||
#define TSDB_INS_TABLE_CLUSTER "cluster"
|
||||
#define TSDB_INS_TABLE_USER_DATABASES "user_databases"
|
||||
#define TSDB_INS_TABLE_USER_FUNCTIONS "user_functions"
|
||||
#define TSDB_INS_TABLE_USER_INDEXES "user_indexes"
|
||||
|
@ -108,6 +110,8 @@ extern const int32_t TYPE_BYTES[15];
|
|||
#define TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED "user_table_distributed"
|
||||
#define TSDB_INS_TABLE_USER_USERS "user_users"
|
||||
#define TSDB_INS_TABLE_VGROUPS "vgroups"
|
||||
#define TSDB_INS_TABLE_BNODES "bnodes"
|
||||
#define TSDB_INS_TABLE_SNODES "snodes"
|
||||
|
||||
#define TSDB_INDEX_TYPE_SMA "SMA"
|
||||
#define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT"
|
||||
|
|
|
@ -2,7 +2,7 @@ aux_source_directory(src CLIENT_SRC)
|
|||
add_library(taos ${CLIENT_SRC})
|
||||
target_include_directories(
|
||||
taos
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/client"
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/client"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
target_link_libraries(
|
||||
|
|
|
@ -19,12 +19,12 @@ TARGET_LINK_LIBRARIES(
|
|||
|
||||
TARGET_INCLUDE_DIRECTORIES(
|
||||
clientTest
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/client/"
|
||||
PRIVATE "${CMAKE_SOURCE_DIR}/source/libs/client/inc"
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/libs/client/"
|
||||
PRIVATE "${TD_SOURCE_DIR}/source/libs/client/inc"
|
||||
)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(
|
||||
tmqTest
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/client/"
|
||||
PRIVATE "${CMAKE_SOURCE_DIR}/source/libs/client/inc"
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/libs/client/"
|
||||
PRIVATE "${TD_SOURCE_DIR}/source/libs/client/inc"
|
||||
)
|
||||
|
|
|
@ -400,7 +400,7 @@ TEST(testCase, show_vgroup_Test) {
|
|||
taos_free_result(pRes);
|
||||
taos_close(pConn);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
TEST(testCase, create_multiple_tables) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
|
@ -653,6 +653,7 @@ TEST(testCase, projection_query_stables) {
|
|||
taos_free_result(pRes);
|
||||
taos_close(pConn);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(testCase, agg_query_tables) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
|
@ -661,7 +662,7 @@ TEST(testCase, agg_query_tables) {
|
|||
TAOS_RES* pRes = taos_query(pConn, "use abc1");
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "select count(*) from tu");
|
||||
pRes = taos_query(pConn, "select length('abc') from tu");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
|
||||
taos_free_result(pRes);
|
||||
|
|
|
@ -2,11 +2,11 @@ aux_source_directory(src COMMON_SRC)
|
|||
add_library(common STATIC ${COMMON_SRC})
|
||||
target_include_directories(
|
||||
common
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/common"
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/common"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
IF(${TD_WINDOWS})
|
||||
PRIVATE "${CMAKE_SOURCE_DIR}/contrib/pthread-win32"
|
||||
PRIVATE "${CMAKE_SOURCE_DIR}/contrib/gnuregex"
|
||||
PRIVATE "${TD_SOURCE_DIR}/contrib/pthread-win32"
|
||||
PRIVATE "${TD_SOURCE_DIR}/contrib/gnuregex"
|
||||
ENDIF ()
|
||||
)
|
||||
target_link_libraries(
|
||||
|
|
|
@ -84,6 +84,14 @@ int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRo
|
|||
}
|
||||
}
|
||||
|
||||
int32_t colDataGetFullLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows) {
|
||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||
return pColumnInfoData->varmeta.length + sizeof(int32_t) * numOfRows;
|
||||
} else {
|
||||
return pColumnInfoData->info.bytes * numOfRows + BitmapLen(numOfRows);
|
||||
}
|
||||
}
|
||||
|
||||
void colDataTrim(SColumnInfoData* pColumnInfoData) {
|
||||
// TODO
|
||||
}
|
||||
|
@ -353,13 +361,7 @@ size_t blockDataGetSize(const SSDataBlock* pBlock) {
|
|||
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||
total += colDataGetLength(pColInfoData, pBlock->info.rows);
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
||||
total += sizeof(int32_t) * pBlock->info.rows;
|
||||
} else {
|
||||
total += BitmapLen(pBlock->info.rows);
|
||||
}
|
||||
total += colDataGetFullLength(pColInfoData, pBlock->info.rows);
|
||||
}
|
||||
|
||||
return total;
|
||||
|
@ -656,10 +658,6 @@ double blockDataGetSerialRowSize(const SSDataBlock* pBlock) {
|
|||
return rowSize;
|
||||
}
|
||||
|
||||
int32_t getAllowedRowsForPage(const SSDataBlock* pBlock, size_t pgSize) {
|
||||
return (int32_t) ((pgSize - blockDataGetSerialMetaSize(pBlock))/ blockDataGetSerialRowSize(pBlock));
|
||||
}
|
||||
|
||||
typedef struct SSDataBlockSortHelper {
|
||||
SArray* orderInfo; // SArray<SBlockOrderInfo>
|
||||
SSDataBlock* pDataBlock;
|
||||
|
@ -1071,15 +1069,9 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
|
|||
|
||||
void blockDataCleanup(SSDataBlock* pDataBlock) {
|
||||
pDataBlock->info.rows = 0;
|
||||
|
||||
if (pDataBlock->info.hasVarCol) {
|
||||
for (int32_t i = 0; i < pDataBlock->info.numOfCols; ++i) {
|
||||
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
||||
|
||||
if (IS_VAR_DATA_TYPE(p->info.type)) {
|
||||
p->varmeta.length = 0;
|
||||
}
|
||||
}
|
||||
colInfoDataCleanup(p, pDataBlock->info.capacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1120,12 +1112,22 @@ int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows)
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows) {
|
||||
if (IS_VAR_DATA_TYPE(pColumn->info.type)) {
|
||||
pColumn->varmeta.length = 0;
|
||||
} else {
|
||||
memset(pColumn->nullbitmap, 0, BitmapLen(numOfRows));
|
||||
}
|
||||
}
|
||||
|
||||
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) {
|
||||
int32_t code = 0;
|
||||
if (numOfRows == 0) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
pDataBlock->info.capacity = numOfRows;
|
||||
|
||||
for (int32_t i = 0; i < pDataBlock->info.numOfCols; ++i) {
|
||||
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
||||
code = colInfoDataEnsureCapacity(p, numOfRows);
|
||||
|
|
|
@ -266,6 +266,8 @@ void dataColInit(SDataCol *pDataCol, STColumn *pCol, int maxPoints) {
|
|||
|
||||
pDataCol->len = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// value from timestamp should be TKEY here instead of TSKEY
|
||||
int dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints) {
|
||||
ASSERT(pCol != NULL && value != NULL);
|
||||
|
@ -297,7 +299,7 @@ int dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPo
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
static FORCE_INLINE const void *tdGetColDataOfRowUnsafe(SDataCol *pCol, int row) {
|
||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||
return POINTER_SHIFT(pCol->pData, pCol->dataOff[row]);
|
||||
|
@ -314,6 +316,7 @@ bool isNEleNull(SDataCol *pCol, int nEle) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index) {
|
||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||
pCol->dataOff[index] = pCol->len;
|
||||
|
@ -326,7 +329,7 @@ static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index) {
|
|||
}
|
||||
}
|
||||
|
||||
static void dataColSetNEleNull(SDataCol *pCol, int nEle) {
|
||||
static void dataColSetNEleNull(SDataCol *pCol, int nEle, int8_t bitmapMode) {
|
||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||
pCol->len = 0;
|
||||
for (int i = 0; i < nEle; ++i) {
|
||||
|
@ -337,7 +340,7 @@ static void dataColSetNEleNull(SDataCol *pCol, int nEle) {
|
|||
pCol->len = TYPE_BYTES[pCol->type] * nEle;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
void *dataColSetOffset(SDataCol *pCol, int nEle) {
|
||||
ASSERT(((pCol->type == TSDB_DATA_TYPE_BINARY) || (pCol->type == TSDB_DATA_TYPE_NCHAR)));
|
||||
|
||||
|
@ -364,6 +367,7 @@ SDataCols *tdNewDataCols(int maxCols, int maxRows) {
|
|||
pCols->maxCols = maxCols;
|
||||
pCols->numOfRows = 0;
|
||||
pCols->numOfCols = 0;
|
||||
// pCols->bitmapMode = 0; // calloc already set 0
|
||||
|
||||
if (maxCols > 0) {
|
||||
pCols->cols = (SDataCol *)taosMemoryCalloc(maxCols, sizeof(SDataCol));
|
||||
|
@ -472,6 +476,7 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) {
|
|||
void tdResetDataCols(SDataCols *pCols) {
|
||||
if (pCols != NULL) {
|
||||
pCols->numOfRows = 0;
|
||||
pCols->bitmapMode = 0;
|
||||
for (int i = 0; i < pCols->maxCols; ++i) {
|
||||
dataColReset(pCols->cols + i);
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ uint32_t tsMaxRange = 500; // max range
|
|||
uint32_t tsCurRange = 100; // range
|
||||
char tsCompressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRESSOR
|
||||
|
||||
static void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary) {
|
||||
void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary) {
|
||||
tstrncpy(tsDiskCfg[index].dir, v1, TSDB_FILENAME_LEN);
|
||||
tsDiskCfg[index].level = level;
|
||||
tsDiskCfg[index].primary = primary;
|
||||
|
|
|
@ -788,6 +788,7 @@ int32_t tSerializeSMDropSmaReq(void *buf, int32_t bufLen, SMDropSmaReq *pReq) {
|
|||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
||||
|
||||
if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
|
@ -808,6 +809,56 @@ int32_t tDeserializeSMDropSmaReq(void *buf, int32_t bufLen, SMDropSmaReq *pReq)
|
|||
tCoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
int32_t tSerializeSMCreateFullTextReq(void *buf, int32_t bufLen, SMCreateFullTextReq *pReq) {
|
||||
SCoder encoder = {0};
|
||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
|
||||
tEndEncode(&encoder);
|
||||
int32_t tlen = encoder.pos;
|
||||
tCoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
int32_t tDeserializeSMCreateFullTextReq(void *buf, int32_t bufLen, SMCreateFullTextReq *pReq) {
|
||||
SCoder decoder = {0};
|
||||
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
|
||||
tEndDecode(&decoder);
|
||||
tCoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
void tFreeSMCreateFullTextReq(SMCreateFullTextReq *pReq) {
|
||||
// impl later
|
||||
return;
|
||||
}
|
||||
int32_t tSerializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
|
||||
SCoder encoder = {0};
|
||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
|
||||
if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
||||
|
||||
if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
|
||||
|
||||
tEndEncode(&encoder);
|
||||
int32_t tlen = encoder.pos;
|
||||
tCoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
int32_t tDeserializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
|
||||
SCoder decoder = {0};
|
||||
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
|
||||
|
||||
tEndDecode(&decoder);
|
||||
tCoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
|
||||
SCoder encoder = {0};
|
||||
|
@ -1203,7 +1254,7 @@ int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
||||
int32_t tSerializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
||||
SCoder encoder = {0};
|
||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||
|
||||
|
@ -1216,7 +1267,7 @@ int32_t tSerializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnod
|
|||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
||||
int32_t tDeserializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
||||
SCoder decoder = {0};
|
||||
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
||||
|
||||
|
@ -1257,14 +1308,6 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMCreateDropMnodeReq(void *buf, int32_t bufLen, SMCreateMnodeReq *pReq) {
|
||||
return tSerializeSMCreateDropQSBNodeReq(buf, bufLen, (SMCreateQnodeReq *)pReq);
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMCreateDropMnodeReq(void *buf, int32_t bufLen, SMCreateMnodeReq *pReq) {
|
||||
return tDeserializeSMCreateDropQSBNodeReq(buf, bufLen, (SMCreateQnodeReq *)pReq);
|
||||
}
|
||||
|
||||
int32_t tSerializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq) {
|
||||
SCoder encoder = {0};
|
||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||
|
|
|
@ -22,11 +22,224 @@ const uint8_t tdVTypeByte[3] = {
|
|||
TD_VTYPE_NULL_BYTE, // TD_VTYPE_NULL
|
||||
};
|
||||
|
||||
// declaration
|
||||
static uint8_t tdGetBitmapByte(uint8_t byte);
|
||||
|
||||
// implementation
|
||||
/**
|
||||
* @brief Compress bitmap bytes comprised of 2-bits to counterpart of 1-bit.
|
||||
* e.g.
|
||||
* TD_VTYPE_NORM 0x00U(00000000) to 00000000 Normal
|
||||
* TD_VTYPE_NULL 0x01U(00000001) to 00000001 Null
|
||||
* TD_VTYPE_NONE 0x02U(00000010) to 00000001 Null
|
||||
*
|
||||
* 00000000 0x00 0x00
|
||||
* 01000000 0x40 0x08
|
||||
* 10000000 0x80 0x08
|
||||
* ...
|
||||
* @param byte
|
||||
* @return uint8_t
|
||||
*/
|
||||
static uint8_t tdGetMergedBitmapByte(uint8_t byte) {
|
||||
switch (byte) {
|
||||
case 0x00:
|
||||
return 0x00;
|
||||
case 0x40:
|
||||
return 0x08;
|
||||
case 0x80:
|
||||
return 0x08;
|
||||
case 0x10:
|
||||
return 0x04;
|
||||
case 0x50:
|
||||
return 0x0c;
|
||||
case 0x90:
|
||||
return 0x0c;
|
||||
case 0x20:
|
||||
return 0x04;
|
||||
case 0x60:
|
||||
return 0x0c;
|
||||
case 0xa0:
|
||||
return 0x0c;
|
||||
case 0x04:
|
||||
return 0x02;
|
||||
case 0x44:
|
||||
return 0x0a;
|
||||
case 0x84:
|
||||
return 0x0a;
|
||||
case 0x14:
|
||||
return 0x06;
|
||||
case 0x54:
|
||||
return 0x0e;
|
||||
case 0x94:
|
||||
return 0x0e;
|
||||
case 0x24:
|
||||
return 0x06;
|
||||
case 0x64:
|
||||
return 0x0e;
|
||||
case 0xa4:
|
||||
return 0x0e;
|
||||
case 0x08:
|
||||
return 0x02;
|
||||
case 0x48:
|
||||
return 0x0a;
|
||||
case 0x88:
|
||||
return 0x0a;
|
||||
case 0x18:
|
||||
return 0x06;
|
||||
case 0x58:
|
||||
return 0x0e;
|
||||
case 0x98:
|
||||
return 0x0e;
|
||||
case 0x28:
|
||||
return 0x06;
|
||||
case 0x68:
|
||||
return 0x0e;
|
||||
case 0xa8:
|
||||
return 0x0e;
|
||||
case 0x01:
|
||||
return 0x01;
|
||||
case 0x41:
|
||||
return 0x09;
|
||||
case 0x81:
|
||||
return 0x09;
|
||||
case 0x11:
|
||||
return 0x05;
|
||||
case 0x51:
|
||||
return 0x0d;
|
||||
case 0x91:
|
||||
return 0x0d;
|
||||
case 0x21:
|
||||
return 0x05;
|
||||
case 0x61:
|
||||
return 0x0d;
|
||||
case 0xa1:
|
||||
return 0x0d;
|
||||
case 0x05:
|
||||
return 0x03;
|
||||
case 0x45:
|
||||
return 0x0b;
|
||||
case 0x85:
|
||||
return 0x0b;
|
||||
case 0x15:
|
||||
return 0x07;
|
||||
case 0x55:
|
||||
return 0x0f;
|
||||
case 0x95:
|
||||
return 0x0f;
|
||||
case 0x25:
|
||||
return 0x07;
|
||||
case 0x65:
|
||||
return 0x0f;
|
||||
case 0xa5:
|
||||
return 0x0f;
|
||||
case 0x09:
|
||||
return 0x03;
|
||||
case 0x49:
|
||||
return 0x0b;
|
||||
case 0x89:
|
||||
return 0x0b;
|
||||
case 0x19:
|
||||
return 0x07;
|
||||
case 0x59:
|
||||
return 0x0f;
|
||||
case 0x99:
|
||||
return 0x0f;
|
||||
case 0x29:
|
||||
return 0x07;
|
||||
case 0x69:
|
||||
return 0x0f;
|
||||
case 0xa9:
|
||||
return 0x0f;
|
||||
case 0x02:
|
||||
return 0x01;
|
||||
case 0x42:
|
||||
return 0x09;
|
||||
case 0x82:
|
||||
return 0x09;
|
||||
case 0x12:
|
||||
return 0x05;
|
||||
case 0x52:
|
||||
return 0x0d;
|
||||
case 0x92:
|
||||
return 0x0d;
|
||||
case 0x22:
|
||||
return 0x05;
|
||||
case 0x62:
|
||||
return 0x0d;
|
||||
case 0xa2:
|
||||
return 0x0d;
|
||||
case 0x06:
|
||||
return 0x03;
|
||||
case 0x46:
|
||||
return 0x0b;
|
||||
case 0x86:
|
||||
return 0x0b;
|
||||
case 0x16:
|
||||
return 0x07;
|
||||
case 0x56:
|
||||
return 0x0f;
|
||||
case 0x96:
|
||||
return 0x0f;
|
||||
case 0x26:
|
||||
return 0x07;
|
||||
case 0x66:
|
||||
return 0x0f;
|
||||
case 0xa6:
|
||||
return 0x0f;
|
||||
case 0x0a:
|
||||
return 0x03;
|
||||
case 0x4a:
|
||||
return 0x0b;
|
||||
case 0x8a:
|
||||
return 0x0b;
|
||||
case 0x1a:
|
||||
return 0x07;
|
||||
case 0x5a:
|
||||
return 0x0f;
|
||||
case 0x9a:
|
||||
return 0x0f;
|
||||
case 0x2a:
|
||||
return 0x07;
|
||||
case 0x6a:
|
||||
return 0x0f;
|
||||
case 0xaa:
|
||||
return 0x0f;
|
||||
default:
|
||||
// make sure the bitmap area is set to 0 firstly
|
||||
ASSERT(0);
|
||||
return 0x0f; // return NULL bitmap for exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Merge bitmap from 2 bits to 1 bits, and the memory buffer should be guaranteed by the invoker.
|
||||
*
|
||||
* @param srcBitmap
|
||||
* @param srcLen
|
||||
* @param dstBitmap
|
||||
*/
|
||||
void tdMergeBitmap(uint8_t *srcBitmap, int32_t srcLen, uint8_t *dstBitmap) {
|
||||
int32_t i = 0, j = 0;
|
||||
|
||||
if (srcLen > 0) {
|
||||
dstBitmap[j] = (tdGetMergedBitmapByte(srcBitmap[i]) << 4);
|
||||
}
|
||||
|
||||
while ((++i) < srcLen) {
|
||||
if ((i & 1) == 0) {
|
||||
dstBitmap[j] = (tdGetMergedBitmapByte(srcBitmap[i]) << 4);
|
||||
} else {
|
||||
dstBitmap[j] |= tdGetMergedBitmapByte(srcBitmap[i]);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static void dataColSetNEleNull(SDataCol *pCol, int nEle);
|
||||
static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, int limit1, SDataCols *src2, int *iter2,
|
||||
int limit2, int tRows, bool forceSetNull);
|
||||
|
||||
static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index, bool setBitmap) {
|
||||
static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index, bool setBitmap, int8_t bitmapMode) {
|
||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||
pCol->dataOff[index] = pCol->len;
|
||||
char *ptr = POINTER_SHIFT(pCol->pData, pCol->len);
|
||||
|
@ -37,7 +250,7 @@ static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index, bool setBit
|
|||
pCol->len += TYPE_BYTES[pCol->type];
|
||||
}
|
||||
if (setBitmap) {
|
||||
tdSetBitmapValType(pCol->pBitmap, index, TD_VTYPE_NONE);
|
||||
tdSetBitmapValType(pCol->pBitmap, index, TD_VTYPE_NONE, bitmapMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +266,7 @@ static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index, bool setBit
|
|||
// }
|
||||
// }
|
||||
|
||||
int32_t tdSetBitmapValTypeN(void *pBitmap, int16_t nEle, TDRowValT valType) {
|
||||
int32_t tdSetBitmapValTypeN(void *pBitmap, int16_t nEle, TDRowValT valType, int8_t bitmapMode) {
|
||||
TASSERT(valType < TD_VTYPE_MAX);
|
||||
int16_t nBytes = nEle / TD_VTYPE_PARTS;
|
||||
for (int i = 0; i < nBytes; ++i) {
|
||||
|
@ -63,12 +276,12 @@ int32_t tdSetBitmapValTypeN(void *pBitmap, int16_t nEle, TDRowValT valType) {
|
|||
int16_t nLeft = nEle - nBytes * TD_VTYPE_BITS;
|
||||
|
||||
for (int j = 0; j < nLeft; ++j) {
|
||||
tdSetBitmapValType(pBitmap, j, valType);
|
||||
tdSetBitmapValType(pBitmap, j, valType, bitmapMode);
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void dataColSetNoneAt(SDataCol *pCol, int index, bool setBitmap) {
|
||||
static FORCE_INLINE void dataColSetNoneAt(SDataCol *pCol, int index, bool setBitmap, int8_t bitmapMode) {
|
||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||
pCol->dataOff[index] = pCol->len;
|
||||
char *ptr = POINTER_SHIFT(pCol->pData, pCol->len);
|
||||
|
@ -79,22 +292,22 @@ static FORCE_INLINE void dataColSetNoneAt(SDataCol *pCol, int index, bool setBit
|
|||
pCol->len += TYPE_BYTES[pCol->type];
|
||||
}
|
||||
if (setBitmap) {
|
||||
tdSetBitmapValType(pCol->pBitmap, index, TD_VTYPE_NONE);
|
||||
tdSetBitmapValType(pCol->pBitmap, index, TD_VTYPE_NONE, bitmapMode);
|
||||
}
|
||||
}
|
||||
|
||||
static void dataColSetNEleNone(SDataCol *pCol, int nEle) {
|
||||
static void dataColSetNEleNone(SDataCol *pCol, int nEle, int8_t bitmapMode) {
|
||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||
pCol->len = 0;
|
||||
for (int i = 0; i < nEle; ++i) {
|
||||
dataColSetNoneAt(pCol, i, false);
|
||||
dataColSetNoneAt(pCol, i, false, bitmapMode);
|
||||
}
|
||||
} else {
|
||||
setNullN(pCol->pData, pCol->type, pCol->bytes, nEle);
|
||||
pCol->len = TYPE_BYTES[pCol->type] * nEle;
|
||||
}
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
tdSetBitmapValTypeN(pCol->pBitmap, nEle, TD_VTYPE_NONE);
|
||||
tdSetBitmapValTypeN(pCol->pBitmap, nEle, TD_VTYPE_NONE, bitmapMode);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -126,7 +339,18 @@ STSRow *tdRowDup(STSRow *row) {
|
|||
return trow;
|
||||
}
|
||||
|
||||
int tdAppendValToDataCol(SDataCol *pCol, TDRowValT valType, const void *val, int numOfRows, int maxPoints) {
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param pCol
|
||||
* @param valType
|
||||
* @param val
|
||||
* @param numOfRows
|
||||
* @param maxPoints
|
||||
* @param bitmapMode default is 0(2 bits), otherwise 1(1 bit)
|
||||
* @return int
|
||||
*/
|
||||
int tdAppendValToDataCol(SDataCol *pCol, TDRowValT valType, const void *val, int numOfRows, int maxPoints, int8_t bitmapMode) {
|
||||
TASSERT(pCol != NULL);
|
||||
|
||||
// Assume that the columns not specified during insert/upsert mean None.
|
||||
|
@ -139,7 +363,7 @@ int tdAppendValToDataCol(SDataCol *pCol, TDRowValT valType, const void *val, int
|
|||
if (tdAllocMemForCol(pCol, maxPoints) < 0) return -1;
|
||||
if (numOfRows > 0) {
|
||||
// Find the first not None value, fill all previous values as None
|
||||
dataColSetNEleNone(pCol, numOfRows);
|
||||
dataColSetNEleNone(pCol, numOfRows, bitmapMode);
|
||||
}
|
||||
}
|
||||
if (!tdValTypeIsNorm(valType)) {
|
||||
|
@ -161,7 +385,8 @@ int tdAppendValToDataCol(SDataCol *pCol, TDRowValT valType, const void *val, int
|
|||
pCol->len += pCol->bytes;
|
||||
}
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
tdSetBitmapValType(pCol->pBitmap, numOfRows, valType);
|
||||
|
||||
tdSetBitmapValType(pCol->pBitmap, numOfRows, valType, bitmapMode);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -175,14 +400,13 @@ static int32_t tdAppendTpRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
|
|||
void *pBitmap = tdGetBitmapAddrTp(pRow, pSchema->flen);
|
||||
|
||||
SDataCol *pDataCol = &(pCols->cols[0]);
|
||||
if (pDataCol->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NORM, &pRow->ts, pCols->numOfRows, pCols->maxPoints);
|
||||
}
|
||||
ASSERT(pDataCol->colId == PRIMARYKEY_TIMESTAMP_COL_ID);
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NORM, &pRow->ts, pCols->numOfRows, pCols->maxPoints, pCols->bitmapMode);
|
||||
|
||||
while (dcol < pCols->numOfCols) {
|
||||
pDataCol = &(pCols->cols[dcol]);
|
||||
if (rcol >= schemaNCols(pSchema)) {
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NULL, NULL, pCols->numOfRows, pCols->maxPoints);
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NULL, NULL, pCols->numOfRows, pCols->maxPoints, pCols->bitmapMode);
|
||||
++dcol;
|
||||
continue;
|
||||
}
|
||||
|
@ -193,13 +417,13 @@ static int32_t tdAppendTpRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
|
|||
if (tdGetTpRowValOfCol(&sVal, pRow, pBitmap, pRowCol->type, pRowCol->offset - sizeof(TSKEY), rcol - 1) < 0) {
|
||||
return terrno;
|
||||
}
|
||||
tdAppendValToDataCol(pDataCol, sVal.valType, sVal.val, pCols->numOfRows, pCols->maxPoints);
|
||||
tdAppendValToDataCol(pDataCol, sVal.valType, sVal.val, pCols->numOfRows, pCols->maxPoints, pCols->bitmapMode);
|
||||
++dcol;
|
||||
++rcol;
|
||||
} else if (pRowCol->colId < pDataCol->colId) {
|
||||
++rcol;
|
||||
} else {
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NULL, NULL, pCols->numOfRows, pCols->maxPoints);
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NULL, NULL, pCols->numOfRows, pCols->maxPoints, pCols->bitmapMode);
|
||||
++dcol;
|
||||
}
|
||||
}
|
||||
|
@ -218,14 +442,13 @@ static int32_t tdAppendKvRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
|
|||
void *pBitmap = tdGetBitmapAddrKv(pRow, tdRowGetNCols(pRow));
|
||||
|
||||
SDataCol *pDataCol = &(pCols->cols[0]);
|
||||
if (pDataCol->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NORM, &pRow->ts, pCols->numOfRows, pCols->maxPoints);
|
||||
}
|
||||
ASSERT(pDataCol->colId == PRIMARYKEY_TIMESTAMP_COL_ID);
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NORM, &pRow->ts, pCols->numOfRows, pCols->maxPoints, pCols->bitmapMode);
|
||||
|
||||
while (dcol < pCols->numOfCols) {
|
||||
pDataCol = &(pCols->cols[dcol]);
|
||||
if (rcol >= tRowCols || rcol >= tSchemaCols) {
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NULL, NULL, pCols->numOfRows, pCols->maxPoints);
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NULL, NULL, pCols->numOfRows, pCols->maxPoints, pCols->bitmapMode);
|
||||
++dcol;
|
||||
continue;
|
||||
}
|
||||
|
@ -240,13 +463,13 @@ static int32_t tdAppendKvRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
|
|||
if (tdGetKvRowValOfCol(&sVal, pRow, pBitmap, pIdx->offset, colIdx) < 0) {
|
||||
return terrno;
|
||||
}
|
||||
tdAppendValToDataCol(pDataCol, sVal.valType, sVal.val, pCols->numOfRows, pCols->maxPoints);
|
||||
tdAppendValToDataCol(pDataCol, sVal.valType, sVal.val, pCols->numOfRows, pCols->maxPoints, pCols->bitmapMode);
|
||||
++dcol;
|
||||
++rcol;
|
||||
} else if (pIdx->colId < pDataCol->colId) {
|
||||
++rcol;
|
||||
} else {
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NULL, NULL, pCols->numOfRows, pCols->maxPoints);
|
||||
tdAppendValToDataCol(pDataCol, TD_VTYPE_NULL, NULL, pCols->numOfRows, pCols->maxPoints, pCols->bitmapMode);
|
||||
++dcol;
|
||||
}
|
||||
}
|
||||
|
@ -291,10 +514,10 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge, int *
|
|||
for (int j = 0; j < source->numOfCols; j++) {
|
||||
if (source->cols[j].len > 0 || target->cols[j].len > 0) {
|
||||
SCellVal sVal = {0};
|
||||
if (tdGetColDataOfRow(&sVal, source->cols + j, i + (*pOffset)) < 0) {
|
||||
if (tdGetColDataOfRow(&sVal, source->cols + j, i + (*pOffset), source->bitmapMode) < 0) {
|
||||
TASSERT(0);
|
||||
}
|
||||
tdAppendValToDataCol(target->cols + j, sVal.valType, sVal.val, target->numOfRows, target->maxPoints);
|
||||
tdAppendValToDataCol(target->cols + j, sVal.valType, sVal.val, target->numOfRows, target->maxPoints, target->bitmapMode);
|
||||
}
|
||||
}
|
||||
++target->numOfRows;
|
||||
|
@ -338,10 +561,10 @@ static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, i
|
|||
ASSERT(target->cols[i].type == src1->cols[i].type);
|
||||
if (src1->cols[i].len > 0 || target->cols[i].len > 0) {
|
||||
SCellVal sVal = {0};
|
||||
if (tdGetColDataOfRow(&sVal, src1->cols + i, *iter1) < 0) {
|
||||
if (tdGetColDataOfRow(&sVal, src1->cols + i, *iter1, src1->bitmapMode) < 0) {
|
||||
TASSERT(0);
|
||||
}
|
||||
tdAppendValToDataCol(&(target->cols[i]), sVal.valType, sVal.val, target->numOfRows, target->maxPoints);
|
||||
tdAppendValToDataCol(&(target->cols[i]), sVal.valType, sVal.val, target->numOfRows, target->maxPoints, target->bitmapMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,18 +576,18 @@ static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, i
|
|||
for (int i = 0; i < src2->numOfCols; i++) {
|
||||
SCellVal sVal = {0};
|
||||
ASSERT(target->cols[i].type == src2->cols[i].type);
|
||||
if (tdGetColDataOfRow(&sVal, src2->cols + i, *iter2) < 0) {
|
||||
if (tdGetColDataOfRow(&sVal, src2->cols + i, *iter2, src2->bitmapMode) < 0) {
|
||||
TASSERT(0);
|
||||
}
|
||||
if (src2->cols[i].len > 0 && !tdValTypeIsNull(sVal.valType)) {
|
||||
tdAppendValToDataCol(&(target->cols[i]), sVal.valType, sVal.val, target->numOfRows, target->maxPoints);
|
||||
tdAppendValToDataCol(&(target->cols[i]), sVal.valType, sVal.val, target->numOfRows, target->maxPoints, target->bitmapMode);
|
||||
} else if (!forceSetNull && key1 == key2 && src1->cols[i].len > 0) {
|
||||
if (tdGetColDataOfRow(&sVal, src1->cols + i, *iter1) < 0) {
|
||||
if (tdGetColDataOfRow(&sVal, src1->cols + i, *iter1, src1->bitmapMode) < 0) {
|
||||
TASSERT(0);
|
||||
}
|
||||
tdAppendValToDataCol(&(target->cols[i]), sVal.valType, sVal.val, target->numOfRows, target->maxPoints);
|
||||
tdAppendValToDataCol(&(target->cols[i]), sVal.valType, sVal.val, target->numOfRows, target->maxPoints, target->bitmapMode);
|
||||
} else if (target->cols[i].len > 0) {
|
||||
dataColSetNullAt(&target->cols[i], target->numOfRows, true);
|
||||
dataColSetNullAt(&target->cols[i], target->numOfRows, true, target->bitmapMode);
|
||||
}
|
||||
}
|
||||
target->numOfRows++;
|
||||
|
@ -480,6 +703,7 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) {
|
|||
if (pRet == NULL) return NULL;
|
||||
|
||||
pRet->numOfCols = pDataCols->numOfCols;
|
||||
pRet->bitmapMode = pDataCols->bitmapMode;
|
||||
pRet->sversion = pDataCols->sversion;
|
||||
if (keepData) pRet->numOfRows = pDataCols->numOfRows;
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ TARGET_LINK_LIBRARIES(
|
|||
|
||||
TARGET_INCLUDE_DIRECTORIES(
|
||||
commonTest
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/common/"
|
||||
PRIVATE "${CMAKE_SOURCE_DIR}/source/libs/common/inc"
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/libs/common/"
|
||||
PRIVATE "${TD_SOURCE_DIR}/source/libs/common/inc"
|
||||
)
|
||||
|
||||
# tmsg test
|
||||
|
@ -24,5 +24,5 @@ TARGET_INCLUDE_DIRECTORIES(
|
|||
# "tmsgTest.cpp"
|
||||
# "../src/tmsg.c"
|
||||
# )
|
||||
# target_include_directories(tmsgTest PUBLIC "${CMAKE_SOURCE_DIR}/include/common/")
|
||||
# target_include_directories(tmsgTest PUBLIC "${TD_SOURCE_DIR}/include/common/")
|
||||
# target_link_libraries(tmsgTest PUBLIC os util gtest gtest_main)
|
|
@ -2,7 +2,7 @@ aux_source_directory(src BNODE_SRC)
|
|||
add_library(bnode STATIC ${BNODE_SRC})
|
||||
target_include_directories(
|
||||
bnode
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/bnode"
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/dnode/bnode"
|
||||
private "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
target_link_libraries(
|
||||
|
|
|
@ -11,7 +11,7 @@ target_link_libraries(
|
|||
)
|
||||
target_include_directories(
|
||||
dnode
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/mgmt"
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/dnode/mgmt"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#include "bmInt.h"
|
||||
|
||||
void bmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonBmInfo *bmInfo) {
|
||||
}
|
||||
void bmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonBmInfo *bmInfo) {}
|
||||
|
||||
int32_t bmProcessGetMonBmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
||||
SMonBmInfo bmInfo = {0};
|
||||
|
@ -49,13 +48,13 @@ int32_t bmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||
|
||||
SDCreateBnodeReq createReq = {0};
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to create bnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
||||
return -1;
|
||||
} else {
|
||||
|
@ -68,13 +67,13 @@ int32_t bmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||
|
||||
SDDropBnodeReq dropReq = {0};
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to drop bnode since %s", terrstr());
|
||||
return -1;
|
||||
} else {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#include "bmInt.h"
|
||||
|
||||
static void bmSendErrorRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
||||
static void bmSendErrorRsp(SNodeMsg *pMsg, int32_t code) {
|
||||
SRpcMsg rpcRsp = {.handle = pMsg->rpcMsg.handle, .ahandle = pMsg->rpcMsg.ahandle, .code = code};
|
||||
tmsgSendRsp(&rpcRsp);
|
||||
|
||||
|
@ -25,15 +25,17 @@ static void bmSendErrorRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code)
|
|||
taosFreeQitem(pMsg);
|
||||
}
|
||||
|
||||
static void bmSendErrorRsps(SMgmtWrapper *pWrapper, STaosQall *qall, int32_t numOfMsgs, int32_t code) {
|
||||
static void bmSendErrorRsps(STaosQall *qall, int32_t numOfMsgs, int32_t code) {
|
||||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
||||
SNodeMsg *pMsg = NULL;
|
||||
taosGetQitem(qall, (void **)&pMsg);
|
||||
bmSendErrorRsp(pWrapper, pMsg, code);
|
||||
if (pMsg != NULL) {
|
||||
bmSendErrorRsp(pMsg, code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
||||
static inline void bmSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||
.ahandle = pMsg->rpcMsg.ahandle,
|
||||
.code = code,
|
||||
|
@ -42,20 +44,22 @@ static inline void bmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
|||
tmsgSendRsp(&rsp);
|
||||
}
|
||||
|
||||
static void bmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
static void bmProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
|
||||
dTrace("msg:%p, get from bnode monitor queue", pMsg);
|
||||
dTrace("msg:%p, get from bnode-monitor queue", pMsg);
|
||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||
int32_t code = -1;
|
||||
|
||||
if (pMsg->rpcMsg.msgType == TDMT_MON_BM_INFO) {
|
||||
code = bmProcessGetMonBmInfoReq(pMgmt->pWrapper, pMsg);
|
||||
} else {
|
||||
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||
}
|
||||
|
||||
if (pRpc->msgType & 1U) {
|
||||
if (code != 0 && terrno != 0) code = terrno;
|
||||
bmSendRsp(pMgmt->pWrapper, pMsg, code);
|
||||
bmSendRsp(pMsg, code);
|
||||
}
|
||||
|
||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||
|
@ -65,20 +69,21 @@ static void bmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
|||
|
||||
static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
||||
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
SMgmtWrapper *pWrapper = pMgmt->pWrapper;
|
||||
|
||||
SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SNodeMsg *));
|
||||
if (pArray == NULL) {
|
||||
bmSendErrorRsps(pWrapper, qall, numOfMsgs, TSDB_CODE_OUT_OF_MEMORY);
|
||||
bmSendErrorRsps(qall, numOfMsgs, TSDB_CODE_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
||||
SNodeMsg *pMsg = NULL;
|
||||
taosGetQitem(qall, (void **)&pMsg);
|
||||
dTrace("msg:%p, will be processed in bnode queue", pMsg);
|
||||
if (pMsg != NULL) {
|
||||
dTrace("msg:%p, get from bnode-write queue", pMsg);
|
||||
if (taosArrayPush(pArray, &pMsg) == NULL) {
|
||||
bmSendErrorRsp(pWrapper, pMsg, TSDB_CODE_OUT_OF_MEMORY);
|
||||
bmSendErrorRsp(pMsg, TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,10 +91,12 @@ static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
|
|||
|
||||
for (size_t i = 0; i < numOfMsgs; i++) {
|
||||
SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i);
|
||||
if (pMsg != NULL) {
|
||||
dTrace("msg:%p, is freed", pMsg);
|
||||
rpcFreeCont(pMsg->rpcMsg.pCont);
|
||||
taosFreeQitem(pMsg);
|
||||
}
|
||||
}
|
||||
taosArrayDestroy(pArray);
|
||||
}
|
||||
|
||||
|
@ -120,7 +127,7 @@ int32_t bmStartWorker(SBnodeMgmt *pMgmt) {
|
|||
|
||||
if (tsMultiProcess) {
|
||||
SSingleWorkerCfg mCfg = {
|
||||
.min = 1, .max = 1, .name = "bnode-monitor", .fp = (FItem)bmProcessMonQueue, .param = pMgmt};
|
||||
.min = 1, .max = 1, .name = "bnode-monitor", .fp = (FItem)bmProcessMonitorQueue, .param = pMgmt};
|
||||
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
||||
dError("failed to start bnode-monitor worker since %s", terrstr());
|
||||
return -1;
|
||||
|
|
|
@ -21,7 +21,7 @@ static bool dmIsEpChanged(SDnodeMgmt *pMgmt, int32_t dnodeId, const char *ep);
|
|||
static void dmResetDnodes(SDnodeMgmt *pMgmt, SArray *dnodeEps);
|
||||
|
||||
int32_t dmReadFile(SDnodeMgmt *pMgmt) {
|
||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
||||
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 256 * 1024;
|
||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||
|
|
|
@ -62,6 +62,7 @@ int32_t mmProcessSyncMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
|
|||
int32_t mmProcessReadMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
|
||||
int32_t mmProcessQueryMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
|
||||
int32_t mmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
|
||||
|
||||
int32_t mmPutMsgToQueryQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc);
|
||||
int32_t mmPutMsgToReadQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc);
|
||||
int32_t mmPutMsgToWriteQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc);
|
||||
|
|
|
@ -90,7 +90,7 @@ static int32_t dndNewProc(SMgmtWrapper *pWrapper, EDndType n) {
|
|||
|
||||
static void dndProcessProcHandle(void *handle) {
|
||||
dWarn("handle:%p, the child process dies and send an offline rsp", handle);
|
||||
SRpcMsg rpcMsg = {.handle = handle, .code = TSDB_CODE_DND_OFFLINE};
|
||||
SRpcMsg rpcMsg = {.handle = handle, .code = TSDB_CODE_NODE_OFFLINE};
|
||||
rpcSendResponse(&rpcMsg);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define MAXLEN 1024
|
||||
|
||||
int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed) {
|
||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
||||
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||
int64_t len = 0;
|
||||
char content[MAXLEN + 1] = {0};
|
||||
cJSON *root = NULL;
|
||||
|
@ -159,7 +159,7 @@ int32_t dndReadShmFile(SDnode *pDnode) {
|
|||
if (taosReadFile(pFile, content, MAXLEN) > 0) {
|
||||
root = cJSON_Parse(content);
|
||||
if (root == NULL) {
|
||||
terrno = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
||||
terrno = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||
dError("failed to read %s since invalid json format", file);
|
||||
goto _OVER;
|
||||
}
|
||||
|
|
|
@ -53,8 +53,9 @@ static void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, SEpSet *pEpS
|
|||
int32_t code = -1;
|
||||
SNodeMsg *pMsg = NULL;
|
||||
NodeMsgFp msgFp = NULL;
|
||||
uint16_t msgType = pRpc->msgType;
|
||||
|
||||
if (pEpSet && pEpSet->numOfEps > 0 && pRpc->msgType == TDMT_MND_STATUS_RSP) {
|
||||
if (pEpSet && pEpSet->numOfEps > 0 && msgType == TDMT_MND_STATUS_RSP) {
|
||||
dndUpdateMnodeEpSet(pWrapper->pDnode, pEpSet);
|
||||
}
|
||||
|
||||
|
@ -84,8 +85,15 @@ _OVER:
|
|||
}
|
||||
} else {
|
||||
dError("msg:%p, failed to process since 0x%04x:%s", pMsg, code & 0XFFFF, terrstr());
|
||||
if (pRpc->msgType & 1U) {
|
||||
SRpcMsg rsp = {.handle = pRpc->handle, .ahandle = pRpc->ahandle, .code = terrno};
|
||||
if (msgType & 1U) {
|
||||
if (terrno != 0) code = terrno;
|
||||
if (code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_NODE_OFFLINE) {
|
||||
if (msgType > TDMT_MND_MSG && msgType < TDMT_VND_MSG) {
|
||||
code = TSDB_CODE_NODE_REDIRECT;
|
||||
}
|
||||
}
|
||||
|
||||
SRpcMsg rsp = {.handle = pRpc->handle, .ahandle = pRpc->ahandle, .code = code};
|
||||
tmsgSendRsp(&rsp);
|
||||
}
|
||||
dTrace("msg:%p, is freed", pMsg);
|
||||
|
@ -121,7 +129,7 @@ static void dndProcessMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
|||
|
||||
if (isReq && pMsg->pCont == NULL) {
|
||||
dError("req:%s not processed since its empty, handle:%p app:%p", TMSG_INFO(msgType), pMsg->handle, pMsg->ahandle);
|
||||
SRpcMsg rspMsg = {.handle = pMsg->handle, .code = TSDB_CODE_DND_INVALID_MSG_LEN, .ahandle = pMsg->ahandle};
|
||||
SRpcMsg rspMsg = {.handle = pMsg->handle, .code = TSDB_CODE_INVALID_MSG_LEN, .ahandle = pMsg->ahandle};
|
||||
rpcSendResponse(&rspMsg);
|
||||
return;
|
||||
}
|
||||
|
@ -338,7 +346,7 @@ int32_t dndInitMsgHandle(SDnode *pDnode) {
|
|||
|
||||
static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
||||
if (pMgmt->clientRpc == NULL) {
|
||||
terrno = TSDB_CODE_DND_OFFLINE;
|
||||
terrno = TSDB_CODE_NODE_OFFLINE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -347,19 +355,16 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *p
|
|||
}
|
||||
|
||||
static void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
|
||||
if (pRsp->code == TSDB_CODE_APP_NOT_READY) {
|
||||
if (pWrapper->ntype == MNODE) {
|
||||
if (pRsp->code == TSDB_CODE_NODE_REDIRECT) {
|
||||
dmSendRedirectRsp(pWrapper->pMgmt, pRsp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
rpcSendResponse(pRsp);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
||||
if (dndGetStatus(pWrapper->pDnode) != DND_STAT_RUNNING) {
|
||||
terrno = TSDB_CODE_DND_OFFLINE;
|
||||
terrno = TSDB_CODE_NODE_OFFLINE;
|
||||
dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle);
|
||||
return -1;
|
||||
}
|
||||
|
@ -443,7 +448,8 @@ static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t
|
|||
static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen,
|
||||
ProcFuncType ftype) {
|
||||
pMsg->pCont = pCont;
|
||||
dTrace("msg:%p, get from parent queue, ftype:%d handle:%p, app:%p", pMsg, ftype, pMsg->handle, pMsg->ahandle);
|
||||
dTrace("msg:%p, get from parent queue, ftype:%d handle:%p code:0x%04x mtype:%d, app:%p", pMsg, ftype, pMsg->handle,
|
||||
pMsg->code & 0xFFFF, pMsg->msgType, pMsg->ahandle);
|
||||
|
||||
switch (ftype) {
|
||||
case PROC_REGIST:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "mmInt.h"
|
||||
|
||||
int32_t mmReadFile(SMnodeMgmt *pMgmt, bool *pDeployed) {
|
||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
||||
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 4096;
|
||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||
|
|
|
@ -57,7 +57,7 @@ int32_t mmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
}
|
||||
|
||||
if (createReq.replica <= 1 || createReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to create mnode since %s", terrstr());
|
||||
return -1;
|
||||
} else {
|
||||
|
@ -70,13 +70,13 @@ int32_t mmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||
|
||||
SDDropMnodeReq dropReq = {0};
|
||||
if (tDeserializeSMCreateDropMnodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to drop mnode since %s", terrstr());
|
||||
return -1;
|
||||
} else {
|
||||
|
@ -95,8 +95,8 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
|
|||
}
|
||||
|
||||
if (alterReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
dError("failed to alter mnode since %s", terrstr());
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to alter mnode since %s, dnodeId:%d input:%d", terrstr(), pDnode->dnodeId, alterReq.dnodeId);
|
||||
return -1;
|
||||
} else {
|
||||
return mmAlter(pMgmt, &alterReq);
|
||||
|
|
|
@ -48,15 +48,13 @@ static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) {
|
|||
}
|
||||
|
||||
static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) {
|
||||
SDnode *pDnode = pMgmt->pDnode;
|
||||
|
||||
mmInitOption(pMgmt, pOption);
|
||||
pOption->replica = 1;
|
||||
pOption->selfIndex = 0;
|
||||
SReplica *pReplica = &pOption->replicas[0];
|
||||
pReplica->id = 1;
|
||||
pReplica->port = pDnode->serverPort;
|
||||
tstrncpy(pReplica->fqdn, pDnode->localFqdn, TSDB_FQDN_LEN);
|
||||
pReplica->port = pMgmt->pDnode->serverPort;
|
||||
tstrncpy(pReplica->fqdn, pMgmt->pDnode->localFqdn, TSDB_FQDN_LEN);
|
||||
pOption->deploy = true;
|
||||
|
||||
pMgmt->selfIndex = pOption->selfIndex;
|
||||
|
@ -114,6 +112,9 @@ static int32_t mmOpenImp(SMnodeMgmt *pMgmt, SDCreateMnodeReq *pReq) {
|
|||
|
||||
if (!deployed) {
|
||||
dInfo("mnode start to deploy");
|
||||
if (pMgmt->pWrapper->procType == PROC_CHILD) {
|
||||
pMgmt->pDnode->dnodeId = 1;
|
||||
}
|
||||
mmBuildOptionForDeploy(pMgmt, &option);
|
||||
} else {
|
||||
dInfo("mnode start to open");
|
||||
|
@ -151,12 +152,9 @@ static void mmCloseImp(SMnodeMgmt *pMgmt) {
|
|||
|
||||
int32_t mmAlter(SMnodeMgmt *pMgmt, SDAlterMnodeReq *pReq) {
|
||||
SMnodeOpt option = {0};
|
||||
if (pReq != NULL) {
|
||||
if (mmBuildOptionFromReq(pMgmt, &option, pReq) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return mndAlter(pMgmt->pMnode, &option);
|
||||
}
|
||||
|
||||
|
@ -240,4 +238,3 @@ void mmSetMgmtFp(SMgmtWrapper *pWrapper) {
|
|||
pWrapper->name = "mnode";
|
||||
pWrapper->fp = mgmtFp;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,15 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#include "mmInt.h"
|
||||
|
||||
static inline void mmSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||
.ahandle = pMsg->rpcMsg.ahandle,
|
||||
.code = code,
|
||||
.pCont = pMsg->pRsp,
|
||||
.contLen = pMsg->rspLen};
|
||||
tmsgSendRsp(&rsp);
|
||||
}
|
||||
|
||||
static void mmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
SMnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
|
||||
|
@ -35,8 +44,7 @@ static void mmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
|||
if (pRpc->msgType & 1U) {
|
||||
if (pRpc->handle != NULL && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
if (code != 0 && terrno != 0) code = terrno;
|
||||
SRpcMsg rsp = {.handle = pRpc->handle, .code = code, .contLen = pMsg->rspLen, .pCont = pMsg->pRsp};
|
||||
tmsgSendRsp(&rsp);
|
||||
mmSendRsp(pMsg, code);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +56,7 @@ static void mmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
|||
static void mmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
SMnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
|
||||
dTrace("msg:%p, get from mnode query queue", pMsg);
|
||||
dTrace("msg:%p, get from mnode-query queue", pMsg);
|
||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||
int32_t code = -1;
|
||||
|
||||
|
@ -58,8 +66,7 @@ static void mmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
|||
if (pRpc->msgType & 1U) {
|
||||
if (pRpc->handle != NULL && code != 0) {
|
||||
dError("msg:%p, failed to process since %s", pMsg, terrstr());
|
||||
SRpcMsg rsp = {.handle = pRpc->handle, .code = code, .ahandle = pRpc->ahandle};
|
||||
tmsgSendRsp(&rsp);
|
||||
mmSendRsp(pMsg, code);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,10 +106,7 @@ int32_t mmProcessQueryMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
|
||||
int32_t mmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||
SMnodeMgmt *pMgmt = pWrapper->pMgmt;
|
||||
SSingleWorker *pWorker = &pMgmt->monitorWorker;
|
||||
|
||||
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
|
||||
taosWriteQitem(pWorker->queue, pMsg);
|
||||
mmPutMsgToWorker(&pMgmt->monitorWorker, pMsg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#include "qmInt.h"
|
||||
|
||||
void qmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonQmInfo *qmInfo) {
|
||||
}
|
||||
void qmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonQmInfo *qmInfo) {}
|
||||
|
||||
int32_t qmProcessGetMonQmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
||||
SMonQmInfo qmInfo = {0};
|
||||
|
@ -49,14 +48,14 @@ int32_t qmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||
|
||||
SDCreateQnodeReq createReq = {0};
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
dError("failed to create qnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to create qnode since %s", terrstr());
|
||||
return -1;
|
||||
} else {
|
||||
return qmOpen(pWrapper);
|
||||
|
@ -68,13 +67,13 @@ int32_t qmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||
|
||||
SDDropQnodeReq dropReq = {0};
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to drop qnode since %s", terrstr());
|
||||
return -1;
|
||||
} else {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#include "qmInt.h"
|
||||
|
||||
static inline void qmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
||||
static inline void qmSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||
.ahandle = pMsg->rpcMsg.ahandle,
|
||||
.code = code,
|
||||
|
@ -25,20 +25,22 @@ static inline void qmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
|||
tmsgSendRsp(&rsp);
|
||||
}
|
||||
|
||||
static void qmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
static void qmProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
|
||||
dTrace("msg:%p, get from qnode monitor queue", pMsg);
|
||||
dTrace("msg:%p, get from qnode-monitor queue", pMsg);
|
||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||
int32_t code = -1;
|
||||
|
||||
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
||||
code = qmProcessGetMonQmInfoReq(pMgmt->pWrapper, pMsg);
|
||||
} else {
|
||||
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||
}
|
||||
|
||||
if (pRpc->msgType & 1U) {
|
||||
if (code != 0 && terrno != 0) code = terrno;
|
||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
||||
qmSendRsp(pMsg, code);
|
||||
}
|
||||
|
||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||
|
@ -49,10 +51,12 @@ static void qmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
|||
static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
|
||||
dTrace("msg:%p, will be processed in qnode-query queue", pMsg);
|
||||
int32_t code = qndProcessQueryMsg(pMgmt->pQnode, &pMsg->rpcMsg);
|
||||
if (code != 0) {
|
||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
||||
dTrace("msg:%p, get from qnode-query queue", pMsg);
|
||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||
int32_t code = qndProcessQueryMsg(pMgmt->pQnode, pRpc);
|
||||
|
||||
if (pRpc->msgType & 1U && code != 0) {
|
||||
qmSendRsp(pMsg, code);
|
||||
}
|
||||
|
||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||
|
@ -63,10 +67,12 @@ static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
|||
static void qmProcessFetchQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
|
||||
dTrace("msg:%p, will be processed in qnode-fetch queue", pMsg);
|
||||
int32_t code = qndProcessFetchMsg(pMgmt->pQnode, &pMsg->rpcMsg);
|
||||
if (code != 0) {
|
||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
||||
dTrace("msg:%p, get from qnode-fetch queue", pMsg);
|
||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||
int32_t code = qndProcessFetchMsg(pMgmt->pQnode, pRpc);
|
||||
|
||||
if (pRpc->msgType & 1U && code != 0) {
|
||||
qmSendRsp(pMsg, code);
|
||||
}
|
||||
|
||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||
|
@ -93,10 +99,7 @@ int32_t qmProcessFetchMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
|
||||
int32_t qmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
||||
SSingleWorker *pWorker = &pMgmt->monitorWorker;
|
||||
|
||||
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
|
||||
taosWriteQitem(pWorker->queue, pMsg);
|
||||
qmPutMsgToWorker(&pMgmt->monitorWorker, pMsg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -125,6 +128,7 @@ int32_t qmPutMsgToFetchQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc) {
|
|||
int32_t qmGetQueueSize(SMgmtWrapper *pWrapper, int32_t vgId, EQueueType qtype) {
|
||||
int32_t size = -1;
|
||||
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
||||
|
||||
switch (qtype) {
|
||||
case QUERY_QUEUE:
|
||||
size = taosQueueSize(pMgmt->queryWorker.queue);
|
||||
|
@ -164,7 +168,7 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt) {
|
|||
|
||||
if (tsMultiProcess) {
|
||||
SSingleWorkerCfg mCfg = {
|
||||
.min = 1, .max = 1, .name = "qnode-monitor", .fp = (FItem)qmProcessMonQueue, .param = pMgmt};
|
||||
.min = 1, .max = 1, .name = "qnode-monitor", .fp = (FItem)qmProcessMonitorQueue, .param = pMgmt};
|
||||
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
||||
dError("failed to start qnode-monitor worker since %s", terrstr());
|
||||
return -1;
|
||||
|
|
|
@ -48,14 +48,14 @@ int32_t smProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||
|
||||
SDCreateSnodeReq createReq = {0};
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
dError("failed to create snode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to create snode since %s", terrstr());
|
||||
return -1;
|
||||
} else {
|
||||
return smOpen(pWrapper);
|
||||
|
@ -67,13 +67,13 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
|||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||
|
||||
SDDropSnodeReq dropReq = {0};
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
||||
terrno = TSDB_CODE_INVALID_OPTION;
|
||||
dError("failed to drop snode since %s", terrstr());
|
||||
return -1;
|
||||
} else {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#include "smInt.h"
|
||||
|
||||
static inline void smSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
||||
static inline void smSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||
.ahandle = pMsg->rpcMsg.ahandle,
|
||||
.code = code,
|
||||
|
@ -28,17 +28,19 @@ static inline void smSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
|||
static void smProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
|
||||
dTrace("msg:%p, get from snode monitor queue", pMsg);
|
||||
dTrace("msg:%p, get from snode-monitor queue", pMsg);
|
||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||
int32_t code = -1;
|
||||
|
||||
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
||||
code = smProcessGetMonSmInfoReq(pMgmt->pWrapper, pMsg);
|
||||
} else {
|
||||
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||
}
|
||||
|
||||
if (pRpc->msgType & 1U) {
|
||||
if (code != 0 && terrno != 0) code = terrno;
|
||||
smSendRsp(pMgmt->pWrapper, pMsg, code);
|
||||
smSendRsp(pMsg, code);
|
||||
}
|
||||
|
||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||
|
@ -53,7 +55,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
|
|||
SNodeMsg *pMsg = NULL;
|
||||
taosGetQitem(qall, (void **)&pMsg);
|
||||
|
||||
dTrace("msg:%p, will be processed in snode unique queue", pMsg);
|
||||
dTrace("msg:%p, get from snode-unique queue", pMsg);
|
||||
sndProcessUMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
||||
|
||||
dTrace("msg:%p, is freed", pMsg);
|
||||
|
@ -65,7 +67,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
|
|||
static void smProcessSharedQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
|
||||
dTrace("msg:%p, will be processed in snode shared queue", pMsg);
|
||||
dTrace("msg:%p, get from snode-shared queue", pMsg);
|
||||
sndProcessSMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
||||
|
||||
dTrace("msg:%p, is freed", pMsg);
|
||||
|
@ -88,7 +90,6 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
|
|||
}
|
||||
|
||||
SMultiWorkerCfg cfg = {.max = 1, .name = "snode-unique", .fp = smProcessUniqueQueue, .param = pMgmt};
|
||||
|
||||
if (tMultiWorkerInit(pUniqueWorker, &cfg) != 0) {
|
||||
dError("failed to start snode-unique worker since %s", terrstr());
|
||||
return -1;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
aux_source_directory(. BQTEST_SRC)
|
||||
add_executable(dnode_test_bnode ${BQTEST_SRC})
|
||||
add_executable(dbnodeTest ${BQTEST_SRC})
|
||||
target_link_libraries(
|
||||
dnode_test_bnode
|
||||
dbnodeTest
|
||||
PUBLIC sut
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME dnode_test_bnode
|
||||
COMMAND dnode_test_bnode
|
||||
NAME dbnodeTest
|
||||
COMMAND dbnodeTest
|
||||
)
|
||||
|
|
|
@ -33,22 +33,22 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
|||
SDCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
SDCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -59,9 +59,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
|||
SDCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -74,9 +74,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
|||
SDCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
||||
|
@ -88,22 +88,22 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
|||
SDDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
SDDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -114,9 +114,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
|||
SDDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -129,9 +129,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
|||
SDDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -142,9 +142,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
|||
SDCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
aux_source_directory(. DMTEST_SRC)
|
||||
add_executable(dnode_test_mnode ${DMTEST_SRC})
|
||||
add_executable(dmnodeTest ${DMTEST_SRC})
|
||||
target_link_libraries(
|
||||
dnode_test_mnode
|
||||
dmnodeTest
|
||||
PUBLIC sut
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME dnode_test_mnode
|
||||
COMMAND dnode_test_mnode
|
||||
NAME dmnodeTest
|
||||
COMMAND dmnodeTest
|
||||
)
|
||||
|
|
|
@ -96,7 +96,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
|
|||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
|
|||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -139,22 +139,22 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
|
|||
SDDropMnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
SDDropMnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -165,9 +165,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
|
|||
SDDropMnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
aux_source_directory(. DQTEST_SRC)
|
||||
add_executable(dnode_test_qnode ${DQTEST_SRC})
|
||||
add_executable(dqnodeTest ${DQTEST_SRC})
|
||||
target_link_libraries(
|
||||
dnode_test_qnode
|
||||
dqnodeTest
|
||||
PUBLIC sut
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME dnode_test_qnode
|
||||
COMMAND dnode_test_qnode
|
||||
NAME dqnodeTest
|
||||
COMMAND dqnodeTest
|
||||
)
|
||||
|
|
|
@ -30,22 +30,22 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
|||
SDCreateQnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
SDCreateQnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -56,9 +56,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
|||
SDCreateQnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -71,9 +71,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
|||
SDCreateQnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -86,22 +86,22 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
|||
SDDropQnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
SDDropQnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -112,9 +112,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
|||
SDDropQnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -127,9 +127,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
|||
SDDropQnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -140,9 +140,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
|||
SDCreateQnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
aux_source_directory(. SQTEST_SRC)
|
||||
add_executable(dnode_test_snode ${SQTEST_SRC})
|
||||
add_executable(dsnodeTest ${SQTEST_SRC})
|
||||
target_link_libraries(
|
||||
dnode_test_snode
|
||||
dsnodeTest
|
||||
PUBLIC sut
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME dnode_test_snode
|
||||
COMMAND dnode_test_snode
|
||||
NAME dsnodeTest
|
||||
COMMAND dsnodeTest
|
||||
)
|
||||
|
|
|
@ -30,22 +30,22 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
|||
SDCreateSnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
SDCreateSnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -56,9 +56,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
|||
SDCreateSnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -71,9 +71,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
|||
SDCreateSnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -86,22 +86,22 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
|||
SDDropSnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||
}
|
||||
|
||||
{
|
||||
SDDropSnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -112,9 +112,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
|||
SDDropSnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -127,9 +127,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
|||
SDDropSnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -140,9 +140,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
|||
SDCreateSnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
aux_source_directory(. VNODE_SRC)
|
||||
add_executable(dnode_test_vnode ${VNODE_SRC})
|
||||
add_executable(dvnodeTest ${VNODE_SRC})
|
||||
target_link_libraries(
|
||||
dnode_test_vnode
|
||||
dvnodeTest
|
||||
PUBLIC sut
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME dnode_test_vnode
|
||||
COMMAND dnode_test_vnode
|
||||
NAME dvnodeTest
|
||||
COMMAND dvnodeTest
|
||||
)
|
||||
|
|
|
@ -67,7 +67,7 @@ TEST_F(DndTestVnode, 01_Create_Vnode) {
|
|||
ASSERT_EQ(pRsp->code, 0);
|
||||
test.Restart();
|
||||
} else {
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ TEST_F(DndTestVnode, 06_Drop_Vnode) {
|
|||
ASSERT_EQ(pRsp->code, 0);
|
||||
test.Restart();
|
||||
} else {
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_NOT_DEPLOYED);
|
||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes) {
|
|||
}
|
||||
|
||||
int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes) {
|
||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
||||
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 30000;
|
||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||
|
|
|
@ -139,7 +139,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
|
|||
tFreeSCreateVnodeReq(&createReq);
|
||||
dDebug("vgId:%d, already exist", createReq.vgId);
|
||||
vmReleaseVnode(pMgmt, pVnode);
|
||||
terrno = TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED;
|
||||
terrno = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
|
|||
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
||||
if (pVnode == NULL) {
|
||||
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
||||
terrno = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
||||
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ aux_source_directory(src MNODE_SRC)
|
|||
add_library(mnode STATIC ${MNODE_SRC})
|
||||
target_include_directories(
|
||||
mnode
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/mnode"
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/dnode/mnode"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
target_link_libraries(
|
||||
|
|
|
@ -69,7 +69,6 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
int64_t showId;
|
||||
ShowMetaFp metaFps[TSDB_MGMT_TABLE_MAX];
|
||||
ShowRetrieveFp retrieveFps[TSDB_MGMT_TABLE_MAX];
|
||||
ShowFreeIterFp freeIterFps[TSDB_MGMT_TABLE_MAX];
|
||||
SCacheObj *cache;
|
||||
|
@ -100,6 +99,7 @@ typedef struct {
|
|||
} SGrantInfo;
|
||||
|
||||
typedef struct SMnode {
|
||||
int32_t selfId;
|
||||
int64_t clusterId;
|
||||
int8_t replica;
|
||||
int8_t selfIndex;
|
||||
|
|
|
@ -24,10 +24,12 @@ extern "C" {
|
|||
|
||||
int32_t mndInitMnode(SMnode *pMnode);
|
||||
void mndCleanupMnode(SMnode *pMnode);
|
||||
SMnodeObj *mndAcquireMnode(SMnode *pMnode, int32_t mnodeId);
|
||||
void mndReleaseMnode(SMnode *pMnode, SMnodeObj *pObj);
|
||||
bool mndIsMnode(SMnode *pMnode, int32_t dnodeId);
|
||||
void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet);
|
||||
char *mndGetRoleStr(int32_t role);
|
||||
void mndUpdateMnodeRole(SMnode *pMnode);
|
||||
const char *mndGetRoleStr(int32_t role);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ extern "C" {
|
|||
|
||||
int32_t mndInitShow(SMnode *pMnode);
|
||||
void mndCleanupShow(SMnode *pMnode);
|
||||
void mndAddShowMetaHandle(SMnode *pMnode, EShowType showType, ShowMetaFp fp);
|
||||
void mndAddShowRetrieveHandle(SMnode *pMnode, EShowType showType, ShowRetrieveFp fp);
|
||||
void mndAddShowFreeIterHandle(SMnode *pMnode, EShowType msgType, ShowFreeIterFp fp);
|
||||
void mndVacuumResult(char *data, int32_t numOfCols, int32_t rows, int32_t capacity, SShowObj *pShow);
|
||||
|
|
|
@ -21,17 +21,17 @@
|
|||
#include "mndTrans.h"
|
||||
#include "mndUser.h"
|
||||
|
||||
#define TSDB_BNODE_VER_NUMBER 1
|
||||
#define TSDB_BNODE_RESERVE_SIZE 64
|
||||
#define BNODE_VER_NUMBER 1
|
||||
#define BNODE_RESERVE_SIZE 64
|
||||
|
||||
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj);
|
||||
static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw);
|
||||
static int32_t mndBnodeActionInsert(SSdb *pSdb, SBnodeObj *pObj);
|
||||
static int32_t mndBnodeActionDelete(SSdb *pSdb, SBnodeObj *pObj);
|
||||
static int32_t mndBnodeActionUpdate(SSdb *pSdb, SBnodeObj *pOld, SBnodeObj *pNew);
|
||||
static int32_t mndBnodeActionDelete(SSdb *pSdb, SBnodeObj *pObj);
|
||||
static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessCreateBnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndGetBnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
|
@ -51,7 +51,6 @@ int32_t mndInitBnode(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_BNODE_RSP, mndProcessCreateBnodeRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_DND_DROP_BNODE_RSP, mndProcessDropBnodeRsp);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_BNODE, mndGetBnodeMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_BNODE, mndRetrieveBnodes);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_BNODE, mndCancelGetNextBnode);
|
||||
|
||||
|
@ -76,18 +75,18 @@ static void mndReleaseBnode(SMnode *pMnode, SBnodeObj *pObj) {
|
|||
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_BNODE, TSDB_BNODE_VER_NUMBER, sizeof(SBnodeObj) + TSDB_BNODE_RESERVE_SIZE);
|
||||
if (pRaw == NULL) goto BNODE_ENCODE_OVER;
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_BNODE, BNODE_VER_NUMBER, sizeof(SBnodeObj) + BNODE_RESERVE_SIZE);
|
||||
if (pRaw == NULL) goto _OVER;
|
||||
|
||||
int32_t dataPos = 0;
|
||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, BNODE_ENCODE_OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, BNODE_ENCODE_OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, BNODE_ENCODE_OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_BNODE_RESERVE_SIZE, BNODE_ENCODE_OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, BNODE_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
||||
BNODE_ENCODE_OVER:
|
||||
_OVER:
|
||||
if (terrno != 0) {
|
||||
mError("bnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||
sdbFreeRaw(pRaw);
|
||||
|
@ -102,28 +101,28 @@ static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw) {
|
|||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
int8_t sver = 0;
|
||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto BNODE_DECODE_OVER;
|
||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||
|
||||
if (sver != TSDB_BNODE_VER_NUMBER) {
|
||||
if (sver != BNODE_VER_NUMBER) {
|
||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||
goto BNODE_DECODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
SSdbRow *pRow = sdbAllocRow(sizeof(SBnodeObj));
|
||||
if (pRow == NULL) goto BNODE_DECODE_OVER;
|
||||
if (pRow == NULL) goto _OVER;
|
||||
|
||||
SBnodeObj *pObj = sdbGetRowObj(pRow);
|
||||
if (pObj == NULL) goto BNODE_DECODE_OVER;
|
||||
if (pObj == NULL) goto _OVER;
|
||||
|
||||
int32_t dataPos = 0;
|
||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, BNODE_DECODE_OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, BNODE_DECODE_OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, BNODE_DECODE_OVER)
|
||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_BNODE_RESERVE_SIZE, BNODE_DECODE_OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||
SDB_GET_RESERVE(pRaw, dataPos, BNODE_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
||||
BNODE_DECODE_OVER:
|
||||
_OVER:
|
||||
if (terrno != 0) {
|
||||
mError("bnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||
taosMemoryFreeClear(pRow);
|
||||
|
@ -190,13 +189,13 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
SDCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -217,13 +216,13 @@ static int32_t mndSetCreateBnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
SDDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -249,19 +248,19 @@ static int32_t mndCreateBnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
|||
bnodeObj.updateTime = bnodeObj.createdTime;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_BNODE, &pReq->rpcMsg);
|
||||
if (pTrans == NULL) goto CREATE_BNODE_OVER;
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
|
||||
if (mndSetCreateBnodeRedoLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
||||
if (mndSetCreateBnodeUndoLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
||||
if (mndSetCreateBnodeCommitLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
||||
if (mndSetCreateBnodeRedoActions(pTrans, pDnode, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
||||
if (mndSetCreateBnodeUndoActions(pTrans, pDnode, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_BNODE_OVER;
|
||||
if (mndSetCreateBnodeRedoLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateBnodeUndoLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateBnodeCommitLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateBnodeRedoActions(pTrans, pDnode, &bnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateBnodeUndoActions(pTrans, pDnode, &bnodeObj) != 0) goto _OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
CREATE_BNODE_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
@ -274,9 +273,9 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
|
|||
SUserObj *pUser = NULL;
|
||||
SMCreateBnodeReq createReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto CREATE_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
mDebug("bnode:%d, start to create", createReq.dnodeId);
|
||||
|
@ -284,31 +283,31 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
|
|||
pObj = mndAcquireBnode(pMnode, createReq.dnodeId);
|
||||
if (pObj != NULL) {
|
||||
terrno = TSDB_CODE_MND_BNODE_ALREADY_EXIST;
|
||||
goto CREATE_BNODE_OVER;
|
||||
goto _OVER;
|
||||
} else if (terrno != TSDB_CODE_MND_BNODE_NOT_EXIST) {
|
||||
goto CREATE_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||
if (pDnode == NULL) {
|
||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||
goto CREATE_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
goto CREATE_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (mndCheckNodeAuth(pUser)) {
|
||||
goto CREATE_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndCreateBnode(pMnode, pReq, pDnode, &createReq);
|
||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
|
||||
CREATE_BNODE_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mError("bnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -316,7 +315,6 @@ CREATE_BNODE_OVER:
|
|||
mndReleaseBnode(pMnode, pObj);
|
||||
mndReleaseDnode(pMnode, pDnode);
|
||||
mndReleaseUser(pMnode, pUser);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -340,13 +338,13 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
|
|||
SDDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -367,17 +365,17 @@ static int32_t mndDropBnode(SMnode *pMnode, SNodeMsg *pReq, SBnodeObj *pObj) {
|
|||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_BNODE, &pReq->rpcMsg);
|
||||
if (pTrans == NULL) goto DROP_BNODE_OVER;
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
|
||||
if (mndSetDropBnodeRedoLogs(pTrans, pObj) != 0) goto DROP_BNODE_OVER;
|
||||
if (mndSetDropBnodeCommitLogs(pTrans, pObj) != 0) goto DROP_BNODE_OVER;
|
||||
if (mndSetDropBnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_BNODE_OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_BNODE_OVER;
|
||||
if (mndSetDropBnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||
if (mndSetDropBnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||
if (mndSetDropBnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
DROP_BNODE_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
@ -389,37 +387,37 @@ static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq) {
|
|||
SBnodeObj *pObj = NULL;
|
||||
SMDropBnodeReq dropReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto DROP_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
mDebug("bnode:%d, start to drop", dropReq.dnodeId);
|
||||
|
||||
if (dropReq.dnodeId <= 0) {
|
||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||
goto DROP_BNODE_OVER;
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pObj = mndAcquireBnode(pMnode, dropReq.dnodeId);
|
||||
if (pObj == NULL) {
|
||||
goto DROP_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
goto DROP_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (mndCheckNodeAuth(pUser)) {
|
||||
goto DROP_BNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndDropBnode(pMnode, pReq, pObj);
|
||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
|
||||
DROP_BNODE_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mError("bnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -440,46 +438,6 @@ static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndGetBnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "id");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "endpoint");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
pShow->numOfRows = sdbGetSize(pSdb, SDB_BNODE);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
|
|
@ -26,7 +26,6 @@ static int32_t mndClusterActionInsert(SSdb *pSdb, SClusterObj *pCluster);
|
|||
static int32_t mndClusterActionDelete(SSdb *pSdb, SClusterObj *pCluster);
|
||||
static int32_t mndClusterActionUpdate(SSdb *pSdb, SClusterObj *pOldCluster, SClusterObj *pNewCluster);
|
||||
static int32_t mndCreateDefaultCluster(SMnode *pMnode);
|
||||
static int32_t mndGetClusterMeta(SNodeMsg *pMsg, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter);
|
||||
|
||||
|
@ -40,7 +39,6 @@ int32_t mndInitCluster(SMnode *pMnode) {
|
|||
.updateFp = (SdbUpdateFp)mndClusterActionUpdate,
|
||||
.deleteFp = (SdbDeleteFp)mndClusterActionDelete};
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndGetClusterMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndRetrieveClusters);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndCancelGetNextCluster);
|
||||
return sdbSetTable(pMnode->pSdb, table);
|
||||
|
@ -180,44 +178,6 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
|
|||
return sdbWrite(pMnode->pSdb, pRaw);
|
||||
}
|
||||
|
||||
static int32_t mndGetClusterMeta(SNodeMsg *pMsg, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BIGINT;
|
||||
strcpy(pSchema[cols].name, "id");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "name");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
pShow->numOfRows = 1;
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows) {
|
||||
SMnode *pMnode = pMsg->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
|
|
@ -35,7 +35,6 @@ static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer);
|
|||
static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer);
|
||||
static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pConsumer, SMqConsumerObj *pNewConsumer);
|
||||
static int32_t mndProcessConsumerMetaMsg(SNodeMsg *pMsg);
|
||||
static int32_t mndGetConsumerMeta(SNodeMsg *pMsg, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveConsumer(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextConsumer(SMnode *pMnode, void *pIter);
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ static int32_t mndProcessDropDbReq(SNodeMsg *pReq);
|
|||
static int32_t mndProcessUseDbReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessSyncDbReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessCompactDbReq(SNodeMsg *pReq);
|
||||
static int32_t mndGetDbMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextDb(SMnode *pMnode, void *pIter);
|
||||
static int32_t mndProcessGetDbCfgReq(SNodeMsg *pReq);
|
||||
|
@ -62,7 +61,6 @@ int32_t mndInitDb(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_GET_DB_CFG, mndProcessGetDbCfgReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_GET_INDEX, mndProcessGetIndexReq);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_DB, mndGetDbMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_DB, mndRetrieveDbs);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_DB, mndCancelGetNextDb);
|
||||
|
||||
|
@ -381,7 +379,7 @@ static int32_t mndSetCreateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
|||
action.pCont = pReq;
|
||||
action.contLen = contLen;
|
||||
action.msgType = TDMT_DND_CREATE_VNODE;
|
||||
action.acceptableCode = TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED;
|
||||
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return -1;
|
||||
|
@ -412,7 +410,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
|||
action.pCont = pReq;
|
||||
action.contLen = contLen;
|
||||
action.msgType = TDMT_DND_DROP_VNODE;
|
||||
action.acceptableCode = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
||||
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return -1;
|
||||
|
@ -880,7 +878,7 @@ static int32_t mndBuildDropVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *
|
|||
action.pCont = pReq;
|
||||
action.contLen = contLen;
|
||||
action.msgType = TDMT_DND_DROP_VNODE;
|
||||
action.acceptableCode = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
||||
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
return -1;
|
||||
|
@ -1040,7 +1038,7 @@ static void mndBuildDBVgroupInfo(SDbObj *pDb, SMnode *pMnode, SArray *pVgList) {
|
|||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
void *pIter = NULL;
|
||||
while (true) {
|
||||
while (1) {
|
||||
SVgObj *pVgroup = NULL;
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
if (pIter == NULL) break;
|
||||
|
@ -1342,136 +1340,6 @@ SYNC_DB_OVER:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndGetDbMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = (TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "name");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "vgroups");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "ntables");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "replica");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "quorum");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "days");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 24 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "keep0,keep1,keep2");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "cache");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "blocks");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "minrows");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "maxrows");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 1;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TINYINT;
|
||||
strcpy(pSchema[cols].name, "wallevel");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "fsync");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 1;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TINYINT;
|
||||
strcpy(pSchema[cols].name, "comp");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 1;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TINYINT;
|
||||
strcpy(pSchema[cols].name, "cachelast");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 3 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "precision");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
// pShow->bytes[cols] = 1;
|
||||
// pSchema[cols].type = TSDB_DATA_TYPE_TINYINT;
|
||||
// strcpy(pSchema[cols].name, "update");
|
||||
// pSchema[cols].bytes = pShow->bytes[cols];
|
||||
// cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
pShow->numOfRows = sdbGetSize(pSdb, SDB_DB);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *mnGetDbStr(char *src) {
|
||||
char *pos = strstr(src, TS_PATH_DELIMITER);
|
||||
if (pos != NULL) ++pos;
|
||||
|
|
|
@ -58,7 +58,6 @@ static int32_t mndProcessStatusReq(SNodeMsg *pReq);
|
|||
static int32_t mndGetConfigMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextConfig(SMnode *pMnode, void *pIter);
|
||||
static int32_t mndGetDnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextDnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
|
@ -78,10 +77,8 @@ int32_t mndInitDnode(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_DND_CONFIG_DNODE_RSP, mndProcessConfigDnodeRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_STATUS, mndProcessStatusReq);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_VARIABLES, mndGetConfigMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_VARIABLES, mndRetrieveConfigs);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_VARIABLES, mndCancelGetNextConfig);
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_DNODE, mndGetDnodeMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_DNODE, mndRetrieveDnodes);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_DNODE, mndCancelGetNextDnode);
|
||||
|
||||
|
@ -552,9 +549,10 @@ static int32_t mndProcessDropDnodeReq(SNodeMsg *pReq) {
|
|||
int32_t code = -1;
|
||||
SUserObj *pUser = NULL;
|
||||
SDnodeObj *pDnode = NULL;
|
||||
SMnodeObj *pMObj = NULL;
|
||||
SMDropMnodeReq dropReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto DROP_DNODE_OVER;
|
||||
}
|
||||
|
@ -572,6 +570,12 @@ static int32_t mndProcessDropDnodeReq(SNodeMsg *pReq) {
|
|||
goto DROP_DNODE_OVER;
|
||||
}
|
||||
|
||||
pMObj = mndAcquireMnode(pMnode, dropReq.dnodeId);
|
||||
if (pMObj != NULL) {
|
||||
terrno = TSDB_CODE_MND_MNODE_DEPLOYED;
|
||||
goto DROP_DNODE_OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
|
@ -592,6 +596,7 @@ DROP_DNODE_OVER:
|
|||
|
||||
mndReleaseDnode(pMnode, pDnode);
|
||||
mndReleaseUser(pMnode, pUser);
|
||||
mndReleaseMnode(pMnode, pMObj);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -710,70 +715,6 @@ static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, i
|
|||
|
||||
static void mndCancelGetNextConfig(SMnode *pMnode, void *pIter) {}
|
||||
|
||||
static int32_t mndGetDnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "id");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "endpoint");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "vnodes");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "support_vnodes");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 10 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "status");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 256 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "offline_reason");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
pShow->numOfRows = sdbGetSize(pSdb, SDB_DNODE);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
|
|
@ -51,7 +51,6 @@ int32_t mndInitFunc(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_DROP_FUNC, mndProcessDropFuncReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_RETRIEVE_FUNC, mndProcessRetrieveFuncReq);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_FUNC, mndGetFuncMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_FUNC, mndRetrieveFuncs);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_FUNC, mndCancelGetNextFunc);
|
||||
|
||||
|
|
|
@ -44,7 +44,22 @@ static const SInfosTableSchema modulesSchema[] = {
|
|||
};
|
||||
static const SInfosTableSchema qnodesSchema[] = {
|
||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema snodesSchema[] = {
|
||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema bnodesSchema[] = {
|
||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema clusterSchema[] = {
|
||||
{.name = "id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
|
||||
{.name = "name", .bytes = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema userDBSchema[] = {
|
||||
|
@ -184,6 +199,9 @@ static const SInfosTableMeta infosMeta[] = {
|
|||
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema)},
|
||||
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema)},
|
||||
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
|
||||
{TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(bnodesSchema)},
|
||||
{TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema)},
|
||||
{TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
|
||||
{TSDB_INS_TABLE_USER_DATABASES, userDBSchema, tListLen(userDBSchema)},
|
||||
{TSDB_INS_TABLE_USER_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
|
||||
{TSDB_INS_TABLE_USER_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include "mndTrans.h"
|
||||
#include "mndUser.h"
|
||||
|
||||
#define TSDB_MNODE_VER_NUMBER 1
|
||||
#define TSDB_MNODE_RESERVE_SIZE 64
|
||||
#define MNODE_VER_NUMBER 1
|
||||
#define MNODE_RESERVE_SIZE 64
|
||||
|
||||
static int32_t mndCreateDefaultMnode(SMnode *pMnode);
|
||||
static SSdbRaw *mndMnodeActionEncode(SMnodeObj *pObj);
|
||||
|
@ -35,7 +35,6 @@ static int32_t mndProcessDropMnodeReq(SNodeMsg *pReq);
|
|||
static int32_t mndProcessCreateMnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessAlterMnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessDropMnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndGetMnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextMnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
|
@ -55,7 +54,6 @@ int32_t mndInitMnode(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_DND_ALTER_MNODE_RSP, mndProcessAlterMnodeRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_DND_DROP_MNODE_RSP, mndProcessDropMnodeRsp);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_MNODE, mndGetMnodeMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_MNODE, mndRetrieveMnodes);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_MNODE, mndCancelGetNextMnode);
|
||||
|
||||
|
@ -64,21 +62,20 @@ int32_t mndInitMnode(SMnode *pMnode) {
|
|||
|
||||
void mndCleanupMnode(SMnode *pMnode) {}
|
||||
|
||||
static SMnodeObj *mndAcquireMnode(SMnode *pMnode, int32_t mnodeId) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SMnodeObj *pObj = sdbAcquire(pSdb, SDB_MNODE, &mnodeId);
|
||||
SMnodeObj *mndAcquireMnode(SMnode *pMnode, int32_t mnodeId) {
|
||||
SMnodeObj *pObj = sdbAcquire(pMnode->pSdb, SDB_MNODE, &mnodeId);
|
||||
if (pObj == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
|
||||
terrno = TSDB_CODE_MND_MNODE_NOT_EXIST;
|
||||
}
|
||||
return pObj;
|
||||
}
|
||||
|
||||
static void mndReleaseMnode(SMnode *pMnode, SMnodeObj *pObj) {
|
||||
void mndReleaseMnode(SMnode *pMnode, SMnodeObj *pObj) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
sdbRelease(pSdb, pObj);
|
||||
sdbRelease(pMnode->pSdb, pObj);
|
||||
}
|
||||
|
||||
char *mndGetRoleStr(int32_t showType) {
|
||||
const char *mndGetRoleStr(int32_t showType) {
|
||||
switch (showType) {
|
||||
case TAOS_SYNC_STATE_FOLLOWER:
|
||||
return "unsynced";
|
||||
|
@ -130,18 +127,18 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
|
|||
static SSdbRaw *mndMnodeActionEncode(SMnodeObj *pObj) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_MNODE, TSDB_MNODE_VER_NUMBER, sizeof(SMnodeObj) + TSDB_MNODE_RESERVE_SIZE);
|
||||
if (pRaw == NULL) goto MNODE_ENCODE_OVER;
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_MNODE, MNODE_VER_NUMBER, sizeof(SMnodeObj) + MNODE_RESERVE_SIZE);
|
||||
if (pRaw == NULL) goto _OVER;
|
||||
|
||||
int32_t dataPos = 0;
|
||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, MNODE_ENCODE_OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, MNODE_ENCODE_OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, MNODE_ENCODE_OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_MNODE_RESERVE_SIZE, MNODE_ENCODE_OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, MNODE_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
||||
MNODE_ENCODE_OVER:
|
||||
_OVER:
|
||||
if (terrno != 0) {
|
||||
mError("mnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||
sdbFreeRaw(pRaw);
|
||||
|
@ -158,26 +155,26 @@ static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw) {
|
|||
int8_t sver = 0;
|
||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) return NULL;
|
||||
|
||||
if (sver != TSDB_MNODE_VER_NUMBER) {
|
||||
if (sver != MNODE_VER_NUMBER) {
|
||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||
goto MNODE_DECODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
SSdbRow *pRow = sdbAllocRow(sizeof(SMnodeObj));
|
||||
if (pRow == NULL) goto MNODE_DECODE_OVER;
|
||||
if (pRow == NULL) goto _OVER;
|
||||
|
||||
SMnodeObj *pObj = sdbGetRowObj(pRow);
|
||||
if (pObj == NULL) goto MNODE_DECODE_OVER;
|
||||
if (pObj == NULL) goto _OVER;
|
||||
|
||||
int32_t dataPos = 0;
|
||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, MNODE_DECODE_OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, MNODE_DECODE_OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, MNODE_DECODE_OVER)
|
||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_MNODE_RESERVE_SIZE, MNODE_DECODE_OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||
SDB_GET_RESERVE(pRaw, dataPos, MNODE_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
||||
MNODE_DECODE_OVER:
|
||||
_OVER:
|
||||
if (terrno != 0) {
|
||||
mError("mnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||
taosMemoryFreeClear(pRow);
|
||||
|
@ -188,8 +185,6 @@ MNODE_DECODE_OVER:
|
|||
return pRow;
|
||||
}
|
||||
|
||||
static void mnodeResetMnode(SMnodeObj *pObj) { pObj->role = TAOS_SYNC_STATE_FOLLOWER; }
|
||||
|
||||
static int32_t mndMnodeActionInsert(SSdb *pSdb, SMnodeObj *pObj) {
|
||||
mTrace("mnode:%d, perform insert action, row:%p", pObj->id, pObj);
|
||||
pObj->pDnode = sdbAcquire(pSdb, SDB_DNODE, &pObj->id);
|
||||
|
@ -199,7 +194,7 @@ static int32_t mndMnodeActionInsert(SSdb *pSdb, SMnodeObj *pObj) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
mnodeResetMnode(pObj);
|
||||
pObj->role = TAOS_SYNC_STATE_FOLLOWER;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -233,7 +228,6 @@ bool mndIsMnode(SMnode *pMnode, int32_t dnodeId) {
|
|||
|
||||
void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
pEpSet->numOfEps = 0;
|
||||
|
||||
void *pIter = NULL;
|
||||
|
@ -241,16 +235,17 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
|
|||
SMnodeObj *pObj = NULL;
|
||||
pIter = sdbFetch(pSdb, SDB_MNODE, pIter, (void **)&pObj);
|
||||
if (pIter == NULL) break;
|
||||
if (pObj->pDnode == NULL) break;
|
||||
|
||||
if (pObj->pDnode == NULL) {
|
||||
mError("mnode:%d, no corresponding dnode exists", pObj->id);
|
||||
} else {
|
||||
if (pObj->role == TAOS_SYNC_STATE_LEADER) {
|
||||
pEpSet->inUse = pEpSet->numOfEps;
|
||||
}
|
||||
|
||||
addEpIntoEpSet(pEpSet, pObj->pDnode->fqdn, pObj->pDnode->port);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mndSetCreateMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
||||
SSdbRaw *pRedoRaw = mndMnodeActionEncode(pObj);
|
||||
|
@ -364,18 +359,18 @@ static int32_t mndCreateMnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
|||
mnodeObj.updateTime = mnodeObj.createdTime;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_CREATE_MNODE, &pReq->rpcMsg);
|
||||
if (pTrans == NULL) goto CREATE_MNODE_OVER;
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId);
|
||||
if (mndSetCreateMnodeRedoLogs(pMnode, pTrans, &mnodeObj) != 0) goto CREATE_MNODE_OVER;
|
||||
if (mndSetCreateMnodeCommitLogs(pMnode, pTrans, &mnodeObj) != 0) goto CREATE_MNODE_OVER;
|
||||
if (mndSetCreateMnodeRedoActions(pMnode, pTrans, pDnode, &mnodeObj) != 0) goto CREATE_MNODE_OVER;
|
||||
if (mndSetCreateMnodeRedoLogs(pMnode, pTrans, &mnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateMnodeCommitLogs(pMnode, pTrans, &mnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateMnodeRedoActions(pMnode, pTrans, pDnode, &mnodeObj) != 0) goto _OVER;
|
||||
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_MNODE_OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
CREATE_MNODE_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
@ -388,9 +383,9 @@ static int32_t mndProcessCreateMnodeReq(SNodeMsg *pReq) {
|
|||
SUserObj *pUser = NULL;
|
||||
SMCreateMnodeReq createReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto CREATE_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
mDebug("mnode:%d, start to create", createReq.dnodeId);
|
||||
|
@ -398,31 +393,31 @@ static int32_t mndProcessCreateMnodeReq(SNodeMsg *pReq) {
|
|||
pObj = mndAcquireMnode(pMnode, createReq.dnodeId);
|
||||
if (pObj != NULL) {
|
||||
terrno = TSDB_CODE_MND_MNODE_ALREADY_EXIST;
|
||||
goto CREATE_MNODE_OVER;
|
||||
goto _OVER;
|
||||
} else if (terrno != TSDB_CODE_MND_MNODE_NOT_EXIST) {
|
||||
goto CREATE_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||
if (pDnode == NULL) {
|
||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||
goto CREATE_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
goto CREATE_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (mndCheckNodeAuth(pUser)) {
|
||||
goto CREATE_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndCreateMnode(pMnode, pReq, pDnode, &createReq);
|
||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
|
||||
CREATE_MNODE_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mError("mnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -509,9 +504,9 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
|
|||
|
||||
SDDropMnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = pObj->id;
|
||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
action.pCont = pReq;
|
||||
|
@ -531,18 +526,18 @@ static int32_t mndDropMnode(SMnode *pMnode, SNodeMsg *pReq, SMnodeObj *pObj) {
|
|||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_MNODE, &pReq->rpcMsg);
|
||||
if (pTrans == NULL) goto DROP_MNODE_OVER;
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
|
||||
|
||||
if (mndSetDropMnodeRedoLogs(pMnode, pTrans, pObj) != 0) goto DROP_MNODE_OVER;
|
||||
if (mndSetDropMnodeCommitLogs(pMnode, pTrans, pObj) != 0) goto DROP_MNODE_OVER;
|
||||
if (mndSetDropMnodeRedoActions(pMnode, pTrans, pObj->pDnode, pObj) != 0) goto DROP_MNODE_OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_MNODE_OVER;
|
||||
if (mndSetDropMnodeRedoLogs(pMnode, pTrans, pObj) != 0) goto _OVER;
|
||||
if (mndSetDropMnodeCommitLogs(pMnode, pTrans, pObj) != 0) goto _OVER;
|
||||
if (mndSetDropMnodeRedoActions(pMnode, pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
DROP_MNODE_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
@ -554,37 +549,47 @@ static int32_t mndProcessDropMnodeReq(SNodeMsg *pReq) {
|
|||
SMnodeObj *pObj = NULL;
|
||||
SMDropMnodeReq dropReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto DROP_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
mDebug("mnode:%d, start to drop", dropReq.dnodeId);
|
||||
|
||||
if (dropReq.dnodeId <= 0) {
|
||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||
goto DROP_MNODE_OVER;
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pObj = mndAcquireMnode(pMnode, dropReq.dnodeId);
|
||||
if (pObj == NULL) {
|
||||
goto DROP_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (pMnode->selfId == dropReq.dnodeId) {
|
||||
terrno = TSDB_CODE_MND_CANT_DROP_MASTER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (sdbGetSize(pMnode->pSdb, SDB_MNODE) <= 1) {
|
||||
terrno = TSDB_CODE_MND_TOO_FEW_MNODES;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
goto DROP_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (mndCheckNodeAuth(pUser)) {
|
||||
goto DROP_MNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndDropMnode(pMnode, pReq, pObj);
|
||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
|
||||
DROP_MNODE_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mError("mnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -610,59 +615,6 @@ static int32_t mndProcessDropMnodeRsp(SNodeMsg *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndGetMnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "id");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "endpoint");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 12 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "role");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "role_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
pShow->numOfRows = sdbGetSize(pSdb, SDB_MNODE);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
mndUpdateMnodeRole(pMnode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
@ -687,7 +639,7 @@ static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in
|
|||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
char *roles = mndGetRoleStr(pObj->role);
|
||||
const char *roles = mndGetRoleStr(pObj->role);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, roles, pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
|
|
|
@ -77,10 +77,8 @@ int32_t mndInitProfile(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_KILL_QUERY, mndProcessKillQueryReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_KILL_CONN, mndProcessKillConnReq);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndGetConnsMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndRetrieveConns);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndCancelGetNextConn);
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndGetQueryMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndRetrieveQueries);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndCancelGetNextQuery);
|
||||
|
||||
|
|
|
@ -21,22 +21,21 @@
|
|||
#include "mndTrans.h"
|
||||
#include "mndUser.h"
|
||||
|
||||
#define TSDB_QNODE_VER_NUMBER 1
|
||||
#define TSDB_QNODE_RESERVE_SIZE 64
|
||||
#define QNODE_VER_NUMBER 1
|
||||
#define QNODE_RESERVE_SIZE 64
|
||||
|
||||
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj);
|
||||
static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw);
|
||||
static int32_t mndQnodeActionInsert(SSdb *pSdb, SQnodeObj *pObj);
|
||||
static int32_t mndQnodeActionDelete(SSdb *pSdb, SQnodeObj *pObj);
|
||||
static int32_t mndQnodeActionUpdate(SSdb *pSdb, SQnodeObj *pOld, SQnodeObj *pNew);
|
||||
static int32_t mndQnodeActionDelete(SSdb *pSdb, SQnodeObj *pObj);
|
||||
static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessCreateQnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndGetQnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq);
|
||||
static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextQnode(SMnode *pMnode, void *pIter);
|
||||
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq);
|
||||
|
||||
int32_t mndInitQnode(SMnode *pMnode) {
|
||||
SSdbTable table = {.sdbType = SDB_QNODE,
|
||||
|
@ -49,11 +48,10 @@ int32_t mndInitQnode(SMnode *pMnode) {
|
|||
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_QNODE, mndProcessCreateQnodeReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_DROP_QNODE, mndProcessDropQnodeReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_QNODE_LIST, mndProcessQnodeListReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_QNODE_RSP, mndProcessCreateQnodeRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_DND_DROP_QNODE_RSP, mndProcessDropQnodeRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_QNODE_LIST, mndProcessQnodeListReq);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndGetQnodeMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndRetrieveQnodes);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndCancelGetNextQnode);
|
||||
|
||||
|
@ -78,18 +76,18 @@ static void mndReleaseQnode(SMnode *pMnode, SQnodeObj *pObj) {
|
|||
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_QNODE, TSDB_QNODE_VER_NUMBER, sizeof(SQnodeObj) + TSDB_QNODE_RESERVE_SIZE);
|
||||
if (pRaw == NULL) goto QNODE_ENCODE_OVER;
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_QNODE, QNODE_VER_NUMBER, sizeof(SQnodeObj) + QNODE_RESERVE_SIZE);
|
||||
if (pRaw == NULL) goto _OVER;
|
||||
|
||||
int32_t dataPos = 0;
|
||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, QNODE_ENCODE_OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, QNODE_ENCODE_OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, QNODE_ENCODE_OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_QNODE_RESERVE_SIZE, QNODE_ENCODE_OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, QNODE_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
||||
QNODE_ENCODE_OVER:
|
||||
_OVER:
|
||||
if (terrno != 0) {
|
||||
mError("qnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||
sdbFreeRaw(pRaw);
|
||||
|
@ -104,28 +102,28 @@ static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) {
|
|||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
int8_t sver = 0;
|
||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto QNODE_DECODE_OVER;
|
||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||
|
||||
if (sver != TSDB_QNODE_VER_NUMBER) {
|
||||
if (sver != QNODE_VER_NUMBER) {
|
||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||
goto QNODE_DECODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
SSdbRow *pRow = sdbAllocRow(sizeof(SQnodeObj));
|
||||
if (pRow == NULL) goto QNODE_DECODE_OVER;
|
||||
if (pRow == NULL) goto _OVER;
|
||||
|
||||
SQnodeObj *pObj = sdbGetRowObj(pRow);
|
||||
if (pObj == NULL) goto QNODE_DECODE_OVER;
|
||||
if (pObj == NULL) goto _OVER;
|
||||
|
||||
int32_t dataPos = 0;
|
||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, QNODE_DECODE_OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, QNODE_DECODE_OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, QNODE_DECODE_OVER)
|
||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_QNODE_RESERVE_SIZE, QNODE_DECODE_OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||
SDB_GET_RESERVE(pRaw, dataPos, QNODE_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
||||
QNODE_DECODE_OVER:
|
||||
_OVER:
|
||||
if (terrno != 0) {
|
||||
mError("qnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||
taosMemoryFreeClear(pRow);
|
||||
|
@ -192,13 +190,13 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
SDCreateQnodeReq createReq = {0};
|
||||
createReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -219,13 +217,13 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
SDDropQnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -251,19 +249,19 @@ static int32_t mndCreateQnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
|||
qnodeObj.updateTime = qnodeObj.createdTime;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_QNODE, &pReq->rpcMsg);
|
||||
if (pTrans == NULL) goto CREATE_QNODE_OVER;
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
|
||||
if (mndSetCreateQnodeRedoLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
||||
if (mndSetCreateQnodeUndoLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
||||
if (mndSetCreateQnodeCommitLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
||||
if (mndSetCreateQnodeRedoActions(pTrans, pDnode, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
||||
if (mndSetCreateQnodeUndoActions(pTrans, pDnode, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_QNODE_OVER;
|
||||
if (mndSetCreateQnodeRedoLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateQnodeUndoLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateQnodeCommitLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateQnodeRedoActions(pTrans, pDnode, &qnodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateQnodeUndoActions(pTrans, pDnode, &qnodeObj) != 0) goto _OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
CREATE_QNODE_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
@ -276,9 +274,9 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
|
|||
SUserObj *pUser = NULL;
|
||||
SMCreateQnodeReq createReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto CREATE_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
mDebug("qnode:%d, start to create", createReq.dnodeId);
|
||||
|
@ -286,31 +284,31 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
|
|||
pObj = mndAcquireQnode(pMnode, createReq.dnodeId);
|
||||
if (pObj != NULL) {
|
||||
terrno = TSDB_CODE_MND_QNODE_ALREADY_EXIST;
|
||||
goto CREATE_QNODE_OVER;
|
||||
goto _OVER;
|
||||
} else if (terrno != TSDB_CODE_MND_QNODE_NOT_EXIST) {
|
||||
goto CREATE_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||
if (pDnode == NULL) {
|
||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||
goto CREATE_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
goto CREATE_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (mndCheckNodeAuth(pUser)) {
|
||||
goto CREATE_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndCreateQnode(pMnode, pReq, pDnode, &createReq);
|
||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
|
||||
CREATE_QNODE_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -318,7 +316,6 @@ CREATE_QNODE_OVER:
|
|||
mndReleaseQnode(pMnode, pObj);
|
||||
mndReleaseDnode(pMnode, pDnode);
|
||||
mndReleaseUser(pMnode, pUser);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -342,13 +339,13 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
|
|||
SDDropQnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -369,17 +366,17 @@ static int32_t mndDropQnode(SMnode *pMnode, SNodeMsg *pReq, SQnodeObj *pObj) {
|
|||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_QNODE, &pReq->rpcMsg);
|
||||
if (pTrans == NULL) goto DROP_QNODE_OVER;
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
|
||||
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) goto DROP_QNODE_OVER;
|
||||
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) goto DROP_QNODE_OVER;
|
||||
if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_QNODE_OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_QNODE_OVER;
|
||||
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||
if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
DROP_QNODE_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
@ -391,37 +388,37 @@ static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq) {
|
|||
SQnodeObj *pObj = NULL;
|
||||
SMDropQnodeReq dropReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto DROP_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
mDebug("qnode:%d, start to drop", dropReq.dnodeId);
|
||||
|
||||
if (dropReq.dnodeId <= 0) {
|
||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||
goto DROP_QNODE_OVER;
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pObj = mndAcquireQnode(pMnode, dropReq.dnodeId);
|
||||
if (pObj == NULL) {
|
||||
goto DROP_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
goto DROP_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (mndCheckNodeAuth(pUser)) {
|
||||
goto DROP_QNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndDropQnode(pMnode, pReq, pObj);
|
||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
|
||||
DROP_QNODE_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -434,36 +431,35 @@ DROP_QNODE_OVER:
|
|||
|
||||
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
||||
int32_t code = -1;
|
||||
SQnodeListReq qlistReq = {0};
|
||||
int32_t numOfRows = 0;
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SQnodeObj *pObj = NULL;
|
||||
SQnodeListReq qlistReq = {0};
|
||||
SQnodeListRsp qlistRsp = {0};
|
||||
|
||||
if (tDeserializeSQnodeListReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &qlistReq) != 0) {
|
||||
mError("invalid qnode list msg");
|
||||
mError("failed to parse qnode list req");
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto QNODE_LIST_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
qlistRsp.epSetList = taosArrayInit(5, sizeof(SEpSet));
|
||||
if (NULL == qlistRsp.epSetList) {
|
||||
mError("taosArrayInit epSet failed");
|
||||
mError("failed to alloc epSet while process qnode list req");
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto QNODE_LIST_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
while (1) {
|
||||
void *pIter = sdbFetch(pSdb, SDB_QNODE, NULL, (void **)&pObj);
|
||||
if (pIter == NULL) break;
|
||||
|
||||
SEpSet epSet = {0};
|
||||
strcpy(epSet.eps[0].fqdn, pObj->pDnode->fqdn);
|
||||
SEpSet epSet = {.numOfEps = 1};
|
||||
tstrncpy(epSet.eps[0].fqdn, pObj->pDnode->fqdn, TSDB_FQDN_LEN);
|
||||
epSet.eps[0].port = pObj->pDnode->port;
|
||||
epSet.numOfEps = 1;
|
||||
|
||||
taosArrayPush(qlistRsp.epSetList, &epSet);
|
||||
(void)taosArrayPush(qlistRsp.epSetList, &epSet);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
|
@ -477,7 +473,7 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
|||
void *pRsp = taosMemoryMalloc(rspLen);
|
||||
if (pRsp == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto QNODE_LIST_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
tSerializeSQnodeListRsp(pRsp, rspLen, &qlistRsp);
|
||||
|
@ -486,10 +482,8 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
|||
pReq->pRsp = pRsp;
|
||||
code = 0;
|
||||
|
||||
QNODE_LIST_OVER:
|
||||
|
||||
_OVER:
|
||||
tFreeSQnodeListRsp(&qlistRsp);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -503,46 +497,6 @@ static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndGetQnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "id");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "endpoint");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
pShow->numOfRows = sdbGetSize(pSdb, SDB_QNODE);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
|
|
@ -22,8 +22,6 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SShowReq *pReq);
|
|||
static void mndFreeShowObj(SShowObj *pShow);
|
||||
static SShowObj *mndAcquireShowObj(SMnode *pMnode, int64_t showId);
|
||||
static void mndReleaseShowObj(SShowObj *pShow, bool forceRemove);
|
||||
static int32_t mndProcessShowReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessRetrieveReq(SNodeMsg *pReq);
|
||||
static bool mndCheckRetrieveFinished(SShowObj *pShow);
|
||||
static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq);
|
||||
|
||||
|
@ -37,8 +35,6 @@ int32_t mndInitShow(SMnode *pMnode) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_SHOW, mndProcessShowReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_SHOW_RETRIEVE, mndProcessRetrieveReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_SYSTABLE_RETRIEVE, mndProcessRetrieveSysTableReq);
|
||||
return 0;
|
||||
}
|
||||
|
@ -117,67 +113,6 @@ static void mndReleaseShowObj(SShowObj *pShow, bool forceRemove) {
|
|||
taosCacheRelease(pMgmt->cache, (void **)(&pShow), forceRemove);
|
||||
}
|
||||
|
||||
static int32_t mndProcessShowReq(SNodeMsg *pReq) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SShowMgmt *pMgmt = &pMnode->showMgmt;
|
||||
int32_t code = -1;
|
||||
SShowReq showReq = {0};
|
||||
SShowRsp showRsp = {0};
|
||||
|
||||
if (tDeserializeSShowReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &showReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto SHOW_OVER;
|
||||
}
|
||||
|
||||
if (showReq.type <= TSDB_MGMT_TABLE_START || showReq.type >= TSDB_MGMT_TABLE_MAX) {
|
||||
terrno = TSDB_CODE_MND_INVALID_MSG_TYPE;
|
||||
goto SHOW_OVER;
|
||||
}
|
||||
|
||||
ShowMetaFp metaFp = pMgmt->metaFps[showReq.type];
|
||||
if (metaFp == NULL) {
|
||||
terrno = TSDB_CODE_MND_INVALID_MSG_TYPE;
|
||||
goto SHOW_OVER;
|
||||
}
|
||||
|
||||
SShowObj *pShow = mndCreateShowObj(pMnode, &showReq);
|
||||
if (pShow == NULL) {
|
||||
goto SHOW_OVER;
|
||||
}
|
||||
|
||||
showRsp.showId = pShow->id;
|
||||
showRsp.tableMeta.pSchemas = taosMemoryCalloc(TSDB_MAX_COLUMNS, sizeof(SSchema));
|
||||
if (showRsp.tableMeta.pSchemas == NULL) {
|
||||
mndReleaseShowObj(pShow, true);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto SHOW_OVER;
|
||||
}
|
||||
|
||||
code = (*metaFp)(pReq, pShow, &showRsp.tableMeta);
|
||||
mDebug("show:0x%" PRIx64 ", get meta finished, numOfRows:%d cols:%d showReq.type:%s, result:%s", pShow->id,
|
||||
pShow->numOfRows, pShow->numOfColumns, mndShowStr(showReq.type), tstrerror(code));
|
||||
|
||||
if (code == 0) {
|
||||
int32_t bufLen = tSerializeSShowRsp(NULL, 0, &showRsp);
|
||||
void *pBuf = rpcMallocCont(bufLen);
|
||||
tSerializeSShowRsp(pBuf, bufLen, &showRsp);
|
||||
pReq->rspLen = bufLen;
|
||||
pReq->pRsp = pBuf;
|
||||
mndReleaseShowObj(pShow, false);
|
||||
} else {
|
||||
mndReleaseShowObj(pShow, true);
|
||||
}
|
||||
|
||||
SHOW_OVER:
|
||||
if (code != 0) {
|
||||
mError("failed to process show-meta req since %s", terrstr());
|
||||
}
|
||||
|
||||
tFreeSShowReq(&showReq);
|
||||
tFreeSShowRsp(&showRsp);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndProcessRetrieveReq(SNodeMsg *pReq) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SShowMgmt *pMgmt = &pMnode->showMgmt;
|
||||
|
@ -458,11 +393,6 @@ void mndVacuumResult(char *data, int32_t numOfCols, int32_t rows, int32_t capaci
|
|||
}
|
||||
}
|
||||
|
||||
void mndAddShowMetaHandle(SMnode *pMnode, EShowType showType, ShowMetaFp fp) {
|
||||
SShowMgmt *pMgmt = &pMnode->showMgmt;
|
||||
pMgmt->metaFps[showType] = fp;
|
||||
}
|
||||
|
||||
void mndAddShowRetrieveHandle(SMnode *pMnode, EShowType showType, ShowRetrieveFp fp) {
|
||||
SShowMgmt *pMgmt = &pMnode->showMgmt;
|
||||
pMgmt->retrieveFps[showType] = fp;
|
||||
|
|
|
@ -58,7 +58,6 @@ int32_t mndInitSma(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_VND_CREATE_SMA_RSP, mndProcessVCreateSmaRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_VND_DROP_SMA_RSP, mndProcessVDropSmaRsp);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_INDEX, mndGetSmaMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_INDEX, mndRetrieveSma);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_INDEX, mndCancelGetNextSma);
|
||||
return sdbSetTable(pMnode->pSdb, table);
|
||||
|
|
|
@ -21,19 +21,18 @@
|
|||
#include "mndTrans.h"
|
||||
#include "mndUser.h"
|
||||
|
||||
#define TSDB_SNODE_VER_NUMBER 1
|
||||
#define TSDB_SNODE_RESERVE_SIZE 64
|
||||
#define SNODE_VER_NUMBER 1
|
||||
#define SNODE_RESERVE_SIZE 64
|
||||
|
||||
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj);
|
||||
static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw);
|
||||
static int32_t mndSnodeActionInsert(SSdb *pSdb, SSnodeObj *pObj);
|
||||
static int32_t mndSnodeActionDelete(SSdb *pSdb, SSnodeObj *pObj);
|
||||
static int32_t mndSnodeActionUpdate(SSdb *pSdb, SSnodeObj *pOld, SSnodeObj *pNew);
|
||||
static int32_t mndSnodeActionDelete(SSdb *pSdb, SSnodeObj *pObj);
|
||||
static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessCreateSnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndGetSnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextSnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
|
@ -51,7 +50,6 @@ int32_t mndInitSnode(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_SNODE_RSP, mndProcessCreateSnodeRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_DND_DROP_SNODE_RSP, mndProcessDropSnodeRsp);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_SNODE, mndGetSnodeMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_SNODE, mndRetrieveSnodes);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_SNODE, mndCancelGetNextSnode);
|
||||
|
||||
|
@ -61,11 +59,9 @@ int32_t mndInitSnode(SMnode *pMnode) {
|
|||
void mndCleanupSnode(SMnode *pMnode) {}
|
||||
|
||||
SEpSet mndAcquireEpFromSnode(SMnode *pMnode, const SSnodeObj *pSnode) {
|
||||
SEpSet epSet;
|
||||
memcpy(epSet.eps->fqdn, pSnode->pDnode->fqdn, 128);
|
||||
epSet.eps->port = pSnode->pDnode->port;
|
||||
epSet.numOfEps = 1;
|
||||
epSet.inUse = 0;
|
||||
SEpSet epSet = {.numOfEps = 1, .inUse = 0};
|
||||
memcpy(epSet.eps[0].fqdn, pSnode->pDnode->fqdn, TSDB_FQDN_LEN);
|
||||
epSet.eps[0].port = pSnode->pDnode->port;
|
||||
return epSet;
|
||||
}
|
||||
|
||||
|
@ -85,18 +81,18 @@ static void mndReleaseSnode(SMnode *pMnode, SSnodeObj *pObj) {
|
|||
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_SNODE, TSDB_SNODE_VER_NUMBER, sizeof(SSnodeObj) + TSDB_SNODE_RESERVE_SIZE);
|
||||
if (pRaw == NULL) goto SNODE_ENCODE_OVER;
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_SNODE, SNODE_VER_NUMBER, sizeof(SSnodeObj) + SNODE_RESERVE_SIZE);
|
||||
if (pRaw == NULL) goto _OVER;
|
||||
|
||||
int32_t dataPos = 0;
|
||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, SNODE_ENCODE_OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, SNODE_ENCODE_OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, SNODE_ENCODE_OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_SNODE_RESERVE_SIZE, SNODE_ENCODE_OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, SNODE_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
||||
SNODE_ENCODE_OVER:
|
||||
_OVER:
|
||||
if (terrno != 0) {
|
||||
mError("snode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||
sdbFreeRaw(pRaw);
|
||||
|
@ -111,28 +107,28 @@ static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) {
|
|||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
int8_t sver = 0;
|
||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto SNODE_DECODE_OVER;
|
||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||
|
||||
if (sver != TSDB_SNODE_VER_NUMBER) {
|
||||
if (sver != SNODE_VER_NUMBER) {
|
||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||
goto SNODE_DECODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
SSdbRow *pRow = sdbAllocRow(sizeof(SSnodeObj));
|
||||
if (pRow == NULL) goto SNODE_DECODE_OVER;
|
||||
if (pRow == NULL) goto _OVER;
|
||||
|
||||
SSnodeObj *pObj = sdbGetRowObj(pRow);
|
||||
if (pObj == NULL) goto SNODE_DECODE_OVER;
|
||||
if (pObj == NULL) goto _OVER;
|
||||
|
||||
int32_t dataPos = 0;
|
||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, SNODE_DECODE_OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, SNODE_DECODE_OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, SNODE_DECODE_OVER)
|
||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_SNODE_RESERVE_SIZE, SNODE_DECODE_OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||
SDB_GET_RESERVE(pRaw, dataPos, SNODE_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
||||
SNODE_DECODE_OVER:
|
||||
_OVER:
|
||||
if (terrno != 0) {
|
||||
mError("snode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||
taosMemoryFreeClear(pRow);
|
||||
|
@ -199,13 +195,13 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
SDCreateSnodeReq createReq = {0};
|
||||
createReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -226,13 +222,13 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
SDDropSnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -258,20 +254,20 @@ static int32_t mndCreateSnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
|||
snodeObj.updateTime = snodeObj.createdTime;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_SNODE, &pReq->rpcMsg);
|
||||
if (pTrans == NULL) goto CREATE_SNODE_OVER;
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
|
||||
|
||||
if (mndSetCreateSnodeRedoLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
||||
if (mndSetCreateSnodeUndoLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
||||
if (mndSetCreateSnodeCommitLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
||||
if (mndSetCreateSnodeRedoActions(pTrans, pDnode, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
||||
if (mndSetCreateSnodeUndoActions(pTrans, pDnode, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_SNODE_OVER;
|
||||
if (mndSetCreateSnodeRedoLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateSnodeUndoLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateSnodeCommitLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateSnodeRedoActions(pTrans, pDnode, &snodeObj) != 0) goto _OVER;
|
||||
if (mndSetCreateSnodeUndoActions(pTrans, pDnode, &snodeObj) != 0) goto _OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
CREATE_SNODE_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
@ -284,9 +280,9 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
|
|||
SUserObj *pUser = NULL;
|
||||
SMCreateSnodeReq createReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto CREATE_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
mDebug("snode:%d, start to create", createReq.dnodeId);
|
||||
|
@ -294,31 +290,31 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
|
|||
pObj = mndAcquireSnode(pMnode, createReq.dnodeId);
|
||||
if (pObj != NULL) {
|
||||
terrno = TSDB_CODE_MND_SNODE_ALREADY_EXIST;
|
||||
goto CREATE_SNODE_OVER;
|
||||
goto _OVER;
|
||||
} else if (terrno != TSDB_CODE_MND_SNODE_NOT_EXIST) {
|
||||
goto CREATE_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||
if (pDnode == NULL) {
|
||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||
goto CREATE_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
goto CREATE_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (mndCheckNodeAuth(pUser)) {
|
||||
goto CREATE_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndCreateSnode(pMnode, pReq, pDnode, &createReq);
|
||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
|
||||
CREATE_SNODE_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mError("snode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||
return -1;
|
||||
|
@ -327,7 +323,6 @@ CREATE_SNODE_OVER:
|
|||
mndReleaseSnode(pMnode, pObj);
|
||||
mndReleaseDnode(pMnode, pDnode);
|
||||
mndReleaseUser(pMnode, pUser);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -351,13 +346,13 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
|
|||
SDDropSnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = pDnode->id;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
|
@ -378,18 +373,18 @@ static int32_t mndDropSnode(SMnode *pMnode, SNodeMsg *pReq, SSnodeObj *pObj) {
|
|||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_SNODE, &pReq->rpcMsg);
|
||||
if (pTrans == NULL) goto DROP_SNODE_OVER;
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
|
||||
|
||||
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) goto DROP_SNODE_OVER;
|
||||
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) goto DROP_SNODE_OVER;
|
||||
if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_SNODE_OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_SNODE_OVER;
|
||||
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||
if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
DROP_SNODE_OVER:
|
||||
_OVER:
|
||||
mndTransDrop(pTrans);
|
||||
return code;
|
||||
}
|
||||
|
@ -401,37 +396,37 @@ static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq) {
|
|||
SSnodeObj *pObj = NULL;
|
||||
SMDropSnodeReq dropReq = {0};
|
||||
|
||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto DROP_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
mDebug("snode:%d, start to drop", dropReq.dnodeId);
|
||||
|
||||
if (dropReq.dnodeId <= 0) {
|
||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||
goto DROP_SNODE_OVER;
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pObj = mndAcquireSnode(pMnode, dropReq.dnodeId);
|
||||
if (pObj == NULL) {
|
||||
goto DROP_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||
if (pUser == NULL) {
|
||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||
goto DROP_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (mndCheckNodeAuth(pUser)) {
|
||||
goto DROP_SNODE_OVER;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndDropSnode(pMnode, pReq, pObj);
|
||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
|
||||
DROP_SNODE_OVER:
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||
mError("snode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||
}
|
||||
|
@ -452,46 +447,6 @@ static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndGetSnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
strcpy(pSchema[cols].name, "id");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "endpoint");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
pShow->numOfRows = sdbGetSize(pSdb, SDB_SNODE);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
|
|
@ -39,7 +39,6 @@ static int32_t mndProcessVCreateStbRsp(SNodeMsg *pRsp);
|
|||
static int32_t mndProcessVAlterStbRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessVDropStbRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessTableMetaReq(SNodeMsg *pReq);
|
||||
static int32_t mndGetStbMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextStb(SMnode *pMnode, void *pIter);
|
||||
|
||||
|
@ -60,7 +59,6 @@ int32_t mndInitStb(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_VND_DROP_STB_RSP, mndProcessVDropStbRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_TABLE_META, mndProcessTableMetaReq);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_STB, mndGetStbMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_STB, mndRetrieveStb);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_STB, mndCancelGetNextStb);
|
||||
|
||||
|
@ -508,32 +506,32 @@ static int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
|
|||
}
|
||||
|
||||
for (int32_t i = 0; i < pCreate->numOfColumns; ++i) {
|
||||
SField *pField = taosArrayGet(pCreate->pColumns, i);
|
||||
SField *pField1 = taosArrayGet(pCreate->pColumns, i);
|
||||
if (pField->type < 0) {
|
||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||
return -1;
|
||||
}
|
||||
if (pField->bytes <= 0) {
|
||||
if (pField1->bytes <= 0) {
|
||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||
return -1;
|
||||
}
|
||||
if (pField->name[0] == 0) {
|
||||
if (pField1->name[0] == 0) {
|
||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pCreate->numOfTags; ++i) {
|
||||
SField *pField = taosArrayGet(pCreate->pTags, i);
|
||||
if (pField->type < 0) {
|
||||
SField *pField1 = taosArrayGet(pCreate->pTags, i);
|
||||
if (pField1->type < 0) {
|
||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||
return -1;
|
||||
}
|
||||
if (pField->bytes <= 0) {
|
||||
if (pField1->bytes <= 0) {
|
||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||
return -1;
|
||||
}
|
||||
if (pField->name[0] == 0) {
|
||||
if (pField1->name[0] == 0) {
|
||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1315,7 +1313,6 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
|
|||
SSdb *pSdb = pMnode->pSdb;
|
||||
SVgObj *pVgroup = NULL;
|
||||
void *pIter = NULL;
|
||||
int32_t contLen;
|
||||
|
||||
while (1) {
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
|
@ -1628,56 +1625,6 @@ static int32_t mndGetNumOfStbs(SMnode *pMnode, char *dbName, int32_t *pNumOfStbs
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndGetStbMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
if (mndGetNumOfStbs(pMnode, pShow->db, &pShow->numOfRows) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "name");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "columns");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "tags");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
pShow->numOfRows = sdbGetSize(pSdb, SDB_STB);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mndExtractTableName(char *tableId, char *name) {
|
||||
int32_t pos = -1;
|
||||
int32_t num = 0;
|
||||
|
|
|
@ -58,7 +58,6 @@ int32_t mndInitStream(SMnode *pMnode) {
|
|||
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM, mndProcessDropStreamReq);*/
|
||||
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM_RSP, mndProcessDropStreamInRsp);*/
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_TP, mndGetStreamMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveStream);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TP, mndCancelGetNextStream);
|
||||
|
||||
|
|
|
@ -105,7 +105,6 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
|
|||
if (walEndSnapshot(pWal) < 0) {
|
||||
goto WAL_RESTORE_OVER;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
code = 0;
|
||||
|
@ -129,7 +128,9 @@ int32_t mndInitSync(SMnode *pMnode) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (pMnode->selfId == 1) {
|
||||
pMgmt->state = TAOS_SYNC_STATE_LEADER;
|
||||
}
|
||||
pMgmt->pSyncNode = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ int32_t mndInitTopic(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_DROP_TOPIC, mndProcessDropTopicReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_VND_DROP_TOPIC_RSP, mndProcessDropTopicInRsp);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_TP, mndGetTopicMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveTopic);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TP, mndCancelGetNextTopic);
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ int32_t mndInitTrans(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_TRANS_TIMER, mndProcessTransReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_KILL_TRANS, mndProcessKillTransReq);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndGetTransMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndCancelGetNextTrans);
|
||||
return sdbSetTable(pMnode->pSdb, table);
|
||||
|
|
|
@ -54,7 +54,6 @@ int32_t mndInitUser(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_DROP_USER, mndProcessDropUserReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_GET_USER_AUTH, mndProcessGetUserAuthReq);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_USER, mndGetUserMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_USER, mndRetrieveUsers);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_USER, mndCancelGetNextUser);
|
||||
return sdbSetTable(pMnode->pSdb, table);
|
||||
|
|
|
@ -38,7 +38,6 @@ static int32_t mndProcessCompactVnodeRsp(SNodeMsg *pRsp);
|
|||
static int32_t mndGetVgroupMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextVgroup(SMnode *pMnode, void *pIter);
|
||||
static int32_t mndGetVnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextVnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
|
@ -57,10 +56,8 @@ int32_t mndInitVgroup(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_DND_SYNC_VNODE_RSP, mndProcessSyncVnodeRsp);
|
||||
mndSetMsgHandle(pMnode, TDMT_DND_COMPACT_VNODE_RSP, mndProcessCompactVnodeRsp);
|
||||
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_VGROUP, mndGetVgroupMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_VGROUP, mndRetrieveVgroups);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_VGROUP, mndCancelGetNextVgroup);
|
||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_VNODES, mndGetVnodeMeta);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_VNODES, mndRetrieveVnodes);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_VNODES, mndCancelGetNextVnode);
|
||||
|
||||
|
@ -656,46 +653,6 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) {
|
|||
return numOfVnodes;
|
||||
}
|
||||
|
||||
static int32_t mndGetVnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "vgId");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 12 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "status");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
pShow->numOfColumns = cols;
|
||||
|
||||
pShow->offset[0] = 0;
|
||||
for (int32_t i = 1; i < cols; ++i) {
|
||||
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
|
||||
}
|
||||
|
||||
int32_t dnodeId = 0;
|
||||
if (pShow->payloadLen > 0) {
|
||||
dnodeId = atoi(pShow->payload);
|
||||
}
|
||||
|
||||
pShow->replica = dnodeId;
|
||||
pShow->numOfRows = mndGetVnodesNum(pMnode, dnodeId);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
|
|
@ -215,7 +215,6 @@ static int32_t mndInitSteps(SMnode *pMnode, bool deploy) {
|
|||
} else {
|
||||
if (mndAllocStep(pMnode, "mnode-sdb-read", mndReadSdb, NULL) != 0) return -1;
|
||||
}
|
||||
// if (mndAllocStep(pMnode, "mnode-timer", mndInitTimer, NULL) != 0) return -1;
|
||||
if (mndAllocStep(pMnode, "mnode-profile", mndInitProfile, mndCleanupProfile) != 0) return -1;
|
||||
if (mndAllocStep(pMnode, "mnode-show", mndInitShow, mndCleanupShow) != 0) return -1;
|
||||
if (mndAllocStep(pMnode, "mnode-query", mndInitQuery, mndCleanupQuery) != 0) return -1;
|
||||
|
@ -272,6 +271,7 @@ static void mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
|
|||
pMnode->selfIndex = pOption->selfIndex;
|
||||
memcpy(&pMnode->replicas, pOption->replicas, sizeof(SReplica) * TSDB_MAX_REPLICA);
|
||||
pMnode->msgCb = pOption->msgCb;
|
||||
pMnode->selfId = pOption->replicas[pOption->selfIndex].id;
|
||||
}
|
||||
|
||||
SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
enable_testing()
|
||||
|
||||
add_subdirectory(user)
|
||||
add_subdirectory(acct)
|
||||
add_subdirectory(trans)
|
||||
add_subdirectory(qnode)
|
||||
add_subdirectory(snode)
|
||||
add_subdirectory(bnode)
|
||||
add_subdirectory(show)
|
||||
add_subdirectory(profile)
|
||||
#add_subdirectory(user)
|
||||
#add_subdirectory(acct)
|
||||
#add_subdirectory(trans)
|
||||
#add_subdirectory(qnode)
|
||||
#add_subdirectory(snode)
|
||||
#add_subdirectory(bnode)
|
||||
#add_subdirectory(show)
|
||||
#add_subdirectory(profile)
|
||||
add_subdirectory(dnode)
|
||||
add_subdirectory(mnode)
|
||||
#add_subdirectory(mnode)
|
||||
add_subdirectory(db)
|
||||
add_subdirectory(stb)
|
||||
add_subdirectory(sma)
|
||||
add_subdirectory(func)
|
||||
add_subdirectory(topic)
|
||||
#add_subdirectory(sma)
|
||||
#add_subdirectory(func)
|
||||
#add_subdirectory(topic)
|
||||
|
|
|
@ -55,9 +55,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -68,9 +68,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -90,9 +90,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 1;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -124,9 +124,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -148,9 +148,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
|||
SMDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -169,9 +169,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
|||
SMDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -185,9 +185,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
server2.Stop();
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
|
@ -200,9 +200,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -214,9 +214,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
|||
SMDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -235,9 +235,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -255,9 +255,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
|||
SMDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
server2.Stop();
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||
|
@ -270,9 +270,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -284,9 +284,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
|||
SMDropBnodeReq dropReq = {0};
|
||||
dropReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
@ -305,9 +305,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
|||
SMCreateBnodeReq createReq = {0};
|
||||
createReq.dnodeId = 2;
|
||||
|
||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
||||
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
||||
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||
|
||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
ASSERT_NE(pRsp, nullptr);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue