From 5669f2a1bafd9cdf76f987691c32a184f188f666 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 12 May 2022 17:57:38 +0800 Subject: [PATCH] refactor: node mgmt --- source/common/src/systable.c | 2 +- source/dnode/mgmt/exe/dmMain.c | 2 +- source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 6 ++---- source/dnode/mgmt/mgmt_dnode/src/dmInt.c | 1 + source/dnode/mgmt/node_mgmt/inc/{dmImp.h => dmMgmt.h} | 0 source/dnode/mgmt/node_mgmt/src/{dmObj.c => dmMgmt.c} | 2 +- source/dnode/mgmt/node_mgmt/src/{dmExec.c => dmRun.c} | 2 +- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- 8 files changed, 8 insertions(+), 9 deletions(-) rename source/dnode/mgmt/node_mgmt/inc/{dmImp.h => dmMgmt.h} (100%) rename source/dnode/mgmt/node_mgmt/src/{dmObj.c => dmMgmt.c} (99%) rename source/dnode/mgmt/node_mgmt/src/{dmExec.c => dmRun.c} (99%) diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 81682bb734..e4e5abe148 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -26,7 +26,7 @@ static const SSysDbTableSchema dnodesSchema[] = { {.name = "id", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, - {.name = "max_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, + {.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 21776d71f6..81df34ef4a 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "dmImp.h" +#include "dmMgmt.h" #include "tconfig.h" #define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'." diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index ea89b672a8..9fedaa3744 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -27,8 +27,8 @@ static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) { } } -static int32_t dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) { - if (pRsp->code != TSDB_CODE_SUCCESS) { +static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) { + if (pRsp->code != 0) { if (pRsp->code == TSDB_CODE_MND_DNODE_NOT_EXIST && !pMgmt->data.dropped && pMgmt->data.dnodeId > 0) { dInfo("dnode:%d, set to dropped since not exist in mnode", pMgmt->data.dnodeId); pMgmt->data.dropped = 1; @@ -45,8 +45,6 @@ static int32_t dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) { rpcFreeCont(pRsp->pCont); tFreeSStatusRsp(&statusRsp); } - - return TSDB_CODE_SUCCESS; } void dmSendStatusReq(SDnodeMgmt *pMgmt) { diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c index e42c5372ac..7eabf9f1b7 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c @@ -86,6 +86,7 @@ static int32_t dmOpenMgmt(const SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) } pOutput->pMgmt = pMgmt; + pOutput->mnodeEps = pMgmt->data.mnodeEps; dInfo("dnode-mgmt is initialized"); return 0; } diff --git a/source/dnode/mgmt/node_mgmt/inc/dmImp.h b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h similarity index 100% rename from source/dnode/mgmt/node_mgmt/inc/dmImp.h rename to source/dnode/mgmt/node_mgmt/inc/dmMgmt.h diff --git a/source/dnode/mgmt/node_mgmt/src/dmObj.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c similarity index 99% rename from source/dnode/mgmt/node_mgmt/src/dmObj.c rename to source/dnode/mgmt/node_mgmt/src/dmMgmt.c index acc2b67d71..e389329a20 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmObj.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "dmImp.h" +#include "dmMgmt.h" static bool dmIsNodeDeployedFp(SDnode *pDnode, EDndNodeType ntype) { return pDnode->wrappers[ntype].required; } diff --git a/source/dnode/mgmt/node_mgmt/src/dmExec.c b/source/dnode/mgmt/node_mgmt/src/dmRun.c similarity index 99% rename from source/dnode/mgmt/node_mgmt/src/dmExec.c rename to source/dnode/mgmt/node_mgmt/src/dmRun.c index 7fb89de59e..fd551f3574 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmExec.c +++ b/source/dnode/mgmt/node_mgmt/src/dmRun.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "dmImp.h" +#include "dmMgmt.h" static int32_t dmInitParentProc(SMgmtWrapper *pWrapper) { int32_t shmsize = tsMnodeShmSize; diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 486eef78d6..99a1fce3a8 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "dmImp.h" +#include "dmMgmt.h" #include "qworker.h" #define INTERNAL_USER "_dnd" -- GitLab