diff --git a/include/common/systable.h b/include/common/systable.h index 102465c8c2006d9026a22c67909008b03a7db3ac..8b29525db384744adac072a0cda3b07e4f66012c 100644 --- a/include/common/systable.h +++ b/include/common/systable.h @@ -27,7 +27,7 @@ extern "C" { #define TSDB_INS_TABLE_MNODES "ins_mnodes" #define TSDB_INS_TABLE_MODULES "ins_modules" #define TSDB_INS_TABLE_QNODES "ins_qnodes" -#define TSDB_INS_TABLE_BNODES "ins_bnodes" +#define TSDB_INS_TABLE_BNODES "ins_bnodes" // no longer used #define TSDB_INS_TABLE_SNODES "ins_snodes" #define TSDB_INS_TABLE_CLUSTER "ins_cluster" #define TSDB_INS_TABLE_DATABASES "ins_databases" diff --git a/include/common/tglobal.h b/include/common/tglobal.h index fd0521af3b96933dec7064483578e06d00731ce8..2d196be44cd6bd626541551a322dc962370a2c40 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -51,7 +51,6 @@ extern int32_t tsMnodeShmSize; extern int32_t tsVnodeShmSize; extern int32_t tsQnodeShmSize; extern int32_t tsSnodeShmSize; -extern int32_t tsBnodeShmSize; extern int32_t tsNumOfShmThreads; // queue & threads diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 5e2ca8896a9b304729de6548100446d30e4d0ec5..e25fbe6201fcd6c51bff78f3e098a3fb9d0b60b4 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -95,7 +95,7 @@ typedef enum _mgmt_table { TSDB_MGMT_TABLE_MODULE, TSDB_MGMT_TABLE_QNODE, TSDB_MGMT_TABLE_SNODE, - TSDB_MGMT_TABLE_BNODE, + TSDB_MGMT_TABLE_BNODE, // no longer used TSDB_MGMT_TABLE_CLUSTER, TSDB_MGMT_TABLE_DB, TSDB_MGMT_TABLE_FUNC, @@ -1485,11 +1485,10 @@ int32_t tDeserializeSDCfgDnodeReq(void* buf, int32_t bufLen, SDCfgDnodeReq* pReq typedef struct { int32_t dnodeId; } SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq, SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq, - SMCreateSnodeReq, SMDropSnodeReq, SDCreateSnodeReq, SDDropSnodeReq, SMCreateBnodeReq, SMDropBnodeReq, - SDCreateBnodeReq, SDDropBnodeReq; + SMCreateSnodeReq, SMDropSnodeReq, SDCreateSnodeReq, SDDropSnodeReq; -int32_t tSerializeSCreateDropMQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq); -int32_t tDeserializeSCreateDropMQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq); +int32_t tSerializeSCreateDropMQSNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq); +int32_t tDeserializeSCreateDropMQSNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq); typedef struct { int8_t replica; diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 3f917ff0d1665d90de079dfc3eae884412ed0e7f..1a8865bf83028a6d7dda87702d25de18e662e653 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -74,8 +74,8 @@ enum { TD_DEF_MSG_TYPE(TDMT_DND_DROP_QNODE, "dnode-drop-qnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_CREATE_SNODE, "dnode-create-snode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_DROP_SNODE, "dnode-drop-snode", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_DND_CREATE_BNODE, "dnode-create-bnode", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_DND_DROP_BNODE, "dnode-drop-bnode", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_DND_CREATE_BNODE, "dnode-create-bnode", NULL, NULL) // no longer used + TD_DEF_MSG_TYPE(TDMT_DND_DROP_BNODE, "dnode-drop-bnode", NULL, NULL) // no longer used TD_DEF_MSG_TYPE(TDMT_DND_CREATE_VNODE, "create-vnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_DROP_VNODE, "drop-vnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_SERVER_STATUS, "server-status", NULL, NULL) @@ -107,9 +107,9 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_CREATE_SNODE, "create-snode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_ALTER_SNODE, "alter-snode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_DROP_SNODE, "drop-snode", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_CREATE_BNODE, "create-bnode", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_ALTER_BNODE, "alter-bnode", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_DROP_BNODE, "drop-bnode", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CREATE_BNODE, "create-bnode", NULL, NULL) // no longer used + TD_DEF_MSG_TYPE(TDMT_MND_ALTER_BNODE, "alter-bnode", NULL, NULL) // no longer used + TD_DEF_MSG_TYPE(TDMT_MND_DROP_BNODE, "drop-bnode", NULL, NULL) // no longer used TD_DEF_MSG_TYPE(TDMT_MND_CREATE_DB, "create-db", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_DROP_DB, "drop-db", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_USE_DB, "use-db", NULL, NULL) @@ -243,7 +243,6 @@ enum { TD_DEF_MSG_TYPE(TDMT_MON_VM_INFO, "monitor-vinfo", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MON_QM_INFO, "monitor-qinfo", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MON_SM_INFO, "monitor-sinfo", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MON_BM_INFO, "monitor-binfo", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MON_VM_LOAD, "monitor-vload", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MON_MM_LOAD, "monitor-mload", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MON_QM_LOAD, "monitor-qload", NULL, NULL) diff --git a/include/dnode/bnode/bnode.h b/include/dnode/bnode/bnode.h deleted file mode 100644 index d5958d432bf494b82bccd608364a461302327a2d..0000000000000000000000000000000000000000 --- a/include/dnode/bnode/bnode.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#ifndef _TD_BNODE_H_ -#define _TD_BNODE_H_ - -#include "tmsgcb.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* ------------------------ TYPES EXPOSED ------------------------ */ -typedef struct SBnode SBnode; - -typedef struct { -#ifdef WINDOWS - size_t avoidCompilationErrors; -#endif -} SBnodeLoad; - -typedef struct { - SMsgCb msgCb; -} SBnodeOpt; - -/* ------------------------ SBnode ------------------------ */ -/** - * @brief Start one Bnode in Dnode. - * - * @param path Path of the bnode. - * @param pOption Option of the bnode. - * @return SBnode* The bnode object. - */ -SBnode *bndOpen(const char *path, const SBnodeOpt *pOption); - -/** - * @brief Stop Bnode in Dnode. - * - * @param pBnode The bnode object to close. - */ -void bndClose(SBnode *pBnode); - -/** - * @brief Get the statistical information of Bnode - * - * @param pBnode The bnode object. - * @param pLoad Statistics of the bnode. - * @return int32_t 0 for success, -1 for failure. - */ -int32_t bndGetLoad(SBnode *pBnode, SBnodeLoad *pLoad); - -/** - * @brief Process a query message. - * - * @param pBnode The bnode object. - * @param pMsgs The array of SRpcMsg - * @return int32_t 0 for success, -1 for failure - */ -int32_t bndProcessWMsgs(SBnode *pBnode, SArray *pMsgs); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_BNODE_H_*/ \ No newline at end of file diff --git a/include/libs/monitor/monitor.h b/include/libs/monitor/monitor.h index 30254d61a9fd0b53509b89eab01d63422f5f835e..12e465e0f88d68ba494a349c9dfa464928ee270b 100644 --- a/include/libs/monitor/monitor.h +++ b/include/libs/monitor/monitor.h @@ -80,7 +80,6 @@ typedef struct { int8_t has_mnode; int8_t has_qnode; int8_t has_snode; - int8_t has_bnode; SMonDiskDesc logdir; SMonDiskDesc tempdir; } SMonDnodeInfo; diff --git a/include/util/tdef.h b/include/util/tdef.h index 2103dc928e48fecb14bd4c40c82fab12b0b39e69..bb7f908ad40a5bd6e3f48064bf3dad2781c65cbc 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -483,7 +483,6 @@ enum { #define QNODE_HANDLE -1 #define SNODE_HANDLE -2 #define VNODE_HANDLE -3 -#define BNODE_HANDLE -4 #define CLIENT_HANDLE -5 #define TSDB_CONFIG_OPTION_LEN 32 diff --git a/source/common/src/systable.c b/source/common/src/systable.c index a45f7b2913938ae9884940f45631d0f7c49ed1e8..28a4732abd98d52976cc75a0d7e26320f7aeb5a2 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -62,12 +62,6 @@ static const SSysDbTableSchema snodesSchema[] = { {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, }; -static const SSysDbTableSchema bnodesSchema[] = { - {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, - {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, - {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, -}; - static const SSysDbTableSchema clusterSchema[] = { {.name = "id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true}, {.name = "name", .bytes = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, @@ -277,7 +271,6 @@ static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema), true}, {TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema), true}, // {TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)}, - // {TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(bnodesSchema)}, {TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema), true}, {TSDB_INS_TABLE_DATABASES, userDBSchema, tListLen(userDBSchema), false}, {TSDB_INS_TABLE_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema), false}, diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 56daa4075a4ca244da17bbd6d32a51b906856393..2b64d3f1eed3fdf0d9a378881bdd9a6bc0e8a8ee 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -46,7 +46,6 @@ int32_t tsMnodeShmSize = TSDB_MAX_MSG_SIZE * 2 + 1024; int32_t tsVnodeShmSize = TSDB_MAX_MSG_SIZE * 10 + 1024; int32_t tsQnodeShmSize = TSDB_MAX_MSG_SIZE * 4 + 1024; int32_t tsSnodeShmSize = TSDB_MAX_MSG_SIZE * 4 + 1024; -int32_t tsBnodeShmSize = TSDB_MAX_MSG_SIZE * 4 + 1024; int32_t tsNumOfShmThreads = 1; // queue & threads @@ -358,7 +357,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "vnodeShmSize", tsVnodeShmSize, TSDB_MAX_MSG_SIZE * 2 + 1024, INT32_MAX, 0) != 0) return -1; if (cfgAddInt32(pCfg, "qnodeShmSize", tsQnodeShmSize, TSDB_MAX_MSG_SIZE * 2 + 1024, INT32_MAX, 0) != 0) return -1; if (cfgAddInt32(pCfg, "snodeShmSize", tsSnodeShmSize, TSDB_MAX_MSG_SIZE * 2 + 1024, INT32_MAX, 0) != 0) return -1; - if (cfgAddInt32(pCfg, "bnodeShmSize", tsBnodeShmSize, TSDB_MAX_MSG_SIZE * 2 + 1024, INT32_MAX, 0) != 0) return -1; if (cfgAddInt32(pCfg, "numOfShmThreads", tsNumOfShmThreads, 1, 1024, 0) != 0) return -1; tsNumOfRpcThreads = tsNumOfCores / 2; @@ -707,7 +705,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsVnodeShmSize = cfgGetItem(pCfg, "vnodeShmSize")->i32; tsQnodeShmSize = cfgGetItem(pCfg, "qnodeShmSize")->i32; tsSnodeShmSize = cfgGetItem(pCfg, "snodeShmSize")->i32; - tsBnodeShmSize = cfgGetItem(pCfg, "bnodeShmSize")->i32; tsNumOfRpcThreads = cfgGetItem(pCfg, "numOfRpcThreads")->i32; tsNumOfCommitThreads = cfgGetItem(pCfg, "numOfCommitThreads")->i32; @@ -780,12 +777,6 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { } break; } - case 'b': { - if (strcasecmp("bnodeShmSize", name) == 0) { - tsBnodeShmSize = cfgGetItem(pCfg, "bnodeShmSize")->i32; - } - break; - } case 'c': { if (strcasecmp("charset", name) == 0) { const char *locale = cfgGetItem(pCfg, "locale")->str; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 55e5616dd501c2b947ccabd28b7864c8bf440614..1f0023278f032081e5480d07b43cb30f691997a4 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1448,7 +1448,7 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) { taosHashCleanup(pRsp->writeDbs); } -int32_t tSerializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { +int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); @@ -1461,7 +1461,7 @@ int32_t tSerializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnod return tlen; } -int32_t tDeserializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { +int32_t tDeserializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); diff --git a/source/dnode/CMakeLists.txt b/source/dnode/CMakeLists.txt index 87e4c5fc4623365d5fbedd605ba485443c1fffbf..035cea2dc4dc2c19642913ca2ff741a83fcc36be 100644 --- a/source/dnode/CMakeLists.txt +++ b/source/dnode/CMakeLists.txt @@ -2,5 +2,4 @@ add_subdirectory(mnode) add_subdirectory(vnode) add_subdirectory(qnode) add_subdirectory(snode) -add_subdirectory(bnode) add_subdirectory(mgmt) \ No newline at end of file diff --git a/source/dnode/bnode/CMakeLists.txt b/source/dnode/bnode/CMakeLists.txt deleted file mode 100644 index 77f4d15ad2b2936ea3852e038efc1101fd74619d..0000000000000000000000000000000000000000 --- a/source/dnode/bnode/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -aux_source_directory(src BNODE_SRC) -add_library(bnode STATIC ${BNODE_SRC}) -target_include_directories( - bnode - PUBLIC "${TD_SOURCE_DIR}/include/dnode/bnode" - private "${CMAKE_CURRENT_SOURCE_DIR}/inc" -) -target_link_libraries( - bnode - PRIVATE transport - PRIVATE os - PRIVATE common - PRIVATE util -) \ No newline at end of file diff --git a/source/dnode/bnode/inc/bndInt.h b/source/dnode/bnode/inc/bndInt.h deleted file mode 100644 index e611d230a329ad597ba5b7ee634c3246b6c44294..0000000000000000000000000000000000000000 --- a/source/dnode/bnode/inc/bndInt.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#ifndef _TD_BNODE_INT_H_ -#define _TD_BNODE_INT_H_ - -#include "os.h" - -#include "tarray.h" -#include "tlog.h" -#include "tmsg.h" -#include "trpc.h" - -#include "bnode.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SBnode { - SMsgCb msgCb; -} SBnode; - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_BNODE_INT_H_*/ \ No newline at end of file diff --git a/source/dnode/bnode/src/bnode.c b/source/dnode/bnode/src/bnode.c deleted file mode 100644 index b9c41ebf4370fb070a39a7d76dab61742a174cf6..0000000000000000000000000000000000000000 --- a/source/dnode/bnode/src/bnode.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#include "bndInt.h" - -SBnode *bndOpen(const char *path, const SBnodeOpt *pOption) { - SBnode *pBnode = taosMemoryCalloc(1, sizeof(SBnode)); - pBnode->msgCb = pOption->msgCb; - return pBnode; -} - -void bndClose(SBnode *pBnode) { taosMemoryFree(pBnode); } - -int32_t bndGetLoad(SBnode *pBnode, SBnodeLoad *pLoad) { return 0; } - -int32_t bndProcessWMsgs(SBnode *pBnode, SArray *pMsgs) { return 0; } diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt index 581686ba904001b80638efd9ab225c3f68e91e09..423028b1679eb6f663d80dfb0df09fc0e2fe10ec 100644 --- a/source/dnode/mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/CMakeLists.txt @@ -1,6 +1,5 @@ add_subdirectory(node_mgmt) add_subdirectory(node_util) -add_subdirectory(mgmt_bnode) add_subdirectory(mgmt_mnode) add_subdirectory(mgmt_qnode) add_subdirectory(mgmt_snode) diff --git a/source/dnode/mgmt/mgmt_bnode/CMakeLists.txt b/source/dnode/mgmt/mgmt_bnode/CMakeLists.txt deleted file mode 100644 index 0a6cf52fb86dfd7ac24332631f2b9a1ee6c2c572..0000000000000000000000000000000000000000 --- a/source/dnode/mgmt/mgmt_bnode/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -aux_source_directory(src MGMT_BNODE) -add_library(mgmt_bnode STATIC ${MGMT_BNODE}) -target_include_directories( - mgmt_bnode - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" -) -target_link_libraries( - mgmt_bnode node_util -) \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_bnode/inc/bmInt.h b/source/dnode/mgmt/mgmt_bnode/inc/bmInt.h deleted file mode 100644 index c05ad46189a823eb9a1cc216181c653aea4ddec2..0000000000000000000000000000000000000000 --- a/source/dnode/mgmt/mgmt_bnode/inc/bmInt.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#ifndef _TD_DND_BNODE_INT_H_ -#define _TD_DND_BNODE_INT_H_ - -#include "dmUtil.h" - -#include "bnode.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SBnodeMgmt { - SDnodeData *pData; - SBnode *pBnode; - SMsgCb msgCb; - const char *path; - const char *name; - SMultiWorker writeWorker; - SSingleWorker monitorWorker; -} SBnodeMgmt; - -// bmHandle.c -SArray *bmGetMsgHandles(); -int32_t bmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg); -int32_t bmProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg); -int32_t bmProcessGetMonBmInfoReq(SBnodeMgmt *pMgmt, SRpcMsg *pMsg); - -// bmWorker.c -int32_t bmStartWorker(SBnodeMgmt *pMgmt); -void bmStopWorker(SBnodeMgmt *pMgmt); -int32_t bmPutNodeMsgToWriteQueue(SBnodeMgmt *pMgmt, SRpcMsg *pMsg); -int32_t bmPutNodeMsgToMonitorQueue(SBnodeMgmt *pMgmt, SRpcMsg *pMsg); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_BNODE_INT_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_bnode/src/bmHandle.c b/source/dnode/mgmt/mgmt_bnode/src/bmHandle.c deleted file mode 100644 index 9ec445c69c06b7ba91a3cc44caf2d008c49fb704..0000000000000000000000000000000000000000 --- a/source/dnode/mgmt/mgmt_bnode/src/bmHandle.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#define _DEFAULT_SOURCE -#include "bmInt.h" - -void bmGetMonitorInfo(SBnodeMgmt *pMgmt, SMonBmInfo *bmInfo) {} - -int32_t bmProcessGetMonBmInfoReq(SBnodeMgmt *pMgmt, SRpcMsg *pMsg) { - SMonBmInfo bmInfo = {0}; - bmGetMonitorInfo(pMgmt, &bmInfo); - dmGetMonitorSystemInfo(&bmInfo.sys); - monGetLogs(&bmInfo.log); - - int32_t rspLen = tSerializeSMonBmInfo(NULL, 0, &bmInfo); - if (rspLen < 0) { - terrno = TSDB_CODE_INVALID_MSG; - return -1; - } - - void *pRsp = rpcMallocCont(rspLen); - if (pRsp == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - - tSerializeSMonBmInfo(pRsp, rspLen, &bmInfo); - pMsg->info.rsp = pRsp; - pMsg->info.rspLen = rspLen; - tFreeSMonBmInfo(&bmInfo); - return 0; -} - -int32_t bmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { - SDCreateBnodeReq createReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pMsg->pCont, pMsg->contLen, &createReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - return -1; - } - - if (pInput->pData->dnodeId != 0 && createReq.dnodeId != pInput->pData->dnodeId) { - terrno = TSDB_CODE_INVALID_OPTION; - dError("failed to create bnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pInput->pData->dnodeId); - return -1; - } - - bool deployed = true; - if (dmWriteFile(pInput->path, pInput->name, deployed) != 0) { - dError("failed to write bnode file since %s", terrstr()); - return -1; - } - - return 0; -} - -int32_t bmProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { - SDDropBnodeReq dropReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - return -1; - } - - if (pInput->pData->dnodeId != 0 && dropReq.dnodeId != pInput->pData->dnodeId) { - terrno = TSDB_CODE_INVALID_OPTION; - dError("failed to drop bnode since %s", terrstr()); - return -1; - } - - bool deployed = false; - if (dmWriteFile(pInput->path, pInput->name, deployed) != 0) { - dError("failed to write bnode file since %s", terrstr()); - return -1; - } - - return 0; -} - -SArray *bmGetMsgHandles() { - int32_t code = -1; - SArray *pArray = taosArrayInit(2, sizeof(SMgmtHandle)); - if (pArray == NULL) goto _OVER; - - if (dmSetMgmtHandle(pArray, TDMT_MON_BM_INFO, bmPutNodeMsgToMonitorQueue, 0) == NULL) goto _OVER; - - code = 0; -_OVER: - if (code != 0) { - taosArrayDestroy(pArray); - return NULL; - } else { - return pArray; - } -} diff --git a/source/dnode/mgmt/mgmt_bnode/src/bmInt.c b/source/dnode/mgmt/mgmt_bnode/src/bmInt.c deleted file mode 100644 index 2c5d23cae98e98645ff30ba751f2e8a0672682d1..0000000000000000000000000000000000000000 --- a/source/dnode/mgmt/mgmt_bnode/src/bmInt.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#define _DEFAULT_SOURCE -#include "bmInt.h" - -static int32_t bmRequire(const SMgmtInputOpt *pInput, bool *required) { - return dmReadFile(pInput->path, pInput->name, required); -} - -static void bmInitOption(SBnodeMgmt *pMgmt, SBnodeOpt *pOption) { pOption->msgCb = pMgmt->msgCb; } - -static void bmClose(SBnodeMgmt *pMgmt) { - if (pMgmt->pBnode != NULL) { - bmStopWorker(pMgmt); - bndClose(pMgmt->pBnode); - pMgmt->pBnode = NULL; - } - - taosMemoryFree(pMgmt); -} - -int32_t bmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { - SBnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SBnodeMgmt)); - if (pMgmt == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - - pMgmt->pData = pInput->pData; - pMgmt->path = pInput->path; - pMgmt->name = pInput->name; - pMgmt->msgCb = pInput->msgCb; - pMgmt->msgCb.mgmt = pMgmt; - - SBnodeOpt option = {0}; - bmInitOption(pMgmt, &option); - pMgmt->pBnode = bndOpen(pMgmt->path, &option); - if (pMgmt->pBnode == NULL) { - dError("failed to open bnode since %s", terrstr()); - bmClose(pMgmt); - return -1; - } - tmsgReportStartup("bnode-impl", "initialized"); - - if (bmStartWorker(pMgmt) != 0) { - dError("failed to start bnode worker since %s", terrstr()); - bmClose(pMgmt); - return -1; - } - tmsgReportStartup("bnode-worker", "initialized"); - - pOutput->pMgmt = pMgmt; - return 0; -} - -SMgmtFunc bmGetMgmtFunc() { - SMgmtFunc mgmtFunc = {0}; - mgmtFunc.openFp = bmOpen; - mgmtFunc.closeFp = (NodeCloseFp)bmClose; - mgmtFunc.createFp = (NodeCreateFp)bmProcessCreateReq; - mgmtFunc.dropFp = (NodeDropFp)bmProcessDropReq; - mgmtFunc.requiredFp = bmRequire; - mgmtFunc.getHandlesFp = bmGetMsgHandles; - - return mgmtFunc; -} diff --git a/source/dnode/mgmt/mgmt_bnode/src/bmWorker.c b/source/dnode/mgmt/mgmt_bnode/src/bmWorker.c deleted file mode 100644 index 08c9edd854d6a2fa5b1e8ffe98078c86d6436777..0000000000000000000000000000000000000000 --- a/source/dnode/mgmt/mgmt_bnode/src/bmWorker.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#define _DEFAULT_SOURCE -#include "bmInt.h" - -static void bmSendErrorRsp(SRpcMsg *pMsg, int32_t code) { - SRpcMsg rsp = {.code = code, .info = pMsg->info}; - tmsgSendRsp(&rsp); - - dTrace("msg:%p, is freed", pMsg); - rpcFreeCont(pMsg->pCont); - taosFreeQitem(pMsg); -} - -static void bmSendErrorRsps(STaosQall *qall, int32_t numOfMsgs, int32_t code) { - for (int32_t i = 0; i < numOfMsgs; ++i) { - SRpcMsg *pMsg = NULL; - taosGetQitem(qall, (void **)&pMsg); - if (pMsg != NULL) { - bmSendErrorRsp(pMsg, code); - } - } -} - -static inline void bmSendRsp(SRpcMsg *pMsg, int32_t code) { - SRpcMsg rsp = { - .code = code, - .pCont = pMsg->info.rsp, - .contLen = pMsg->info.rspLen, - .info = pMsg->info, - }; - tmsgSendRsp(&rsp); -} - -static void bmProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { - SBnodeMgmt *pMgmt = pInfo->ahandle; - int32_t code = -1; - dTrace("msg:%p, get from bnode-monitor queue", pMsg); - - if (pMsg->msgType == TDMT_MON_BM_INFO) { - code = bmProcessGetMonBmInfoReq(pMgmt, pMsg); - } else { - terrno = TSDB_CODE_MSG_NOT_PROCESSED; - } - - if (IsReq(pMsg)) { - if (code != 0 && terrno != 0) code = terrno; - bmSendRsp(pMsg, code); - } - - dTrace("msg:%p, is freed, code:0x%x", pMsg, code); - rpcFreeCont(pMsg->pCont); - taosFreeQitem(pMsg); -} - -static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { - SBnodeMgmt *pMgmt = pInfo->ahandle; - - SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SRpcMsg *)); - if (pArray == NULL) { - bmSendErrorRsps(qall, numOfMsgs, TSDB_CODE_OUT_OF_MEMORY); - return; - } - - for (int32_t i = 0; i < numOfMsgs; ++i) { - SRpcMsg *pMsg = NULL; - taosGetQitem(qall, (void **)&pMsg); - if (pMsg != NULL) { - dTrace("msg:%p, get from bnode-write queue", pMsg); - if (taosArrayPush(pArray, &pMsg) == NULL) { - bmSendErrorRsp(pMsg, TSDB_CODE_OUT_OF_MEMORY); - } - } - } - - bndProcessWMsgs(pMgmt->pBnode, pArray); - - for (size_t i = 0; i < numOfMsgs; i++) { - SRpcMsg *pMsg = *(SRpcMsg **)taosArrayGet(pArray, i); - if (pMsg != NULL) { - dTrace("msg:%p, is freed", pMsg); - rpcFreeCont(pMsg->pCont); - taosFreeQitem(pMsg); - } - } - taosArrayDestroy(pArray); -} - -int32_t bmPutNodeMsgToWriteQueue(SBnodeMgmt *pMgmt, SRpcMsg *pMsg) { - SMultiWorker *pWorker = &pMgmt->writeWorker; - - dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name); - taosWriteQitem(pWorker->queue, pMsg); - return 0; -} - -int32_t bmPutNodeMsgToMonitorQueue(SBnodeMgmt *pMgmt, SRpcMsg *pMsg) { - SSingleWorker *pWorker = &pMgmt->monitorWorker; - - dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name); - taosWriteQitem(pWorker->queue, pMsg); - return 0; -} - -int32_t bmStartWorker(SBnodeMgmt *pMgmt) { - SMultiWorkerCfg cfg = { - .max = 1, - .name = "bnode-write", - .fp = (FItems)bmProcessWriteQueue, - .param = pMgmt, - }; - if (tMultiWorkerInit(&pMgmt->writeWorker, &cfg) != 0) { - dError("failed to start bnode-write worker since %s", terrstr()); - return -1; - } - - SSingleWorkerCfg mCfg = { - .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; - } - - dDebug("bnode workers are initialized"); - return 0; -} - -void bmStopWorker(SBnodeMgmt *pMgmt) { - tSingleWorkerCleanup(&pMgmt->monitorWorker); - tMultiWorkerCleanup(&pMgmt->writeWorker); - dDebug("bnode workers are closed"); -} diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index dd988161613dddefb0a996f19c5831dc6ca9e10d..782c828bb2327dc30587659d5e41fc1eb0f014d7 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -326,8 +326,6 @@ SArray *dmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_QNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_SNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_SNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_BNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_BNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_CONFIG_DNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_SERVER_STATUS, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_SYSTABLE_RETRIEVE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index e7ccce1c8b7ce1fd72f7a703b3757cef64833648..ca8a434d0500ef66febda17855a6eaec0670fe82 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -132,12 +132,6 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { case TDMT_DND_DROP_SNODE: code = (*pMgmt->processDropNodeFp)(SNODE, pMsg); break; - case TDMT_DND_CREATE_BNODE: - code = (*pMgmt->processCreateNodeFp)(BNODE, pMsg); - break; - case TDMT_DND_DROP_BNODE: - code = (*pMgmt->processDropNodeFp)(BNODE, pMsg); - break; case TDMT_DND_SERVER_STATUS: code = dmProcessServerRunStatus(pMgmt, pMsg); break; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index fc45dbf15f0630cf505db8cf013ff6297f27eb9e..105b6e542eb38bbcf4d5e06dc6132ffb2ccc3971 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -105,7 +105,7 @@ int32_t mmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { int32_t mmProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { const STraceId *trace = &pMsg->info.traceId; SDDropMnodeReq dropReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; } @@ -136,8 +136,6 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_QNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_SNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_SNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_BNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_BNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_VNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_CONFIG_DNODE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; @@ -163,8 +161,6 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_DNODE_LIST, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_SNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_SNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_BNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_BNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_USE_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c index 6382152cd1a1877e35d943fb09e817af94c02ab0..0573be90ea84cd2173d5492e5aaa2d6f6cf076b5 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c @@ -56,7 +56,7 @@ int32_t qmProcessGetMonitorInfoReq(SQnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t qmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { SDCreateQnodeReq createReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pMsg->pCont, pMsg->contLen, &createReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pMsg->pCont, pMsg->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; } @@ -78,7 +78,7 @@ int32_t qmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { int32_t qmProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { SDDropQnodeReq dropReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; } diff --git a/source/dnode/mgmt/mgmt_snode/src/smHandle.c b/source/dnode/mgmt/mgmt_snode/src/smHandle.c index 7cb41ca77cb77f7069ab8e375cef64840b058615..c6e3b3611f5e264f14a7da7261e2f1b89ff58c28 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smHandle.c +++ b/source/dnode/mgmt/mgmt_snode/src/smHandle.c @@ -45,7 +45,7 @@ int32_t smProcessGetMonitorInfoReq(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t smProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { SDCreateSnodeReq createReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pMsg->pCont, pMsg->contLen, &createReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pMsg->pCont, pMsg->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; } @@ -67,7 +67,7 @@ int32_t smProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { int32_t smProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { SDDropSnodeReq dropReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; } diff --git a/source/dnode/mgmt/node_mgmt/CMakeLists.txt b/source/dnode/mgmt/node_mgmt/CMakeLists.txt index 98027d80d4af858eef2a2108ef6d19b4b1851883..f1be20289a88c52726ac2b9187e5d23ba90ff616 100644 --- a/source/dnode/mgmt/node_mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/node_mgmt/CMakeLists.txt @@ -1,7 +1,7 @@ aux_source_directory(src IMPLEMENT_SRC) add_library(dnode STATIC ${IMPLEMENT_SRC}) target_link_libraries( - dnode mgmt_bnode mgmt_mnode mgmt_qnode mgmt_snode mgmt_vnode mgmt_dnode + dnode mgmt_mnode mgmt_qnode mgmt_snode mgmt_vnode mgmt_dnode ) target_include_directories( dnode diff --git a/source/dnode/mgmt/node_mgmt/inc/dmNodes.h b/source/dnode/mgmt/node_mgmt/inc/dmNodes.h index d3f1044f8804dbb83a8aea3f2864246f976dbde5..5f363090389f3fe23ff130309e32091a3290cf29 100644 --- a/source/dnode/mgmt/node_mgmt/inc/dmNodes.h +++ b/source/dnode/mgmt/node_mgmt/inc/dmNodes.h @@ -23,7 +23,6 @@ extern "C" { #endif SMgmtFunc dmGetMgmtFunc(); -SMgmtFunc bmGetMgmtFunc(); SMgmtFunc qmGetMgmtFunc(); SMgmtFunc smGetMgmtFunc(); SMgmtFunc vmGetMgmtFunc(); diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c index 2e149be3b6f74fd3d3cf6d9c9b4ab60bddeed94f..75c76a1f54cfbf45cee7fa9006d7588fe5644d8e 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c @@ -141,7 +141,6 @@ int32_t dmInitDnode(SDnode *pDnode, EDndNodeType rtype) { pDnode->wrappers[VNODE].func = vmGetMgmtFunc(); pDnode->wrappers[QNODE].func = qmGetMgmtFunc(); pDnode->wrappers[SNODE].func = smGetMgmtFunc(); - pDnode->wrappers[BNODE].func = bmGetMgmtFunc(); for (EDndNodeType ntype = DNODE; ntype < NODE_END; ++ntype) { SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype]; diff --git a/source/dnode/mgmt/node_mgmt/src/dmMonitor.c b/source/dnode/mgmt/node_mgmt/src/dmMonitor.c index 1c71fe5e1f00535b5938f2416cffc5cbca1a12b8..be1de02e6a1f1b1c5dbaaf9a02a8370881287619 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMonitor.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMonitor.c @@ -41,7 +41,6 @@ static void dmGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) { pInfo->has_mnode = pDnode->wrappers[MNODE].required; pInfo->has_qnode = pDnode->wrappers[QNODE].required; pInfo->has_snode = pDnode->wrappers[SNODE].required; - pInfo->has_bnode = pDnode->wrappers[BNODE].required; tstrncpy(pInfo->logdir.name, tsLogDir, sizeof(pInfo->logdir.name)); pInfo->logdir.size = tsLogSpace.size; tstrncpy(pInfo->tempdir.name, tsTempDir, sizeof(pInfo->tempdir.name)); @@ -116,21 +115,6 @@ static void dmGetSmMonitorInfo(SDnode *pDnode) { } } -static void dmGetBmMonitorInfo(SDnode *pDnode) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[BNODE]; - if (dmMarkWrapper(pWrapper) == 0) { - SMonBmInfo bmInfo = {0}; - if (tsMultiProcess) { - dmSendLocalRecv(pDnode, TDMT_MON_BM_INFO, tDeserializeSMonBmInfo, &bmInfo); - } else if (pWrapper->pMgmt != NULL) { - bmGetMonitorInfo(pWrapper->pMgmt, &bmInfo); - } - dmReleaseWrapper(pWrapper); - monSetBmInfo(&bmInfo); - tFreeSMonBmInfo(&bmInfo); - } -} - void dmSendMonitorReport() { if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return; dTrace("send monitor report to %s:%u", tsMonitorFqdn, tsMonitorPort); @@ -141,7 +125,6 @@ void dmSendMonitorReport() { dmGetVmMonitorInfo(pDnode); dmGetQmMonitorInfo(pDnode); dmGetSmMonitorInfo(pDnode); - dmGetBmMonitorInfo(pDnode); monSendReport(); } diff --git a/source/dnode/mgmt/node_mgmt/src/dmNodes.c b/source/dnode/mgmt/node_mgmt/src/dmNodes.c index 99ffd73a7a71c8fb9ab1ff43cc5ecc008d23eecd..ec5f3589e018e55df5921230d5f6936326dc8651 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmNodes.c +++ b/source/dnode/mgmt/node_mgmt/src/dmNodes.c @@ -26,8 +26,6 @@ static int32_t dmCreateShm(SMgmtWrapper *pWrapper) { shmsize = tsSnodeShmSize; } else if (pWrapper->ntype == MNODE) { shmsize = tsMnodeShmSize; - } else if (pWrapper->ntype == BNODE) { - shmsize = tsBnodeShmSize; } else { return -1; } diff --git a/source/dnode/mgmt/node_util/CMakeLists.txt b/source/dnode/mgmt/node_util/CMakeLists.txt index 5d879fdbcf356f6cefcfdc8046696fa4010cd1b4..5c670cbdd379bc27d2e56971a5e7ce838f86aa6a 100644 --- a/source/dnode/mgmt/node_util/CMakeLists.txt +++ b/source/dnode/mgmt/node_util/CMakeLists.txt @@ -6,5 +6,5 @@ target_include_directories( PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - node_util cjson mnode vnode qnode snode bnode wal sync taos_static tfs monitor + node_util cjson mnode vnode qnode snode wal sync taos_static tfs monitor ) \ No newline at end of file diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index f599de384cdc36f04873b0d34d40b18168b136da..2f9c0aff2f9bd94638587fa18362bbb4a6312934 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -68,8 +68,7 @@ typedef enum { VNODE = 2, QNODE = 3, SNODE = 4, - BNODE = 5, - NODE_END = 6, + NODE_END = 5, } EDndNodeType; typedef enum { diff --git a/source/dnode/mgmt/node_util/src/dmUtil.c b/source/dnode/mgmt/node_util/src/dmUtil.c index 832e15a1e00b92d614f87f44e0accc02853c9107..f5364b3195ebf9637df6fc86cbe536041df14756 100644 --- a/source/dnode/mgmt/node_util/src/dmUtil.c +++ b/source/dnode/mgmt/node_util/src/dmUtil.c @@ -39,8 +39,6 @@ const char *dmNodeLogName(EDndNodeType ntype) { return "snode"; case MNODE: return "mnode"; - case BNODE: - return "bnode"; default: return "taosd"; } @@ -56,8 +54,6 @@ const char *dmNodeProcName(EDndNodeType ntype) { return "taoss"; case MNODE: return "taosm"; - case BNODE: - return "taosb"; default: return "taosd"; } @@ -73,8 +69,6 @@ const char *dmNodeName(EDndNodeType ntype) { return "snode"; case MNODE: return "mnode"; - case BNODE: - return "bnode"; default: return "dnode"; } diff --git a/source/dnode/mgmt/test/CMakeLists.txt b/source/dnode/mgmt/test/CMakeLists.txt index 6b1919bf1862b5eeca9047de4731dae306ca275a..6709a2aa5e41436a543d737b08ab11ac579c0858 100644 --- a/source/dnode/mgmt/test/CMakeLists.txt +++ b/source/dnode/mgmt/test/CMakeLists.txt @@ -1,7 +1,6 @@ if(${BUILD_TEST}) enable_testing() add_subdirectory(qnode) - add_subdirectory(bnode) add_subdirectory(snode) #add_subdirectory(mnode) add_subdirectory(vnode) diff --git a/source/dnode/mgmt/test/bnode/CMakeLists.txt b/source/dnode/mgmt/test/bnode/CMakeLists.txt deleted file mode 100644 index 7108d3adb913abca3abe3aa614b1a6d4784b9120..0000000000000000000000000000000000000000 --- a/source/dnode/mgmt/test/bnode/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -aux_source_directory(. DND_BNODE_TEST_SRC) -add_executable(dbnodeTest ${DND_BNODE_TEST_SRC}) -target_link_libraries( - dbnodeTest sut -) - -add_test( - NAME dbnodeTest - COMMAND dbnodeTest -) diff --git a/source/dnode/mgmt/test/bnode/dbnode.cpp b/source/dnode/mgmt/test/bnode/dbnode.cpp deleted file mode 100644 index 24d8c594ce54a9e5c7d92575edcee9cd88d5bfef..0000000000000000000000000000000000000000 --- a/source/dnode/mgmt/test/bnode/dbnode.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @file dbnode.cpp - * @author slguan (slguan@taosdata.com) - * @brief DNODE module bnode tests - * @version 1.0 - * @date 2022-01-05 - * - * @copyright Copyright (c) 2022 - * - */ - -#include "sut.h" - -class DndTestBnode : public ::testing::Test { - protected: - static void SetUpTestSuite() { - test.Init(TD_TMP_DIR_PATH "dbnodeTest", 9112); - taosMsleep(1100); - } - static void TearDownTestSuite() { test.Cleanup(); } - static Testbase test; - - public: - void SetUp() override {} - void TearDown() override {} -}; - -Testbase DndTestBnode::test; - -TEST_F(DndTestBnode, 01_Create_Bnode) { - { - SDCreateBnodeReq createReq = {0}; - createReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION); - } - - { - SDCreateBnodeReq createReq = {0}; - createReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, 0); - } - - { - SDCreateBnodeReq createReq = {0}; - createReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - 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); - } - - // test.Restart(); - - { - SDCreateBnodeReq createReq = {0}; - createReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - 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); - } -} - -TEST_F(DndTestBnode, 02_Drop_Bnode) { - { - SDDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION); - } - - { - SDDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, 0); - } - - { - SDDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - 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_NOT_DEPLOYED); - } - - // test.Restart(); - - { - SDDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - 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_NOT_DEPLOYED); - } - - { - SDCreateBnodeReq createReq = {0}; - createReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, 0); - } -} diff --git a/source/dnode/mgmt/test/mnode/dmnode.cpp b/source/dnode/mgmt/test/mnode/dmnode.cpp index 857f58befce1898be621a37ea7cb33feb692d58a..7b7eb97216d9f443296b56393a273b5ccb01d9e9 100644 --- a/source/dnode/mgmt/test/mnode/dmnode.cpp +++ b/source/dnode/mgmt/test/mnode/dmnode.cpp @@ -139,9 +139,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) { SDDropMnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -152,9 +152,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) { SDDropMnodeReq dropReq = {0}; dropReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(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 = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); diff --git a/source/dnode/mgmt/test/qnode/dqnode.cpp b/source/dnode/mgmt/test/qnode/dqnode.cpp index ef51be47a68d8772507dcee7ae8fae5b29d82bf6..a2c6a2c28c81b7ba4ae76bd8e843696d879bf692 100644 --- a/source/dnode/mgmt/test/qnode/dqnode.cpp +++ b/source/dnode/mgmt/test/qnode/dqnode.cpp @@ -30,9 +30,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) { SDCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -43,9 +43,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) { SDCreateQnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(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 = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(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 = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -87,9 +87,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) { SDDropQnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -101,9 +101,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) { SDDropQnodeReq dropReq = {0}; dropReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -114,9 +114,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) { SDDropQnodeReq dropReq = {0}; dropReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -129,9 +129,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) { SDDropQnodeReq dropReq = {0}; dropReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -142,9 +142,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) { SDCreateQnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); diff --git a/source/dnode/mgmt/test/snode/dsnode.cpp b/source/dnode/mgmt/test/snode/dsnode.cpp index 9ae0fbdc542bb145c3b6e8d45fe355f1b187450d..e3ad65d8316fdb42e44d632e3fcfb20483377e53 100644 --- a/source/dnode/mgmt/test/snode/dsnode.cpp +++ b/source/dnode/mgmt/test/snode/dsnode.cpp @@ -30,9 +30,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) { SDCreateSnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -43,9 +43,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) { SDCreateSnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(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 = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(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 = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -87,9 +87,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) { SDDropSnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -101,9 +101,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) { SDDropSnodeReq dropReq = {0}; dropReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -114,9 +114,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) { SDDropSnodeReq dropReq = {0}; dropReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -129,9 +129,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) { SDDropSnodeReq dropReq = {0}; dropReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -142,9 +142,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) { SDCreateSnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); diff --git a/source/dnode/mnode/impl/inc/mndBnode.h b/source/dnode/mnode/impl/inc/mndBnode.h deleted file mode 100644 index cefc0b1859fd314e8ebd7d673aa936fa79227e14..0000000000000000000000000000000000000000 --- a/source/dnode/mnode/impl/inc/mndBnode.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#ifndef _TD_MND_BNODE_H_ -#define _TD_MND_BNODE_H_ - -#include "mndInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t mndInitBnode(SMnode *pMnode); -void mndCleanupBnode(SMnode *pMnode); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_MND_BNODE_H_*/ diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 9cc920de041c078848b616d8c8707ebb751d4260..48eea7daeacd75ea5219ee627e5e11293579b2d8 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -43,8 +43,6 @@ typedef enum { MND_OPER_CREATE_USER, MND_OPER_DROP_USER, MND_OPER_ALTER_USER, - MND_OPER_CREATE_BNODE, - MND_OPER_DROP_BNODE, MND_OPER_CREATE_DNODE, MND_OPER_DROP_DNODE, MND_OPER_CONFIG_DNODE, @@ -226,13 +224,6 @@ typedef struct { SDnodeObj* pDnode; } SSnodeObj; -typedef struct { - int32_t id; - int64_t createdTime; - int64_t updateTime; - SDnodeObj* pDnode; -} SBnodeObj; - typedef struct { int32_t maxUsers; int32_t maxDbs; diff --git a/source/dnode/mnode/impl/src/mndBnode.c b/source/dnode/mnode/impl/src/mndBnode.c deleted file mode 100644 index 06209d89c75f5ab5da28ae490c042414a8d2fa32..0000000000000000000000000000000000000000 --- a/source/dnode/mnode/impl/src/mndBnode.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#define _DEFAULT_SOURCE -#include "mndBnode.h" -#include "mndDnode.h" -#include "mndPrivilege.h" -#include "mndShow.h" -#include "mndTrans.h" -#include "mndUser.h" - -#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 mndBnodeActionUpdate(SSdb *pSdb, SBnodeObj *pOld, SBnodeObj *pNew); -static int32_t mndBnodeActionDelete(SSdb *pSdb, SBnodeObj *pObj); -static int32_t mndProcessCreateBnodeReq(SRpcMsg *pReq); -static int32_t mndProcessDropBnodeReq(SRpcMsg *pReq); -static int32_t mndRetrieveBnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); -static void mndCancelGetNextBnode(SMnode *pMnode, void *pIter); - -int32_t mndInitBnode(SMnode *pMnode) { - SSdbTable table = { - .sdbType = SDB_BNODE, - .keyType = SDB_KEY_INT32, - .encodeFp = (SdbEncodeFp)mndBnodeActionEncode, - .decodeFp = (SdbDecodeFp)mndBnodeActionDecode, - .insertFp = (SdbInsertFp)mndBnodeActionInsert, - .updateFp = (SdbUpdateFp)mndBnodeActionUpdate, - .deleteFp = (SdbDeleteFp)mndBnodeActionDelete, - }; - - mndSetMsgHandle(pMnode, TDMT_MND_CREATE_BNODE, mndProcessCreateBnodeReq); - mndSetMsgHandle(pMnode, TDMT_MND_DROP_BNODE, mndProcessDropBnodeReq); - mndSetMsgHandle(pMnode, TDMT_DND_CREATE_BNODE_RSP, mndTransProcessRsp); - mndSetMsgHandle(pMnode, TDMT_DND_DROP_BNODE_RSP, mndTransProcessRsp); - - mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_BNODE, mndRetrieveBnodes); - mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_BNODE, mndCancelGetNextBnode); - - return sdbSetTable(pMnode->pSdb, table); -} - -void mndCleanupBnode(SMnode *pMnode) {} - -static SBnodeObj *mndAcquireBnode(SMnode *pMnode, int32_t bnodeId) { - SBnodeObj *pObj = sdbAcquire(pMnode->pSdb, SDB_BNODE, &bnodeId); - if (pObj == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) { - terrno = TSDB_CODE_MND_BNODE_NOT_EXIST; - } - return pObj; -} - -static void mndReleaseBnode(SMnode *pMnode, SBnodeObj *pObj) { - SSdb *pSdb = pMnode->pSdb; - sdbRelease(pSdb, pObj); -} - -static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - - 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, _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; - -_OVER: - if (terrno != 0) { - mError("bnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr()); - sdbFreeRaw(pRaw); - return NULL; - } - - mTrace("bnode:%d, encode to raw:%p, row:%p", pObj->id, pRaw, pObj); - return pRaw; -} - -static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - - int8_t sver = 0; - if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; - - if (sver != BNODE_VER_NUMBER) { - terrno = TSDB_CODE_SDB_INVALID_DATA_VER; - goto _OVER; - } - - SSdbRow *pRow = sdbAllocRow(sizeof(SBnodeObj)); - if (pRow == NULL) goto _OVER; - - SBnodeObj *pObj = sdbGetRowObj(pRow); - if (pObj == NULL) goto _OVER; - - int32_t dataPos = 0; - 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; - -_OVER: - if (terrno != 0) { - mError("bnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr()); - taosMemoryFreeClear(pRow); - return NULL; - } - - mTrace("bnode:%d, decode from raw:%p, row:%p", pObj->id, pRaw, pObj); - return pRow; -} - -static int32_t mndBnodeActionInsert(SSdb *pSdb, SBnodeObj *pObj) { - mTrace("bnode:%d, perform insert action, row:%p", pObj->id, pObj); - pObj->pDnode = sdbAcquire(pSdb, SDB_DNODE, &pObj->id); - if (pObj->pDnode == NULL) { - terrno = TSDB_CODE_MND_DNODE_NOT_EXIST; - mError("bnode:%d, failed to perform insert action since %s", pObj->id, terrstr()); - return -1; - } - - return 0; -} - -static int32_t mndBnodeActionDelete(SSdb *pSdb, SBnodeObj *pObj) { - mTrace("bnode:%d, perform delete action, row:%p", pObj->id, pObj); - if (pObj->pDnode != NULL) { - sdbRelease(pSdb, pObj->pDnode); - pObj->pDnode = NULL; - } - - return 0; -} - -static int32_t mndBnodeActionUpdate(SSdb *pSdb, SBnodeObj *pOld, SBnodeObj *pNew) { - mTrace("bnode:%d, perform update action, old row:%p new row:%p", pOld->id, pOld, pNew); - pOld->updateTime = pNew->updateTime; - return 0; -} - -static int32_t mndSetCreateBnodeRedoLogs(STrans *pTrans, SBnodeObj *pObj) { - SSdbRaw *pRedoRaw = mndBnodeActionEncode(pObj); - if (pRedoRaw == NULL) return -1; - if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1; - if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_CREATING) != 0) return -1; - return 0; -} - -static int32_t mndSetCreateBnodeUndoLogs(STrans *pTrans, SBnodeObj *pObj) { - SSdbRaw *pUndoRaw = mndBnodeActionEncode(pObj); - if (pUndoRaw == NULL) return -1; - if (mndTransAppendUndolog(pTrans, pUndoRaw) != 0) return -1; - if (sdbSetRawStatus(pUndoRaw, SDB_STATUS_DROPPED) != 0) return -1; - return 0; -} - -static int32_t mndSetCreateBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) { - SSdbRaw *pCommitRaw = mndBnodeActionEncode(pObj); - if (pCommitRaw == NULL) return -1; - if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1; - if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) return -1; - return 0; -} - -static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBnodeObj *pObj) { - SDCreateBnodeReq createReq = {0}; - createReq.dnodeId = pDnode->id; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void *pReq = taosMemoryMalloc(contLen); - if (pReq == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - STransAction action = {0}; - action.epSet = mndGetDnodeEpset(pDnode); - action.pCont = pReq; - action.contLen = contLen; - action.msgType = TDMT_DND_CREATE_BNODE; - action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED; - - if (mndTransAppendRedoAction(pTrans, &action) != 0) { - taosMemoryFree(pReq); - return -1; - } - - return 0; -} - -static int32_t mndSetCreateBnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, SBnodeObj *pObj) { - SDDropBnodeReq dropReq = {0}; - dropReq.dnodeId = pDnode->id; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void *pReq = taosMemoryMalloc(contLen); - if (pReq == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - STransAction action = {0}; - action.epSet = mndGetDnodeEpset(pDnode); - action.pCont = pReq; - action.contLen = contLen; - action.msgType = TDMT_DND_DROP_BNODE; - action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED; - - if (mndTransAppendUndoAction(pTrans, &action) != 0) { - taosMemoryFree(pReq); - return -1; - } - - return 0; -} - -static int32_t mndCreateBnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SMCreateBnodeReq *pCreate) { - int32_t code = -1; - - SBnodeObj bnodeObj = {0}; - bnodeObj.id = pDnode->id; - bnodeObj.createdTime = taosGetTimestampMs(); - bnodeObj.updateTime = bnodeObj.createdTime; - - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-bnode"); - if (pTrans == NULL) goto _OVER; - - mInfo("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId); - 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; - -_OVER: - mndTransDrop(pTrans); - return code; -} - -static int32_t mndProcessCreateBnodeReq(SRpcMsg *pReq) { - SMnode *pMnode = pReq->info.node; - int32_t code = -1; - SBnodeObj *pObj = NULL; - SDnodeObj *pDnode = NULL; - SMCreateBnodeReq createReq = {0}; - - if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - goto _OVER; - } - - mInfo("bnode:%d, start to create", createReq.dnodeId); - if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_BNODE) != 0) { - goto _OVER; - } - - pObj = mndAcquireBnode(pMnode, createReq.dnodeId); - if (pObj != NULL) { - terrno = TSDB_CODE_MND_BNODE_ALREADY_EXIST; - goto _OVER; - } else if (terrno != TSDB_CODE_MND_BNODE_NOT_EXIST) { - goto _OVER; - } - - pDnode = mndAcquireDnode(pMnode, createReq.dnodeId); - if (pDnode == NULL) { - terrno = TSDB_CODE_MND_DNODE_NOT_EXIST; - goto _OVER; - } - - code = mndCreateBnode(pMnode, pReq, pDnode, &createReq); - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; - -_OVER: - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("bnode:%d, failed to create since %s", createReq.dnodeId, terrstr()); - } - - mndReleaseBnode(pMnode, pObj); - mndReleaseDnode(pMnode, pDnode); - return code; -} - -static int32_t mndSetDropBnodeRedoLogs(STrans *pTrans, SBnodeObj *pObj) { - SSdbRaw *pRedoRaw = mndBnodeActionEncode(pObj); - if (pRedoRaw == NULL) return -1; - if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1; - if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING) != 0) return -1; - return 0; -} - -static int32_t mndSetDropBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) { - SSdbRaw *pCommitRaw = mndBnodeActionEncode(pObj); - if (pCommitRaw == NULL) return -1; - if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1; - if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED) != 0) return -1; - return 0; -} - -static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBnodeObj *pObj) { - SDDropBnodeReq dropReq = {0}; - dropReq.dnodeId = pDnode->id; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void *pReq = taosMemoryMalloc(contLen); - if (pReq == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - STransAction action = {0}; - action.epSet = mndGetDnodeEpset(pDnode); - action.pCont = pReq; - action.contLen = contLen; - action.msgType = TDMT_DND_DROP_BNODE; - action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED; - - if (mndTransAppendRedoAction(pTrans, &action) != 0) { - taosMemoryFree(pReq); - return -1; - } - - return 0; -} - -static int32_t mndDropBnode(SMnode *pMnode, SRpcMsg *pReq, SBnodeObj *pObj) { - int32_t code = -1; - - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-bnode"); - if (pTrans == NULL) goto _OVER; - - mInfo("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id); - 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; - -_OVER: - mndTransDrop(pTrans); - return code; -} - -static int32_t mndProcessDropBnodeReq(SRpcMsg *pReq) { - SMnode *pMnode = pReq->info.node; - int32_t code = -1; - SBnodeObj *pObj = NULL; - SMDropBnodeReq dropReq = {0}; - - if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - goto _OVER; - } - - mInfo("bnode:%d, start to drop", dropReq.dnodeId); - if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_BNODE) != 0) { - goto _OVER; - } - - if (dropReq.dnodeId <= 0) { - terrno = TSDB_CODE_INVALID_MSG; - goto _OVER; - } - - pObj = mndAcquireBnode(pMnode, dropReq.dnodeId); - if (pObj == NULL) { - goto _OVER; - } - - code = mndDropBnode(pMnode, pReq, pObj); - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; - -_OVER: - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("bnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); - } - - mndReleaseBnode(pMnode, pObj); - return code; -} - -static int32_t mndRetrieveBnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { - SMnode *pMnode = pReq->info.node; - SSdb *pSdb = pMnode->pSdb; - int32_t numOfRows = 0; - int32_t cols = 0; - SBnodeObj *pObj = NULL; - - while (numOfRows < rows) { - pShow->pIter = sdbFetch(pSdb, SDB_BNODE, pShow->pIter, (void **)&pObj); - if (pShow->pIter == NULL) break; - - cols = 0; - SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataAppend(pColInfo, numOfRows, (const char *)&pObj->id, false); - - char buf[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0}; - STR_WITH_MAXSIZE_TO_VARSTR(buf, pObj->pDnode->ep, pShow->pMeta->pSchemas[cols].bytes); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataAppend(pColInfo, numOfRows, buf, false); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataAppend(pColInfo, numOfRows, (const char *)&pObj->createdTime, false); - - numOfRows++; - sdbRelease(pSdb, pObj); - } - - pShow->numOfRows += numOfRows; - - return numOfRows; -} - -static void mndCancelGetNextBnode(SMnode *pMnode, void *pIter) { - SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); -} diff --git a/source/dnode/mnode/impl/src/mndDump.c b/source/dnode/mnode/impl/src/mndDump.c index c1c7581a7e2c1d64cbcc2409da86a1b07de90db5..7d0f5742f8bd69df9eb2d21836935dffb84875c0 100644 --- a/source/dnode/mnode/impl/src/mndDump.c +++ b/source/dnode/mnode/impl/src/mndDump.c @@ -447,10 +447,6 @@ void dumpDnode(SSdb *pSdb, SJson *json) { } } -void dumpBnode(SSdb *pSdb, SJson *json) { - // not implemented yet -} - void dumpSnode(SSdb *pSdb, SJson *json) { void *pIter = NULL; SJson *items = tjsonAddArrayToObject(json, "snodes"); @@ -616,7 +612,6 @@ void mndDumpSdb() { dumpAuth(pSdb, json); dumpUser(pSdb, json); dumpDnode(pSdb, json); - dumpBnode(pSdb, json); dumpSnode(pSdb, json); dumpQnode(pSdb, json); dumpMnode(pSdb, json); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 8314601df3d7a8de1f37757832162c1c6cc3379b..4eb2e2978bb77af92d8883139e7b7e5f379eba86 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "mndAcct.h" -#include "mndBnode.h" #include "mndCluster.h" #include "mndConsumer.h" #include "mndDb.h" @@ -296,7 +295,6 @@ static int32_t mndInitSteps(SMnode *pMnode) { if (mndAllocStep(pMnode, "mnode-mnode", mndInitMnode, mndCleanupMnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-qnode", mndInitQnode, mndCleanupQnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-snode", mndInitSnode, mndCleanupSnode) != 0) return -1; - if (mndAllocStep(pMnode, "mnode-bnode", mndInitBnode, mndCleanupBnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-dnode", mndInitDnode, mndCleanupDnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-user", mndInitUser, mndCleanupUser) != 0) return -1; if (mndAllocStep(pMnode, "mnode-grant", mndInitGrant, mndCleanupGrant) != 0) return -1; diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index e23b895ebdaed1b4736232b81df85738bdb20224..f6ea81c5654a0b51a9edb51044e5893785444743 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -324,9 +324,9 @@ static int32_t mndBuildAlterMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *pA } static int32_t mndBuildDropMnodeRedoAction(STrans *pTrans, SDDropMnodeReq *pDropReq, SEpSet *pDroprEpSet) { - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, pDropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, pDropReq); void *pReq = taosMemoryMalloc(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, pDropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, pDropReq); STransAction action = { .epSet = *pDroprEpSet, @@ -410,7 +410,7 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) { SDnodeObj *pDnode = NULL; SMCreateMnodeReq createReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } @@ -533,7 +533,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) { SMnodeObj *pObj = NULL; SMDropMnodeReq dropReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index d48a446e20ecb979acf559dc88710a719869b310..70f9b35312a40405a1413f4ec7089d37f3f4d5c9 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -190,13 +190,13 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S SDCreateQnodeReq createReq = {0}; createReq.dnodeId = pDnode->id; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void *pReq = taosMemoryMalloc(contLen); if (pReq == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); STransAction action = {0}; action.epSet = mndGetDnodeEpset(pDnode); @@ -217,13 +217,13 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S SDDropQnodeReq dropReq = {0}; dropReq.dnodeId = pDnode->id; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void *pReq = taosMemoryMalloc(contLen); if (pReq == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); STransAction action = {0}; action.epSet = mndGetDnodeEpset(pDnode); @@ -273,7 +273,7 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) { SDnodeObj *pDnode = NULL; SMCreateQnodeReq createReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } @@ -330,13 +330,13 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn SDDropQnodeReq dropReq = {0}; dropReq.dnodeId = pDnode->id; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void *pReq = taosMemoryMalloc(contLen); if (pReq == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); STransAction action = {0}; action.epSet = mndGetDnodeEpset(pDnode); @@ -384,7 +384,7 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) { SQnodeObj *pObj = NULL; SMDropQnodeReq dropReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 5a998dfe986d9f012e066f45810604b7ca9d728f..8b4cacf8d609ecf24b699f4cccf6306c6ada15c8 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -60,8 +60,6 @@ static int32_t convertToRetrieveType(char *name, int32_t len) { type = TSDB_MGMT_TABLE_MODULE; } else if (strncasecmp(name, TSDB_INS_TABLE_QNODES, len) == 0) { type = TSDB_MGMT_TABLE_QNODE; - } else if (strncasecmp(name, TSDB_INS_TABLE_BNODES, len) == 0) { - type = TSDB_MGMT_TABLE_BNODE; } else if (strncasecmp(name, TSDB_INS_TABLE_SNODES, len) == 0) { type = TSDB_MGMT_TABLE_SNODE; } else if (strncasecmp(name, TSDB_INS_TABLE_CLUSTER, len) == 0) { diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c index 916e8d0c449334f3a4b436b7187c4bf2b965a842..8127d5912e9fb1f43b2d7fb84b38b4ca19114188 100644 --- a/source/dnode/mnode/impl/src/mndSnode.c +++ b/source/dnode/mnode/impl/src/mndSnode.c @@ -195,13 +195,13 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S SDCreateSnodeReq createReq = {0}; createReq.dnodeId = pDnode->id; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void *pReq = taosMemoryMalloc(contLen); if (pReq == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); STransAction action = {0}; action.epSet = mndGetDnodeEpset(pDnode); @@ -222,13 +222,13 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S SDDropSnodeReq dropReq = {0}; dropReq.dnodeId = pDnode->id; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void *pReq = taosMemoryMalloc(contLen); if (pReq == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); STransAction action = {0}; action.epSet = mndGetDnodeEpset(pDnode); @@ -282,7 +282,7 @@ static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) { SDnodeObj *pDnode = NULL; SMCreateSnodeReq createReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } @@ -341,13 +341,13 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn SDDropSnodeReq dropReq = {0}; dropReq.dnodeId = pDnode->id; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void *pReq = taosMemoryMalloc(contLen); if (pReq == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); STransAction action = {0}; action.epSet = mndGetDnodeEpset(pDnode); @@ -398,7 +398,7 @@ static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) { SSnodeObj *pObj = NULL; SMDropSnodeReq dropReq = {0}; - if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) { + if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } diff --git a/source/dnode/mnode/impl/test/CMakeLists.txt b/source/dnode/mnode/impl/test/CMakeLists.txt index 3b1ca0999cf97e6d10cac810a3e7505217e39d88..7db84855618270985335418cb6470f870e93446f 100644 --- a/source/dnode/mnode/impl/test/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/CMakeLists.txt @@ -1,7 +1,6 @@ enable_testing() add_subdirectory(acct) -add_subdirectory(bnode) add_subdirectory(db) #add_subdirectory(dnode) add_subdirectory(func) diff --git a/source/dnode/mnode/impl/test/bnode/CMakeLists.txt b/source/dnode/mnode/impl/test/bnode/CMakeLists.txt deleted file mode 100644 index 2dd7b9ef78b0a396852389bd420724271443b310..0000000000000000000000000000000000000000 --- a/source/dnode/mnode/impl/test/bnode/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# aux_source_directory(. MNODE_BNODE_TEST_SRC) -# add_executable(mbnodeTest ${MNODE_BNODE_TEST_SRC}) -# target_link_libraries( -# mbnodeTest -# PUBLIC sut -# ) - -# add_test( -# NAME mbnodeTest -# COMMAND mbnodeTest -# ) diff --git a/source/dnode/mnode/impl/test/bnode/mbnode.cpp b/source/dnode/mnode/impl/test/bnode/mbnode.cpp deleted file mode 100644 index c93e2142d02de318da323fa00ee7c04531d58874..0000000000000000000000000000000000000000 --- a/source/dnode/mnode/impl/test/bnode/mbnode.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/** - * @file bnode.cpp - * @author slguan (slguan@taosdata.com) - * @brief MNODE module bnode tests - * @version 1.0 - * @date 2022-01-05 - * - * @copyright Copyright (c) 2022 - * - */ - -#include "sut.h" - -class MndTestBnode : public ::testing::Test { - public: - void SetUp() override {} - void TearDown() override {} - - public: - static void SetUpTestSuite() { - test.Init(TD_TMP_DIR_PATH "mnode_test_bnode1", 9018); - const char* fqdn = "localhost"; - const char* firstEp = "localhost:9018"; - - server2.Start(TD_TMP_DIR_PATH "mnode_test_bnode2", 9019); - taosMsleep(300); - } - - static void TearDownTestSuite() { - server2.Stop(); - test.Cleanup(); - } - - static Testbase test; - static TestServer server2; -}; - -Testbase MndTestBnode::test; -TestServer MndTestBnode::server2; - -TEST_F(MndTestBnode, 01_Show_Bnode) { - test.SendShowReq(TSDB_MGMT_TABLE_BNODE, "bnodes", ""); - EXPECT_EQ(test.GetShowRows(), 0); -} - -TEST_F(MndTestBnode, 02_Create_Bnode) { - { - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_DNODE_NOT_EXIST); - } - - { - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, 0); - - test.SendShowReq(TSDB_MGMT_TABLE_BNODE, "bnodes", ""); - EXPECT_EQ(test.GetShowRows(), 1); - } - - { - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 1; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_BNODE_ALREADY_EXIST); - } -} - -TEST_F(MndTestBnode, 03_Drop_Bnode) { - { - SCreateDnodeReq createReq = {0}; - strcpy(createReq.fqdn, "localhost"); - createReq.port = 9019; - - int32_t contLen = tSerializeSCreateDnodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDnodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, 0); - - taosMsleep(1300); - test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); - EXPECT_EQ(test.GetShowRows(), 2); - } - - { - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, 0); - - test.SendShowReq(TSDB_MGMT_TABLE_BNODE, "bnodes", ""); - EXPECT_EQ(test.GetShowRows(), 2); - } - - { - SMDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, 0); - - test.SendShowReq(TSDB_MGMT_TABLE_BNODE, "bnodes", ""); - EXPECT_EQ(test.GetShowRows(), 1); - } - - { - SMDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_BNODE_NOT_EXIST); - } -} - -TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) { - { - // send message first, then dnode2 crash, result is returned, and rollback is started - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - server2.Stop(); - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_RPC_NETWORK_UNAVAIL); - } - - { - // continue send message, bnode is creating - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_CREATING); - } - - { - // continue send message, bnode is creating - SMDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_CREATING); - } - - { - // server start, wait until the rollback finished - server2.DoStart(); - taosMsleep(1000); - - int32_t retry = 0; - int32_t retryMax = 20; - - for (retry = 0; retry < retryMax; retry++) { - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - if (pRsp->code == 0) break; - taosMsleep(1000); - } - - ASSERT_NE(retry, retryMax); - } -} - -TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) { - { - // send message first, then dnode2 crash, result is returned, and rollback is started - SMDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - server2.Stop(); - SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_RPC_NETWORK_UNAVAIL); - } - - { - // continue send message, bnode is dropping - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_DROPPING); - } - - { - // continue send message, bnode is dropping - SMDropBnodeReq dropReq = {0}; - dropReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_DROPPING); - } - - { - // server start, wait until the rollback finished - server2.DoStart(); - taosMsleep(1000); - - int32_t retry = 0; - int32_t retryMax = 20; - - for (retry = 0; retry < retryMax; retry++) { - SMCreateBnodeReq createReq = {0}; - createReq.dnodeId = 2; - - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - if (pRsp->code == 0) break; - taosMsleep(1000); - } - - ASSERT_NE(retry, retryMax); - } -} diff --git a/source/dnode/mnode/impl/test/mnode/mnode.cpp b/source/dnode/mnode/impl/test/mnode/mnode.cpp index 1ed613c723ca504777929b8a6715e9d3b7594e06..1f6dbd6dca8aff65190a483b56ab5405a1e3a9b0 100644 --- a/source/dnode/mnode/impl/test/mnode/mnode.cpp +++ b/source/dnode/mnode/impl/test/mnode/mnode.cpp @@ -48,9 +48,9 @@ TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) { SMCreateMnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -63,9 +63,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Invalid_Id) { SMCreateMnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -98,9 +98,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { SMCreateMnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -115,9 +115,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { SMDropMnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -132,9 +132,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { SMDropMnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -148,9 +148,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) { SMCreateMnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); server2.Stop(); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen); @@ -163,9 +163,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) { SMCreateMnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -177,9 +177,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) { SMDropMnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -198,9 +198,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) { SMCreateMnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -218,9 +218,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) { SMDropMnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); server2.Stop(); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen); @@ -233,9 +233,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) { SMCreateMnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -247,9 +247,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) { SMDropMnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -268,9 +268,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) { SMCreateMnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); diff --git a/source/dnode/mnode/impl/test/qnode/qnode.cpp b/source/dnode/mnode/impl/test/qnode/qnode.cpp index 57b38e55c1d392bda809b094b0f1bf918aae8888..a3bcb7654ea234aa8231da4a355053a0d03846aa 100644 --- a/source/dnode/mnode/impl/test/qnode/qnode.cpp +++ b/source/dnode/mnode/impl/test/qnode/qnode.cpp @@ -48,9 +48,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -61,9 +61,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -77,9 +77,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -110,9 +110,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -126,9 +126,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { SMDropQnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -142,9 +142,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { SMDropQnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -158,9 +158,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); server2.Stop(); taosMsleep(1000); @@ -176,9 +176,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -190,9 +190,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) { SMDropQnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -212,9 +212,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -231,9 +231,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) { SMDropQnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); server2.Stop(); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen); @@ -246,9 +246,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_DROPPING); @@ -259,9 +259,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) { SMDropQnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -280,9 +280,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); if (pRsp->code == 0) break; diff --git a/source/dnode/mnode/impl/test/snode/snode.cpp b/source/dnode/mnode/impl/test/snode/snode.cpp index 1828fbd570499107e3e3131631c35602bead983f..ac48eee4d06774a2ba3b1077ff68a769a4d65cda 100644 --- a/source/dnode/mnode/impl/test/snode/snode.cpp +++ b/source/dnode/mnode/impl/test/snode/snode.cpp @@ -48,9 +48,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -61,9 +61,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -77,9 +77,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -110,9 +110,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -126,9 +126,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { SMDropSnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -142,9 +142,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { SMDropSnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -158,9 +158,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); server2.Stop(); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); @@ -173,9 +173,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -187,9 +187,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) { SMDropSnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -208,9 +208,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -228,9 +228,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) { SMDropSnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); server2.Stop(); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen); @@ -243,9 +243,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -257,9 +257,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) { SMDropSnodeReq dropReq = {0}; dropReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -278,9 +278,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) { SMCreateSnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); diff --git a/source/dnode/mnode/impl/test/trans/trans1.cpp b/source/dnode/mnode/impl/test/trans/trans1.cpp index 5a470fc900f418c429befe12d6cfae643522a2e3..92a442aa5ee37c87a1d1d100a9ed7032f7f5b45c 100644 --- a/source/dnode/mnode/impl/test/trans/trans1.cpp +++ b/source/dnode/mnode/impl/test/trans/trans1.cpp @@ -112,9 +112,9 @@ TEST_F(MndTestTrans1, 02_Create_Qnode1_Crash) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -129,9 +129,9 @@ TEST_F(MndTestTrans1, 02_Create_Qnode1_Crash) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 1; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -165,9 +165,9 @@ TEST_F(MndTestTrans1, 03_Create_Qnode2_Crash) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); server2.Stop(); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); @@ -209,9 +209,9 @@ TEST_F(MndTestTrans1, 03_Create_Qnode2_Crash) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -232,9 +232,9 @@ TEST_F(MndTestTrans1, 03_Create_Qnode2_Crash) { SMCreateQnodeReq createReq = {0}; createReq.dnodeId = 2; - int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq); + int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); - tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq); + tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index a2373a55ce095150598e0825e4f7ce80efb1c8a5..d4db4709caa2f7a7a3d7c31e1aaf475acc067897 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -132,7 +132,6 @@ typedef enum { SDB_MNODE = 2, SDB_QNODE = 3, SDB_SNODE = 4, - SDB_BNODE = 5, SDB_DNODE = 6, SDB_USER = 7, SDB_AUTH = 8, diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index 85e937fcc34995451e9e6f9565de8b48d79aca44..6c00a654e92e245ca0e477f9b25de60007c4a34d 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -30,8 +30,6 @@ const char *sdbTableName(ESdbType type) { return "qnode"; case SDB_SNODE: return "snode"; - case SDB_BNODE: - return "bnode"; case SDB_DNODE: return "dnode"; case SDB_USER: diff --git a/source/libs/monitor/src/monMain.c b/source/libs/monitor/src/monMain.c index eab5a334508765f876a2289af90190ec2648df2b..890a59e4be29cdc66ca39c7803830eecb9b23a95 100644 --- a/source/libs/monitor/src/monMain.c +++ b/source/libs/monitor/src/monMain.c @@ -401,7 +401,6 @@ static void monGenDnodeJson(SMonInfo *pMonitor) { tjsonAddDoubleToObject(pJson, "has_mnode", pInfo->has_mnode); tjsonAddDoubleToObject(pJson, "has_qnode", pInfo->has_qnode); tjsonAddDoubleToObject(pJson, "has_snode", pInfo->has_snode); - tjsonAddDoubleToObject(pJson, "has_bnode", pInfo->has_bnode); } static void monGenDiskJson(SMonInfo *pMonitor) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a8bc8689d0b74c3f35b3f2940bb29165df524755..5a05440c73b92accf42e8ecce8ee6d6c194080f3 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5166,7 +5166,7 @@ static int16_t getCreateComponentNodeMsgType(ENodeType type) { static int32_t translateCreateComponentNode(STranslateContext* pCxt, SCreateComponentNodeStmt* pStmt) { SMCreateQnodeReq createReq = {.dnodeId = pStmt->dnodeId}; return buildCmdMsg(pCxt, getCreateComponentNodeMsgType(nodeType(pStmt)), - (FSerializeFunc)tSerializeSCreateDropMQSBNodeReq, &createReq); + (FSerializeFunc)tSerializeSCreateDropMQSNodeReq, &createReq); } static int16_t getDropComponentNodeMsgType(ENodeType type) { @@ -5188,7 +5188,7 @@ static int16_t getDropComponentNodeMsgType(ENodeType type) { static int32_t translateDropComponentNode(STranslateContext* pCxt, SDropComponentNodeStmt* pStmt) { SDDropQnodeReq dropReq = {.dnodeId = pStmt->dnodeId}; return buildCmdMsg(pCxt, getDropComponentNodeMsgType(nodeType(pStmt)), - (FSerializeFunc)tSerializeSCreateDropMQSBNodeReq, &dropReq); + (FSerializeFunc)tSerializeSCreateDropMQSNodeReq, &dropReq); } static int32_t checkTopicQuery(STranslateContext* pCxt, SSelectStmt* pSelect) { diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 121bbaa733c3d4b019fbaf5638e32a2fe7ac37d2..3ea6ae3db46eaac4a84c670cec781891541d4bf9 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -27,25 +27,6 @@ TEST_F(ParserInitialCTest, createAccount) { run("CREATE ACCOUNT ac_wxy PASS '123456'", TSDB_CODE_PAR_EXPRIE_STATEMENT, PARSER_STAGE_PARSE); } -TEST_F(ParserInitialCTest, createBnode) { - useDb("root", "test"); - - SMCreateQnodeReq expect = {0}; - - auto setCreateQnodeReq = [&](int32_t dnodeId) { expect.dnodeId = dnodeId; }; - - setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { - ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_BNODE_STMT); - SMCreateQnodeReq req = {0}; - ASSERT_TRUE(TSDB_CODE_SUCCESS == - tDeserializeSCreateDropMQSBNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); - ASSERT_EQ(req.dnodeId, expect.dnodeId); - }); - - setCreateQnodeReq(1); - run("CREATE BNODE ON DNODE 1"); -} - /* * CREATE DATABASE [IF NOT EXISTS] db_name [database_options] * diff --git a/source/libs/parser/test/parInitialDTest.cpp b/source/libs/parser/test/parInitialDTest.cpp index 870afa694a21623f7bd1816c5eeb7a769ce9a6e8..c7865f3da37438e81ded4627bb8d278d203cbd91 100644 --- a/source/libs/parser/test/parInitialDTest.cpp +++ b/source/libs/parser/test/parInitialDTest.cpp @@ -52,12 +52,6 @@ TEST_F(ParserInitialDTest, describe) { // todo describe // todo DROP account -TEST_F(ParserInitialDTest, dropBnode) { - useDb("root", "test"); - - run("DROP BNODE ON DNODE 1"); -} - // DROP CONSUMER GROUP [ IF EXISTS ] cgroup_name ON topic_name TEST_F(ParserInitialDTest, dropConsumerGroup) { useDb("root", "test"); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 9a117c6eb48c1bc06d4063101531579ba6369fb4..37f9734eab20482755b8305a6cb2be6a08407493 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -238,8 +238,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_QNODE_ALREADY_EXIST, "Qnode already exists" TAOS_DEFINE_ERROR(TSDB_CODE_MND_QNODE_NOT_EXIST, "Qnode not there") TAOS_DEFINE_ERROR(TSDB_CODE_MND_SNODE_ALREADY_EXIST, "Snode already exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_SNODE_NOT_EXIST, "Snode not there") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_BNODE_ALREADY_EXIST, "Bnode already exists") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_BNODE_NOT_EXIST, "Bnode not there") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_FEW_MNODES, "The replica of mnode cannot less than 1") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_MNODES, "The replica of mnode cannot exceed 3") diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 47611a77124d8651d025c91ab9771cbe321a4586..81625d55e5680c7688dd47305271714fd5c8524f 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -187,9 +187,6 @@ # ---- snode ---- # unsupport ./test.sh -f tsim/snode/basic1.sim -# ---- bnode -./test.sh -f tsim/bnode/basic1.sim - # ---- mnode ./test.sh -f tsim/mnode/basic1.sim ./test.sh -f tsim/mnode/basic2.sim diff --git a/tests/script/tmp/monitor.sim b/tests/script/tmp/monitor.sim index b410e1b6ad99e8bd83dcf7dd3cf0f3c4961d0ad4..1734b9a1a7ae20f9d4b4cdfe882d2355ce98d824 100644 --- a/tests/script/tmp/monitor.sim +++ b/tests/script/tmp/monitor.sim @@ -23,5 +23,4 @@ sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 bin print =============== create drop qnode 1 sql create qnode on dnode 1 #sql create snode on dnode 1 -#sql create bnode on dnode 1 diff --git a/tests/script/tsim/bnode/basic1.sim b/tests/script/tsim/bnode/basic1.sim deleted file mode 100644 index 0a200016368efffbdd360c891cc6f15d3a284b47..0000000000000000000000000000000000000000 --- a/tests/script/tsim/bnode/basic1.sim +++ /dev/null @@ -1,135 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sql connect - -print =============== select * from information_schema.ins_dnodes -sql select * from information_schema.ins_dnodes; -if $rows != 1 then - return -1 -endi - -if $data00 != 1 then - return -1 -endi - -sql select * from information_schema.ins_mnodes; -if $rows != 1 then - return -1 -endi - -if $data00 != 1 then - return -1 -endi - -if $data02 != leader then - return -1 -endi - -print =============== create dnodes -sql create dnode $hostname port 7200 -sleep 2000 - -sql select * from information_schema.ins_dnodes; -if $rows != 2 then - return -1 -endi - -if $data00 != 1 then - return -1 -endi - -if $data10 != 2 then - return -1 -endi - -print $data02 -if $data02 != 0 then - return -1 -endi - -if $data12 != 0 then - return -1 -endi - -if $data04 != ready then - return -1 -endi - -if $data14 != ready then - return -1 -endi - -sql select * from information_schema.ins_mnodes; -if $rows != 1 then - return -1 -endi - -if $data00 != 1 then - return -1 -endi - -if $data02 != leader then - return -1 -endi - -#print =============== create drop bnode 1 -#sql create bnode on dnode 1 -#sql show bnodes -#if $rows != 1 then -# return -1 -#endi -#if $data00 != 1 then -# return -1 -#endi -#sql_error create bnode on dnode 1 -# -#sql drop bnode on dnode 1 -#sql show bnodes -#if $rows != 0 then -# return -1 -#endi -#sql_error drop bnode on dnode 1 -# -#print =============== create drop bnode 2 -#sql create bnode on dnode 2 -#sql show bnodes -#if $rows != 1 then -# return -1 -#endi -#if $data00 != 2 then -# return -1 -#endi -#sql_error create bnode on dnode 2 -# -#sql drop bnode on dnode 2 -#sql show bnodes -#if $rows != 0 then -# return -1 -#endi -#sql_error drop bnode on dnode 2 -# -#print =============== create drop bnodes -#sql create bnode on dnode 1 -#sql create bnode on dnode 2 -#sql show bnodes -#if $rows != 2 then -# return -1 -#endi - -#print =============== restart -#system sh/exec.sh -n dnode1 -s stop -x SIGINT -#system sh/exec.sh -n dnode2 -s stop -x SIGINT -#system sh/exec.sh -n dnode1 -s start -#system sh/exec.sh -n dnode2 -s start -# -#sleep 2000 -#sql show bnodes -#if $rows != 2 then -# return -1 -#endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT diff --git a/tests/script/tsim/testsuit.sim b/tests/script/tsim/testsuit.sim index 89a4babb0b9b7ccbce8758f55c2ba97919d0df59..ad8d70b089e8a277c3cffc5b88647342fc7f39f8 100644 --- a/tests/script/tsim/testsuit.sim +++ b/tests/script/tsim/testsuit.sim @@ -128,5 +128,4 @@ run tsim/sync/threeReplica1VgElectWihtInsert.sim run tsim/sma/tsmaCreateInsertQuery.sim run tsim/sma/rsmaCreateInsertQuery.sim run tsim/valgrind/basic.sim -run tsim/valgrind/checkError.sim -run tsim/bnode/basic1.sim \ No newline at end of file +run tsim/valgrind/checkError.sim \ No newline at end of file diff --git a/tests/script/tsim/user/privilege_sysinfo.sim b/tests/script/tsim/user/privilege_sysinfo.sim index 86f95755d09f7e2f1c0654b94f63f471f9a074d0..1614c3be5537579ff8dcdbe09db598be8363c946 100644 --- a/tests/script/tsim/user/privilege_sysinfo.sim +++ b/tests/script/tsim/user/privilege_sysinfo.sim @@ -110,7 +110,6 @@ sql_error show dnodes sql_error show snodes sql_error show qnodes sql_error show mnodes -sql_error show bnodes sql_error show db.vgroups sql_error show db.stables sql_error show db.tables diff --git a/tests/system-test/0-others/taosdMonitor.py b/tests/system-test/0-others/taosdMonitor.py index c713e9fd148811b670284a91a2ab5305a8f91bb4..1d733191b72249f426f836a8115e28a7283bbb32 100644 --- a/tests/system-test/0-others/taosdMonitor.py +++ b/tests/system-test/0-others/taosdMonitor.py @@ -125,7 +125,7 @@ class RequestHandlerImpl(http.server.BaseHTTPRequestHandler): dnode_infos = ['uptime', 'cpu_engine', 'cpu_system', 'cpu_cores', 'mem_engine', 'mem_system', 'mem_total', 'disk_engine', 'disk_used', 'disk_total', 'net_in', 'net_out', 'io_read', 'io_write', 'io_read_disk', 'io_write_disk', 'req_select', 'req_select_rate', 'req_insert', 'req_insert_success', 'req_insert_rate', 'req_insert_batch', 'req_insert_batch_success', - 'req_insert_batch_rate', 'errors', 'vnodes_num', 'masters', 'has_mnode', 'has_qnode', 'has_snode', 'has_bnode'] + 'req_insert_batch_rate', 'errors', 'vnodes_num', 'masters', 'has_mnode', 'has_qnode', 'has_snode'] for elem in dnode_infos: if elem not in infoDict["dnode_info"] or infoDict["dnode_info"][elem] < 0: tdLog.exit(f"{elem} is null!")