diff --git a/source/dnode/mgmt/bnode/inc/dndBnode.h b/source/dnode/mgmt/bnode/inc/bmInt.h similarity index 95% rename from source/dnode/mgmt/bnode/inc/dndBnode.h rename to source/dnode/mgmt/bnode/inc/bmInt.h index 853b54ff692009f3115e7d6a9ad4f68cbf6cb881..8685a35312901a3eca7557315ee9f1eb59ca13d3 100644 --- a/source/dnode/mgmt/bnode/inc/dndBnode.h +++ b/source/dnode/mgmt/bnode/inc/bmInt.h @@ -21,6 +21,8 @@ extern "C" { #endif #include "dndInt.h" +SMgmtFp bmGetMgmtFp(); + int32_t dndInitBnode(SDnode *pDnode); void dndCleanupBnode(SDnode *pDnode); diff --git a/source/dnode/mgmt/bnode/src/dndBnode.c b/source/dnode/mgmt/bnode/src/dndBnode.c index 8152107150011a24a2ec37cd5caa6113da17f299..d1ca08ff1e76df9cfd775d5df00a199d76253e55 100644 --- a/source/dnode/mgmt/bnode/src/dndBnode.c +++ b/source/dnode/mgmt/bnode/src/dndBnode.c @@ -14,10 +14,10 @@ */ #define _DEFAULT_SOURCE -#include "dndBnode.h" -#include "dndMgmt.h" -#include "dndTransport.h" -#include "dndWorker.h" +// #include "dndBnode.h" +// #include "dndMgmt.h" +// #include "dndTransport.h" +// #include "dndWorker.h" #if 0 static void dndProcessBnodeQueue(SDnode *pDnode, STaosQall *qall, int32_t numOfMsgs); diff --git a/source/dnode/mgmt/dnode/src/dndMain.c b/source/dnode/mgmt/dnode/src/dndMain.c index caa6961c884ed0747b904654411d864ffd70f4e4..53d8e24f5560c688351f11cc2d255f6c17e5e23b 100644 --- a/source/dnode/mgmt/dnode/src/dndMain.c +++ b/source/dnode/mgmt/dnode/src/dndMain.c @@ -15,44 +15,16 @@ #define _DEFAULT_SOURCE #include "dndMain.h" -// #include "dndBnode.h" #include "dndMgmt.h" -// #include "mm.h" -// #include "dndQnode.h" -// #include "dndSnode.h" #include "dndTransport.h" -// #include "dndVnodes.h" -// #include "monitor.h" -// #include "sync.h" -// #include "tfs.h" -// #include "wal.h" -static int8_t once = DND_ENV_INIT; - -SMgmtFp mmGetNodeFp() { - SMgmtFp nullFp = {0}; - return nullFp; -} - -SMgmtFp vndGetNodeFp() { - SMgmtFp nullFp = {0}; - return nullFp; -} - -SMgmtFp qndGetNodeFp() { - SMgmtFp nullFp = {0}; - return nullFp; -} - -SMgmtFp sndGetNodeFp() { - SMgmtFp nullFp = {0}; - return nullFp; -} +#include "bmInt.h" +#include "mmInt.h" +#include "qmInt.h" +#include "smInt.h" +#include "vmInt.h" -SMgmtFp bndGetNodeFp() { - SMgmtFp nullFp = {0}; - return nullFp; -} +static int8_t once = DND_ENV_INIT; static void dndResetLog(SMgmtWrapper *pMgmt) { char logname[24] = {0}; @@ -63,7 +35,7 @@ static void dndResetLog(SMgmtWrapper *pMgmt) { taosInitLog(logname, 1); } -static bool dndRequireOpenNode(SMgmtWrapper *pMgmt) { +static bool dndRequireNode(SMgmtWrapper *pMgmt) { bool required = (*pMgmt->fp.requiredFp)(pMgmt); if (!required) { dDebug("node:%s, no need to start on this dnode", pMgmt->name); @@ -73,7 +45,7 @@ static bool dndRequireOpenNode(SMgmtWrapper *pMgmt) { return required; } -static void dndClearDnodeMem(SDnode *pDnode) { +static void dndClearMemory(SDnode *pDnode) { for (ENodeType n = 0; n < NODE_MAX; ++n) { SMgmtWrapper *pMgmt = &pDnode->mgmts[n]; tfree(pMgmt->path); @@ -86,7 +58,7 @@ static void dndClearDnodeMem(SDnode *pDnode) { dDebug("dnode object memory is cleared, data:%p", pDnode); } -static int32_t dndInitDnodeResource(SDnode *pDnode) { +static int32_t dndInitResource(SDnode *pDnode) { SDiskCfg dCfg = {0}; tstrncpy(dCfg.dir, pDnode->cfg.dataDir, TSDB_FILENAME_LEN); dCfg.level = 0; @@ -120,7 +92,7 @@ static int32_t dndInitDnodeResource(SDnode *pDnode) { return 0; } -static void dndClearDnodeResource(SDnode *pDnode) { +static void dndClearResource(SDnode *pDnode) { dndCleanupTrans(pDnode); dndStopMgmt(pDnode); dndCleanupMgmt(pDnode); @@ -150,11 +122,11 @@ SDnode *dndCreate(SDndCfg *pCfg) { goto _OVER; } - pDnode->mgmts[MNODE].fp = mmGetNodeFp(); - pDnode->mgmts[VNODES].fp = vndGetNodeFp(); - pDnode->mgmts[QNODE].fp = qndGetNodeFp(); - pDnode->mgmts[SNODE].fp = sndGetNodeFp(); - pDnode->mgmts[BNODE].fp = bndGetNodeFp(); + pDnode->mgmts[MNODE].fp = mmGetMgmtFp(); + pDnode->mgmts[VNODES].fp = vmGetMgmtFp(); + pDnode->mgmts[QNODE].fp = qmGetMgmtFp(); + pDnode->mgmts[SNODE].fp = smGetMgmtFp(); + pDnode->mgmts[BNODE].fp = bmGetMgmtFp(); pDnode->mgmts[MNODE].name = "mnode"; pDnode->mgmts[VNODES].name = "vnodes"; pDnode->mgmts[QNODE].name = "qnode"; @@ -172,7 +144,7 @@ SDnode *dndCreate(SDndCfg *pCfg) { } pMgmt->procType = PROC_SINGLE; - pMgmt->required = dndRequireOpenNode(pMgmt); + pMgmt->required = dndRequireNode(pMgmt); if (pMgmt->required) { if (taosMkDir(pMgmt->path) != 0) { terrno = TAOS_SYSTEM_ERROR(errno); @@ -189,7 +161,7 @@ SDnode *dndCreate(SDndCfg *pCfg) { _OVER: if (code != 0 && pDnode) { - dndClearDnodeMem(pDnode); + dndClearMemory(pDnode); tfree(pDnode); dError("failed to create dnode object since %s", terrstr()); } else { @@ -259,8 +231,8 @@ void dndClose(SDnode *pDnode) { dInfo("start to close dnode, data:%p", pDnode); dndSetStatus(pDnode, DND_STAT_STOPPED); - dndClearDnodeResource(pDnode); - dndClearDnodeMem(pDnode); + dndClearResource(pDnode); + dndClearMemory(pDnode); tfree(pDnode); dInfo("dnode object is closed, data:%p", pDnode); } @@ -288,9 +260,9 @@ int32_t dndInit() { return -1; } - // SVnodeOpt vnodeOpt = { - // .nthreads = tsNumOfCommitThreads, .putReqToVQueryQFp = dndPutReqToVQueryQ, .sendReqToDnodeFp = dndSendReqToDnode}; + // .nthreads = tsNumOfCommitThreads, .putReqToVQueryQFp = dndPutReqToVQueryQ, .sendReqToDnodeFp = + // dndSendReqToDnode}; // if (vnodeInit(&vnodeOpt) != 0) { // dError("failed to init vnode since %s", terrstr()); diff --git a/source/dnode/mgmt/mnode/inc/mm.h b/source/dnode/mgmt/mnode/inc/mmInt.h similarity index 97% rename from source/dnode/mgmt/mnode/inc/mm.h rename to source/dnode/mgmt/mnode/inc/mmInt.h index fde2cb7d3de24f081b999f1bcb1250423b3916cc..9d1a5c934f29a6f878abbecdefdef05849a7cef3 100644 --- a/source/dnode/mgmt/mnode/inc/mm.h +++ b/source/dnode/mgmt/mnode/inc/mmInt.h @@ -21,6 +21,8 @@ extern "C" { #endif #include "dndInt.h" +SMgmtFp mmGetMgmtFp(); + // interface int32_t mmInit(SDnode *pDnode); void mmCleanup(SDnode *pDnode); diff --git a/source/dnode/mgmt/mnode/src/mmFile.c b/source/dnode/mgmt/mnode/src/mmFile.c index 90b5df34106ba23535539fdbbec4a782983955c9..e6edfe1dced5967f66b0e2f25485914cb498e25c 100644 --- a/source/dnode/mgmt/mnode/src/mmFile.c +++ b/source/dnode/mgmt/mnode/src/mmFile.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "mm.h" +#include "mmInt.h" #if 0 int32_t mmReadFile(SDnode *pDnode) { diff --git a/source/dnode/mgmt/mnode/src/mmHandle.c b/source/dnode/mgmt/mnode/src/mmHandle.c index f013daaec01764e99ed0ff017d08c8d7b0ef182d..2fb0cb113ec4d67f80d9a1362ce8e7c65666a4c3 100644 --- a/source/dnode/mgmt/mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mnode/src/mmHandle.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "mm.h" +#include "mmInt.h" #if 0 #include "dndMgmt.h" diff --git a/source/dnode/mgmt/mnode/src/mmMgmt.c b/source/dnode/mgmt/mnode/src/mmMgmt.c index c3a1d18db3b65a65b145864aa8df7e39f5b8b82e..d4e61336ad2f066e551d3993260a5c3efe78dd8f 100644 --- a/source/dnode/mgmt/mnode/src/mmMgmt.c +++ b/source/dnode/mgmt/mnode/src/mmMgmt.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "mm.h" +#include "mmInt.h" #include "dndMgmt.h" #include "dndTransport.h" diff --git a/source/dnode/mgmt/mnode/src/mmWorker.c b/source/dnode/mgmt/mnode/src/mmWorker.c index a51523e2cb54869115492a2f34965c5eaad93054..021f35e8d7d23c03effa680abeb306b29df144ea 100644 --- a/source/dnode/mgmt/mnode/src/mmWorker.c +++ b/source/dnode/mgmt/mnode/src/mmWorker.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "mm.h" +#include "mmInt.h" #include "dndMgmt.h" #include "dndTransport.h" diff --git a/source/dnode/mgmt/qnode/inc/dndQnode.h b/source/dnode/mgmt/qnode/inc/qmInt.h similarity index 95% rename from source/dnode/mgmt/qnode/inc/dndQnode.h rename to source/dnode/mgmt/qnode/inc/qmInt.h index 677c234679db6cbab2103cdc487e0a22406d716c..48e5ea7deee399592ad139a843f42741e0f9b920 100644 --- a/source/dnode/mgmt/qnode/inc/dndQnode.h +++ b/source/dnode/mgmt/qnode/inc/qmInt.h @@ -21,6 +21,8 @@ extern "C" { #endif #include "dndInt.h" +SMgmtFp qmGetMgmtFp(); + int32_t dndInitQnode(SDnode *pDnode); void dndCleanupQnode(SDnode *pDnode); diff --git a/source/dnode/mgmt/qnode/src/dndQnode.c b/source/dnode/mgmt/qnode/src/dndQnode.c index cd2188452293f60b09de09bbb3b0f7baf19642ce..a2c9963772865c5348e0e4809de7711b2a73d0fa 100644 --- a/source/dnode/mgmt/qnode/src/dndQnode.c +++ b/source/dnode/mgmt/qnode/src/dndQnode.c @@ -14,10 +14,10 @@ */ #define _DEFAULT_SOURCE -#include "dndQnode.h" -#include "dndMgmt.h" -#include "dndTransport.h" -#include "dndWorker.h" +// #include "dndQnode.h" +// #include "dndMgmt.h" +// #include "dndTransport.h" +// #include "dndWorker.h" #if 0 static void dndProcessQnodeQueue(SDnode *pDnode, SRpcMsg *pMsg); diff --git a/source/dnode/mgmt/snode/inc/dndSnode.h b/source/dnode/mgmt/snode/inc/smInt.h similarity index 95% rename from source/dnode/mgmt/snode/inc/dndSnode.h rename to source/dnode/mgmt/snode/inc/smInt.h index 8cb883794df6b3f370278e6ba98c45f197e790fc..b01bf7640f582ba552a4b7ccea0047e3e17d76ae 100644 --- a/source/dnode/mgmt/snode/inc/dndSnode.h +++ b/source/dnode/mgmt/snode/inc/smInt.h @@ -21,6 +21,8 @@ extern "C" { #endif #include "dndInt.h" +SMgmtFp smGetMgmtFp(); + int32_t dndInitSnode(SDnode *pDnode); void dndCleanupSnode(SDnode *pDnode); diff --git a/source/dnode/mgmt/snode/src/dndSnode.c b/source/dnode/mgmt/snode/src/dndSnode.c index d50c9709ff97f7d914e890e29fe74c8a4bf0dbc9..a5e3bcefc0dea00d41a550867d37f8d1469e4a7c 100644 --- a/source/dnode/mgmt/snode/src/dndSnode.c +++ b/source/dnode/mgmt/snode/src/dndSnode.c @@ -14,10 +14,10 @@ */ #define _DEFAULT_SOURCE -#include "dndSnode.h" -#include "dndMgmt.h" -#include "dndTransport.h" -#include "dndWorker.h" +// #include "dndSnode.h" +// #include "dndMgmt.h" +// #include "dndTransport.h" +// #include "dndWorker.h" #if 0 static void dndProcessSnodeQueue(SDnode *pDnode, SRpcMsg *pMsg); diff --git a/source/dnode/mgmt/vnode/inc/dndVnodes.h b/source/dnode/mgmt/vnode/inc/vmInt.h similarity index 96% rename from source/dnode/mgmt/vnode/inc/dndVnodes.h rename to source/dnode/mgmt/vnode/inc/vmInt.h index 32f4260542e9aa820602a95f0a0c8664b5dd98e8..512f0fb2fa4e198d89a4cf5dc0ea0a024a616b1c 100644 --- a/source/dnode/mgmt/vnode/inc/dndVnodes.h +++ b/source/dnode/mgmt/vnode/inc/vmInt.h @@ -21,6 +21,9 @@ extern "C" { #endif #include "dndInt.h" +SMgmtFp vmGetMgmtFp() ; + + int32_t dndInitVnodes(SDnode *pDnode); void dndCleanupVnodes(SDnode *pDnode); void dndGetVnodeLoads(SDnode *pDnode, SArray *pLoads); diff --git a/source/dnode/mgmt/vnode/src/dndVnodes.c b/source/dnode/mgmt/vnode/src/dndVnodes.c index 8795551fc00f1d98476112ea76d4c97cbd49cc0d..5240f41ba5487741b549250bad9852c252f47e2b 100644 --- a/source/dnode/mgmt/vnode/src/dndVnodes.c +++ b/source/dnode/mgmt/vnode/src/dndVnodes.c @@ -14,10 +14,10 @@ */ #define _DEFAULT_SOURCE -#include "dndVnodes.h" -#include "dndMgmt.h" -#include "dndTransport.h" -#include "sync.h" +// #include "dndVnodes.h" +// #include "dndMgmt.h" +// #include "dndTransport.h" +// #include "sync.h" #if 0 typedef struct {