From 3487d4f8558defa8e21614d9d1a2ff1aaafac2ce Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Mar 2022 19:39:43 +0800 Subject: [PATCH] shm --- source/dnode/mgmt/bnode/inc/bmFile.h | 0 source/dnode/mgmt/bnode/inc/bmInt.h | 16 +++++++ source/dnode/mgmt/bnode/inc/bmMgmt.h | 0 source/dnode/mgmt/bnode/inc/bmMsg.h | 31 ------------ source/dnode/mgmt/bnode/inc/bmWorker.h | 42 ---------------- source/dnode/mgmt/bnode/src/bmInt.c | 1 - source/dnode/mgmt/bnode/src/bmMsg.c | 3 +- source/dnode/mgmt/container/inc/dndInt.h | 8 ++++ source/dnode/mgmt/container/src/dndMonitor.c | 4 -- source/dnode/mgmt/container/src/dndNode.c | 7 --- .../dnode/mgmt/container/src/dndTransport.c | 3 -- source/dnode/mgmt/dnode/src/dmMsg.c | 2 +- source/dnode/mgmt/dnode/src/dmWorker.c | 5 +- source/dnode/mgmt/mnode/inc/mmInt.h | 1 + source/dnode/mgmt/mnode/src/mmInt.c | 2 - source/dnode/mgmt/mnode/src/mmMsg.c | 1 - source/dnode/mgmt/mnode/src/mmWorker.c | 2 - source/dnode/mgmt/qnode/inc/qmFile.h | 0 source/dnode/mgmt/qnode/inc/qmInt.h | 18 +++++++ source/dnode/mgmt/qnode/inc/qmMgmt.h | 0 source/dnode/mgmt/qnode/inc/qmMsg.h | 33 ------------- source/dnode/mgmt/qnode/inc/qmWorker.h | 42 ---------------- source/dnode/mgmt/qnode/src/qmInt.c | 1 - source/dnode/mgmt/qnode/src/qmMsg.c | 3 +- source/dnode/mgmt/snode/inc/smFile.h | 0 source/dnode/mgmt/snode/inc/smInt.h | 16 +++++++ source/dnode/mgmt/snode/inc/smMgmt.h | 0 source/dnode/mgmt/snode/inc/smMsg.h | 31 ------------ source/dnode/mgmt/snode/inc/smWorker.h | 42 ---------------- source/dnode/mgmt/snode/src/smInt.c | 1 - source/dnode/mgmt/snode/src/smMsg.c | 3 +- source/dnode/mgmt/vnode/inc/{vmMsg.h => vm.h} | 28 +++++++---- source/dnode/mgmt/vnode/inc/vmFile.h | 33 ------------- source/dnode/mgmt/vnode/inc/vmInt.h | 48 +++++++++++-------- source/dnode/mgmt/vnode/inc/vmWorker.h | 44 ----------------- source/dnode/mgmt/vnode/src/vmFile.c | 2 +- source/dnode/mgmt/vnode/src/vmInt.c | 6 +-- source/dnode/mgmt/vnode/src/vmMsg.c | 15 +++--- source/dnode/mgmt/vnode/src/vmWorker.c | 3 +- 39 files changed, 122 insertions(+), 375 deletions(-) delete mode 100644 source/dnode/mgmt/bnode/inc/bmFile.h delete mode 100644 source/dnode/mgmt/bnode/inc/bmMgmt.h delete mode 100644 source/dnode/mgmt/bnode/inc/bmMsg.h delete mode 100644 source/dnode/mgmt/bnode/inc/bmWorker.h delete mode 100644 source/dnode/mgmt/qnode/inc/qmFile.h delete mode 100644 source/dnode/mgmt/qnode/inc/qmMgmt.h delete mode 100644 source/dnode/mgmt/qnode/inc/qmMsg.h delete mode 100644 source/dnode/mgmt/qnode/inc/qmWorker.h delete mode 100644 source/dnode/mgmt/snode/inc/smFile.h delete mode 100644 source/dnode/mgmt/snode/inc/smMgmt.h delete mode 100644 source/dnode/mgmt/snode/inc/smMsg.h delete mode 100644 source/dnode/mgmt/snode/inc/smWorker.h rename source/dnode/mgmt/vnode/inc/{vmMsg.h => vm.h} (55%) delete mode 100644 source/dnode/mgmt/vnode/inc/vmFile.h delete mode 100644 source/dnode/mgmt/vnode/inc/vmWorker.h diff --git a/source/dnode/mgmt/bnode/inc/bmFile.h b/source/dnode/mgmt/bnode/inc/bmFile.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/dnode/mgmt/bnode/inc/bmInt.h b/source/dnode/mgmt/bnode/inc/bmInt.h index 504356279c..3427f670a8 100644 --- a/source/dnode/mgmt/bnode/inc/bmInt.h +++ b/source/dnode/mgmt/bnode/inc/bmInt.h @@ -43,6 +43,22 @@ void dndProcessBnodeWriteMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); int32_t bmProcessCreateReq(SBnodeMgmt *pMgmt, SNodeMsg *pRpcMsg); int32_t bmProcessDropReq(SBnodeMgmt *pMgmt, SNodeMsg *pRpcMsg); +void bmInitMsgHandles(SMgmtWrapper *pWrapper); + +int32_t bmStartWorker(SDnode *pDnode); +void bmStopWorker(SDnode *pDnode); +void bmInitMsgFp(SMnodeMgmt *pMgmt); +void bmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); +int32_t bmPutMsgToWriteQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); +int32_t bmPutMsgToReadQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); +void bmConsumeChildQueue(SDnode *pDnode, SNodeMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); +void bmConsumeParentQueue(SDnode *pDnode, SRpcMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); + +void bmProcessWriteMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg); +void bmProcessSyncMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg); +void bmProcessReadMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg); + + #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/bnode/inc/bmMgmt.h b/source/dnode/mgmt/bnode/inc/bmMgmt.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/dnode/mgmt/bnode/inc/bmMsg.h b/source/dnode/mgmt/bnode/inc/bmMsg.h deleted file mode 100644 index d9ab4a204b..0000000000 --- a/source/dnode/mgmt/bnode/inc/bmMsg.h +++ /dev/null @@ -1,31 +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_HANDLE_H_ -#define _TD_DND_BNODE_HANDLE_H_ - -#include "mm.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void bmInitMsgHandles(SMgmtWrapper *pWrapper); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_BNODE_HANDLE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/bnode/inc/bmWorker.h b/source/dnode/mgmt/bnode/inc/bmWorker.h deleted file mode 100644 index 1f81c9d7af..0000000000 --- a/source/dnode/mgmt/bnode/inc/bmWorker.h +++ /dev/null @@ -1,42 +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_WORKER_H_ -#define _TD_DND_BNODE_WORKER_H_ - -#include "bmInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t bmStartWorker(SDnode *pDnode); -void bmStopWorker(SDnode *pDnode); -void bmInitMsgFp(SMnodeMgmt *pMgmt); -void bmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); -int32_t bmPutMsgToWriteQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); -int32_t bmPutMsgToReadQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); -void bmConsumeChildQueue(SDnode *pDnode, SNodeMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); -void bmConsumeParentQueue(SDnode *pDnode, SRpcMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); - -void bmProcessWriteMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg); -void bmProcessSyncMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg); -void bmProcessReadMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_BNODE_WORKER_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/bnode/src/bmInt.c b/source/dnode/mgmt/bnode/src/bmInt.c index 6241b2e8b2..ac696b4638 100644 --- a/source/dnode/mgmt/bnode/src/bmInt.c +++ b/source/dnode/mgmt/bnode/src/bmInt.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "bmInt.h" -#include "bmMsg.h" bool bmRequireNode(SMgmtWrapper *pWrapper) { return false; } diff --git a/source/dnode/mgmt/bnode/src/bmMsg.c b/source/dnode/mgmt/bnode/src/bmMsg.c index 15ca5e9cc5..d81e80da74 100644 --- a/source/dnode/mgmt/bnode/src/bmMsg.c +++ b/source/dnode/mgmt/bnode/src/bmMsg.c @@ -14,8 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "bmMsg.h" -#include "bmWorker.h" +#include "bmInt.h" int32_t bmProcessCreateReq(SBnodeMgmt *pMgmt, SNodeMsg *pRpcMsg) {return 0;} int32_t bmProcessDropReq(SBnodeMgmt *pMgmt, SNodeMsg *pRpcMsg) {return 0;} diff --git a/source/dnode/mgmt/container/inc/dndInt.h b/source/dnode/mgmt/container/inc/dndInt.h index fe19365ef9..4960b022f4 100644 --- a/source/dnode/mgmt/container/inc/dndInt.h +++ b/source/dnode/mgmt/container/inc/dndInt.h @@ -18,6 +18,14 @@ #include "dnd.h" +#include "bmInt.h" +#include "dm.h" +#include "dndInt.h" +#include "mm.h" +#include "qmInt.h" +#include "smInt.h" +#include "vm.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/dnode/mgmt/container/src/dndMonitor.c b/source/dnode/mgmt/container/src/dndMonitor.c index 866ab58b3f..beeee685dc 100644 --- a/source/dnode/mgmt/container/src/dndMonitor.c +++ b/source/dnode/mgmt/container/src/dndMonitor.c @@ -16,10 +16,6 @@ #define _DEFAULT_SOURCE #include "dndInt.h" -#include "dm.h" -#include "mm.h" -#include "vmInt.h" - static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) { tstrncpy(pInfo->logdir.name, tsLogDir, sizeof(pInfo->logdir.name)); pInfo->logdir.size = tsLogSpace.size; diff --git a/source/dnode/mgmt/container/src/dndNode.c b/source/dnode/mgmt/container/src/dndNode.c index 73b65eb61f..709e44faf9 100644 --- a/source/dnode/mgmt/container/src/dndNode.c +++ b/source/dnode/mgmt/container/src/dndNode.c @@ -16,13 +16,6 @@ #define _DEFAULT_SOURCE #include "dndInt.h" -#include "bmInt.h" -#include "dm.h" -#include "mm.h" -#include "qmInt.h" -#include "smInt.h" -#include "vmInt.h" - static void dndResetLog(SMgmtWrapper *pMgmt) { char logname[24] = {0}; snprintf(logname, sizeof(logname), "%slog", pMgmt->name); diff --git a/source/dnode/mgmt/container/src/dndTransport.c b/source/dnode/mgmt/container/src/dndTransport.c index d4bfb30e92..43e49678cb 100644 --- a/source/dnode/mgmt/container/src/dndTransport.c +++ b/source/dnode/mgmt/container/src/dndTransport.c @@ -16,9 +16,6 @@ #define _DEFAULT_SOURCE #include "dndInt.h" -#include "dm.h" -#include "mm.h" - #define INTERNAL_USER "_dnd" #define INTERNAL_CKEY "_key" #define INTERNAL_SECRET "_pwd" diff --git a/source/dnode/mgmt/dnode/src/dmMsg.c b/source/dnode/mgmt/dnode/src/dmMsg.c index 033543a43e..22551974d2 100644 --- a/source/dnode/mgmt/dnode/src/dmMsg.c +++ b/source/dnode/mgmt/dnode/src/dmMsg.c @@ -15,7 +15,7 @@ #define _DEFAULT_SOURCE #include "dmInt.h" -#include "vmInt.h" +#include "vm.h" void dmSendStatusReq(SDnodeMgmt *pMgmt) { SDnode *pDnode = pMgmt->pDnode; diff --git a/source/dnode/mgmt/dnode/src/dmWorker.c b/source/dnode/mgmt/dnode/src/dmWorker.c index f876fdc91c..ecb0b6a09d 100644 --- a/source/dnode/mgmt/dnode/src/dmWorker.c +++ b/source/dnode/mgmt/dnode/src/dmWorker.c @@ -14,13 +14,12 @@ */ #define _DEFAULT_SOURCE -#include "dmInt.h" - #include "bmInt.h" +#include "dmInt.h" #include "mm.h" #include "qmInt.h" #include "smInt.h" -#include "vmInt.h" +#include "vm.h" static void *dmThreadRoutine(void *param) { SDnodeMgmt *pMgmt = param; diff --git a/source/dnode/mgmt/mnode/inc/mmInt.h b/source/dnode/mgmt/mnode/inc/mmInt.h index 357f60f703..2d79d560a0 100644 --- a/source/dnode/mgmt/mnode/inc/mmInt.h +++ b/source/dnode/mgmt/mnode/inc/mmInt.h @@ -16,6 +16,7 @@ #ifndef _TD_DND_MNODE_INT_H_ #define _TD_DND_MNODE_INT_H_ +#include "dm.h" #include "mm.h" #ifdef __cplusplus diff --git a/source/dnode/mgmt/mnode/src/mmInt.c b/source/dnode/mgmt/mnode/src/mmInt.c index 0ddeb86d87..75237aa912 100644 --- a/source/dnode/mgmt/mnode/src/mmInt.c +++ b/source/dnode/mgmt/mnode/src/mmInt.c @@ -16,8 +16,6 @@ #define _DEFAULT_SOURCE #include "mmInt.h" -#include "dm.h" - SMnode *mmAcquire(SMnodeMgmt *pMgmt) { SMnode *pMnode = NULL; int32_t refCount = 0; diff --git a/source/dnode/mgmt/mnode/src/mmMsg.c b/source/dnode/mgmt/mnode/src/mmMsg.c index 637f42b228..3f0a293d84 100644 --- a/source/dnode/mgmt/mnode/src/mmMsg.c +++ b/source/dnode/mgmt/mnode/src/mmMsg.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "mmInt.h" -#include "dm.h" int32_t mmProcessCreateReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) { SDnode *pDnode = pMgmt->pDnode; diff --git a/source/dnode/mgmt/mnode/src/mmWorker.c b/source/dnode/mgmt/mnode/src/mmWorker.c index bdd88c70aa..68dc1c1259 100644 --- a/source/dnode/mgmt/mnode/src/mmWorker.c +++ b/source/dnode/mgmt/mnode/src/mmWorker.c @@ -16,8 +16,6 @@ #define _DEFAULT_SOURCE #include "mmInt.h" -#include "dm.h" - static void mmProcessQueue(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) { dTrace("msg:%p, will be processed", pMsg); SMnode *pMnode = mmAcquire(pMgmt); diff --git a/source/dnode/mgmt/qnode/inc/qmFile.h b/source/dnode/mgmt/qnode/inc/qmFile.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/dnode/mgmt/qnode/inc/qmInt.h b/source/dnode/mgmt/qnode/inc/qmInt.h index f616e11f9c..45412f8a3c 100644 --- a/source/dnode/mgmt/qnode/inc/qmInt.h +++ b/source/dnode/mgmt/qnode/inc/qmInt.h @@ -48,6 +48,24 @@ void dndProcessQnodeFetchMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); int32_t qmProcessCreateReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg); int32_t qmProcessDropReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg); +void qmInitMsgHandles(SMgmtWrapper *pWrapper); +int32_t qmProcessCreateReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg); +int32_t qmProcessDropReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg); + +int32_t qmStartWorker(SDnode *pDnode); +void qmStopWorker(SDnode *pDnode); +void qmInitMsgFp(SMnodeMgmt *pMgmt); +void qmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); +int32_t qmPutMsgToWriteQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); +int32_t qmPutMsgToReadQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); +void qmConsumeChildQueue(SDnode *pDnode, SNodeMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); +void qmConsumeParentQueue(SDnode *pDnode, SRpcMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); + +void qmProcessWriteMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); +void qmProcessSyncMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); +void qmProcessReadMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); + + #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/qnode/inc/qmMgmt.h b/source/dnode/mgmt/qnode/inc/qmMgmt.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/dnode/mgmt/qnode/inc/qmMsg.h b/source/dnode/mgmt/qnode/inc/qmMsg.h deleted file mode 100644 index ef8e88722c..0000000000 --- a/source/dnode/mgmt/qnode/inc/qmMsg.h +++ /dev/null @@ -1,33 +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_QNODE_HANDLE_H_ -#define _TD_DND_QNODE_HANDLE_H_ - -#include "qmInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void qmInitMsgHandles(SMgmtWrapper *pWrapper); -int32_t qmProcessCreateReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg); -int32_t qmProcessDropReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_QNODE_HANDLE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/qnode/inc/qmWorker.h b/source/dnode/mgmt/qnode/inc/qmWorker.h deleted file mode 100644 index aaba32538d..0000000000 --- a/source/dnode/mgmt/qnode/inc/qmWorker.h +++ /dev/null @@ -1,42 +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_QNODE_WORKER_H_ -#define _TD_DND_QNODE_WORKER_H_ - -#include "qmInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t qmStartWorker(SDnode *pDnode); -void qmStopWorker(SDnode *pDnode); -void qmInitMsgFp(SMnodeMgmt *pMgmt); -void qmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); -int32_t qmPutMsgToWriteQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); -int32_t qmPutMsgToReadQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); -void qmConsumeChildQueue(SDnode *pDnode, SNodeMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); -void qmConsumeParentQueue(SDnode *pDnode, SRpcMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); - -void qmProcessWriteMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); -void qmProcessSyncMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); -void qmProcessReadMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_QNODE_WORKER_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/qnode/src/qmInt.c b/source/dnode/mgmt/qnode/src/qmInt.c index ae7fce26cf..37b475518d 100644 --- a/source/dnode/mgmt/qnode/src/qmInt.c +++ b/source/dnode/mgmt/qnode/src/qmInt.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "qmInt.h" -#include "qmMsg.h" bool qmRequireNode(SMgmtWrapper *pWrapper) { return false; } diff --git a/source/dnode/mgmt/qnode/src/qmMsg.c b/source/dnode/mgmt/qnode/src/qmMsg.c index 871a4603b4..2673a9138c 100644 --- a/source/dnode/mgmt/qnode/src/qmMsg.c +++ b/source/dnode/mgmt/qnode/src/qmMsg.c @@ -14,8 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "qmMsg.h" -#include "qmWorker.h" +#include "qmInt.h" int32_t qmProcessCreateReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg) {return 0;} int32_t qmProcessDropReq(SQnodeMgmt *pMgmt, SNodeMsg *pMsg){return 0;} diff --git a/source/dnode/mgmt/snode/inc/smFile.h b/source/dnode/mgmt/snode/inc/smFile.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/dnode/mgmt/snode/inc/smInt.h b/source/dnode/mgmt/snode/inc/smInt.h index 437aac6f30..fccccafb62 100644 --- a/source/dnode/mgmt/snode/inc/smInt.h +++ b/source/dnode/mgmt/snode/inc/smInt.h @@ -42,6 +42,22 @@ void dndProcessSnodeWriteMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); int32_t smProcessCreateReq(SSnodeMgmt *pMgmt, SNodeMsg *pMsg); int32_t smProcessDropReq(SSnodeMgmt *pMgmt, SNodeMsg *pMsg); +void smInitMsgHandles(SMgmtWrapper *pWrapper); + +int32_t smStartWorker(SDnode *pDnode); +void smStopWorker(SDnode *pDnode); +void smInitMsgFp(SMnodeMgmt *pMgmt); +void smProcessRpcMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); +int32_t smPutMsgToWriteQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); +int32_t smPutMsgToReadQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); +void smConsumeChildQueue(SDnode *pDnode, SNodeMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); +void smConsumeParentQueue(SDnode *pDnode, SRpcMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); + +void smProcessWriteMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); +void smProcessSyncMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); +void smProcessReadMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); + + #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/snode/inc/smMgmt.h b/source/dnode/mgmt/snode/inc/smMgmt.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/dnode/mgmt/snode/inc/smMsg.h b/source/dnode/mgmt/snode/inc/smMsg.h deleted file mode 100644 index 3caaee7107..0000000000 --- a/source/dnode/mgmt/snode/inc/smMsg.h +++ /dev/null @@ -1,31 +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_SNODE_HANDLE_H_ -#define _TD_DND_SNODE_HANDLE_H_ - -#include "smInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void smInitMsgHandles(SMgmtWrapper *pWrapper); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_SNODE_HANDLE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/snode/inc/smWorker.h b/source/dnode/mgmt/snode/inc/smWorker.h deleted file mode 100644 index 973a590c96..0000000000 --- a/source/dnode/mgmt/snode/inc/smWorker.h +++ /dev/null @@ -1,42 +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_SNODE_WORKER_H_ -#define _TD_DND_SNODE_WORKER_H_ - -#include "smInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t smStartWorker(SDnode *pDnode); -void smStopWorker(SDnode *pDnode); -void smInitMsgFp(SMnodeMgmt *pMgmt); -void smProcessRpcMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); -int32_t smPutMsgToWriteQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); -int32_t smPutMsgToReadQueue(SDnode *pDnode, SRpcMsg *pRpcMsg); -void smConsumeChildQueue(SDnode *pDnode, SNodeMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); -void smConsumeParentQueue(SDnode *pDnode, SRpcMsg *pMsg, int32_t msgLen, void *pCont, int32_t contLen); - -void smProcessWriteMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); -void smProcessSyncMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); -void smProcessReadMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_SNODE_WORKER_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/snode/src/smInt.c b/source/dnode/mgmt/snode/src/smInt.c index 0b367d2660..80c190bf98 100644 --- a/source/dnode/mgmt/snode/src/smInt.c +++ b/source/dnode/mgmt/snode/src/smInt.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "smInt.h" -#include "smMsg.h" bool smRequireNode(SMgmtWrapper *pWrapper) { return false; } diff --git a/source/dnode/mgmt/snode/src/smMsg.c b/source/dnode/mgmt/snode/src/smMsg.c index 859474b60b..7ebc11c5a5 100644 --- a/source/dnode/mgmt/snode/src/smMsg.c +++ b/source/dnode/mgmt/snode/src/smMsg.c @@ -14,8 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "smMsg.h" -#include "smWorker.h" +#include "smInt.h" int32_t smProcessCreateReq(SSnodeMgmt *pMgmt, SNodeMsg *pMsg) {return 0;} int32_t smProcessDropReq(SSnodeMgmt *pMgmt, SNodeMsg *pMsg) {return 0;} diff --git a/source/dnode/mgmt/vnode/inc/vmMsg.h b/source/dnode/mgmt/vnode/inc/vm.h similarity index 55% rename from source/dnode/mgmt/vnode/inc/vmMsg.h rename to source/dnode/mgmt/vnode/inc/vm.h index 58e1d9d0a8..ddb3a3bab3 100644 --- a/source/dnode/mgmt/vnode/inc/vmMsg.h +++ b/source/dnode/mgmt/vnode/inc/vm.h @@ -13,25 +13,35 @@ * along with this program. If not, see . */ -#ifndef _TD_DND_VNODE_HANDLE_H_ -#define _TD_DND_VNODE_HANDLE_H_ +#ifndef _TD_DND_VNODES_H_ +#define _TD_DND_VNODES_H_ -#include "vmInt.h" +#include "dnd.h" #ifdef __cplusplus extern "C" { #endif +typedef struct { + int32_t openVnodes; + int32_t totalVnodes; + int32_t masterNum; + int64_t numOfSelectReqs; + int64_t numOfInsertReqs; + int64_t numOfInsertSuccessReqs; + int64_t numOfBatchInsertReqs; + int64_t numOfBatchInsertSuccessReqs; +} SVnodesStat; + +void vmGetMgmtFp(SMgmtWrapper *pWrapper); void vmInitMsgHandles(SMgmtWrapper *pWrapper); -int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); -int32_t vmProcessAlterVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); -int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); -int32_t vmProcessSyncVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); -int32_t vmProcessCompactVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); +void vmGetVnodeLoads(SMgmtWrapper *pWrapper, SArray *pLoads); +int32_t vmGetTfsMonitorInfo(SMgmtWrapper *pWrapper, SMonDiskInfo *pInfo); +void vmGetVnodeReqs(SMgmtWrapper *pWrapper, SMonDnodeInfo *pInfo); #ifdef __cplusplus } #endif -#endif /*_TD_DND_VNODE_HANDLE_H_*/ \ No newline at end of file +#endif /*_TD_DND_VNODES_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/vnode/inc/vmFile.h b/source/dnode/mgmt/vnode/inc/vmFile.h deleted file mode 100644 index 585eafaf21..0000000000 --- a/source/dnode/mgmt/vnode/inc/vmFile.h +++ /dev/null @@ -1,33 +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_VNODES_FILE_H_ -#define _TD_DND_VNODES_FILE_H_ - -#include "vmInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes); -int32_t vmWriteVnodesToFile(SVnodesMgmt *pMgmt); -SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_VNODES_FILE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/vnode/inc/vmInt.h b/source/dnode/mgmt/vnode/inc/vmInt.h index bd4a604f3e..0869ba0d55 100644 --- a/source/dnode/mgmt/vnode/inc/vmInt.h +++ b/source/dnode/mgmt/vnode/inc/vmInt.h @@ -16,23 +16,14 @@ #ifndef _TD_DND_VNODES_INT_H_ #define _TD_DND_VNODES_INT_H_ -#include "dnd.h" +#include "dm.h" +#include "sync.h" +#include "vm.h" #ifdef __cplusplus extern "C" { #endif -typedef struct { - int32_t openVnodes; - int32_t totalVnodes; - int32_t masterNum; - int64_t numOfSelectReqs; - int64_t numOfInsertReqs; - int64_t numOfInsertSuccessReqs; - int64_t numOfBatchInsertReqs; - int64_t numOfBatchInsertSuccessReqs; -} SVnodesStat; - typedef struct SVnodesMgmt { SHashObj *hash; SRWLatch latch; @@ -85,18 +76,37 @@ typedef struct { SWrapperCfg *pCfgs; } SVnodeThread; -// interface -void vmGetMgmtFp(SMgmtWrapper *pWrapper); -void vmGetVnodeLoads(SMgmtWrapper *pWrapper, SArray *pLoads); -int32_t vmGetTfsMonitorInfo(SMgmtWrapper *pWrapper, SMonDiskInfo *pInfo); -void vmGetVnodeReqs(SMgmtWrapper *pWrapper, SMonDnodeInfo *pInfo); - -// vmInt.h +// vmInt.c SVnodeObj *vmAcquireVnode(SVnodesMgmt *pMgmt, int32_t vgId); void vmReleaseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode); int32_t vmOpenVnode(SVnodesMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl); void vmCloseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode); +// vmMsg.c +int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); +int32_t vmProcessAlterVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); +int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); +int32_t vmProcessSyncVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); +int32_t vmProcessCompactVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq); + +// vmFile.c +int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes); +int32_t vmWriteVnodesToFile(SVnodesMgmt *pMgmt); +SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes); + +// vmWorker.c +int32_t vmStartWorker(SVnodesMgmt *pMgmt); +void vmStopWorker(SVnodesMgmt *pMgmt); +int32_t vmAllocQueue(SVnodesMgmt *pMgmt, SVnodeObj *pVnode); +void vmFreeQueue(SVnodesMgmt *pMgmt, SVnodeObj *pVnode); + +int32_t vmPutMsgToQueryQueue(SVnodesMgmt *pMgmt, SRpcMsg *pMsg); +int32_t vmPutMsgToApplyQueue(SVnodesMgmt *pMgmt, int32_t vgId, SRpcMsg *pMsg); + +int32_t vmProcessWriteMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); +int32_t vmProcessSyncMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); +int32_t vmProcessQueryMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); +int32_t vmProcessFetchMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); int32_t vmProcessMgmtMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); #ifdef __cplusplus diff --git a/source/dnode/mgmt/vnode/inc/vmWorker.h b/source/dnode/mgmt/vnode/inc/vmWorker.h deleted file mode 100644 index 26e1a8f0d4..0000000000 --- a/source/dnode/mgmt/vnode/inc/vmWorker.h +++ /dev/null @@ -1,44 +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_VNODE_WORKER_H_ -#define _TD_DND_VNODE_WORKER_H_ - -#include "vmInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t vmStartWorker(SVnodesMgmt *pMgmt); -void vmStopWorker(SVnodesMgmt *pMgmt); -int32_t vmAllocQueue(SVnodesMgmt *pMgmt, SVnodeObj *pVnode); -void vmFreeQueue(SVnodesMgmt *pMgmt, SVnodeObj *pVnode); - -int32_t vmPutMsgToQueryQueue(SVnodesMgmt *pMgmt, SRpcMsg *pMsg); -int32_t vmPutMsgToApplyQueue(SVnodesMgmt *pMgmt, int32_t vgId, SRpcMsg *pMsg); - -int32_t vmProcessWriteMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); -int32_t vmProcessSyncMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); -int32_t vmProcessQueryMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); -int32_t vmProcessFetchMsg(SVnodesMgmt *pMgmt, SNodeMsg *pMsg); - - - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_VNODE_WORKER_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/vnode/src/vmFile.c b/source/dnode/mgmt/vnode/src/vmFile.c index fb3b00b081..4faecc61d0 100644 --- a/source/dnode/mgmt/vnode/src/vmFile.c +++ b/source/dnode/mgmt/vnode/src/vmFile.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "vmFile.h" +#include "vmInt.h" SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes) { taosRLockLatch(&pMgmt->latch); diff --git a/source/dnode/mgmt/vnode/src/vmInt.c b/source/dnode/mgmt/vnode/src/vmInt.c index 31f66e1a47..0d78223dea 100644 --- a/source/dnode/mgmt/vnode/src/vmInt.c +++ b/source/dnode/mgmt/vnode/src/vmInt.c @@ -14,11 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "vmFile.h" -#include "vmMsg.h" -#include "vmWorker.h" - -#include "sync.h" +#include "vmInt.h" SVnodeObj *vmAcquireVnode(SVnodesMgmt *pMgmt, int32_t vgId) { SVnodeObj *pVnode = NULL; diff --git a/source/dnode/mgmt/vnode/src/vmMsg.c b/source/dnode/mgmt/vnode/src/vmMsg.c index 1d3e47939b..96cb95bcb7 100644 --- a/source/dnode/mgmt/vnode/src/vmMsg.c +++ b/source/dnode/mgmt/vnode/src/vmMsg.c @@ -14,10 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "vmMsg.h" -#include "vmFile.h" -#include "vmWorker.h" -#include "dm.h" +#include "vmInt.h" static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->vgId = pCreate->vgId; @@ -56,7 +53,7 @@ static void vmGenerateWrapperCfg(SVnodesMgmt *pMgmt, SCreateVnodeReq *pCreate, S } int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { - SRpcMsg *pReq = &pMsg->rpcMsg; + SRpcMsg *pReq = &pMsg->rpcMsg; SCreateVnodeReq createReq = {0}; if (tDeserializeSCreateVnodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; @@ -115,7 +112,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { } int32_t vmProcessAlterVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { - SRpcMsg *pReq = &pMsg->rpcMsg; + SRpcMsg *pReq = &pMsg->rpcMsg; SAlterVnodeReq alterReq = {0}; if (tDeserializeSCreateVnodeReq(pReq->pCont, pReq->contLen, &alterReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; @@ -157,7 +154,7 @@ int32_t vmProcessAlterVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { } int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { - SRpcMsg *pReq = &pMsg->rpcMsg; + SRpcMsg *pReq = &pMsg->rpcMsg; SDropVnodeReq dropReq = {0}; if (tDeserializeSDropVnodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; @@ -188,7 +185,7 @@ int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { } int32_t vmProcessSyncVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { - SRpcMsg *pReq = &pMsg->rpcMsg; + SRpcMsg *pReq = &pMsg->rpcMsg; SSyncVnodeReq syncReq = {0}; tDeserializeSDropVnodeReq(pReq->pCont, pReq->contLen, &syncReq); @@ -212,7 +209,7 @@ int32_t vmProcessSyncVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { } int32_t vmProcessCompactVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { - SRpcMsg *pReq = &pMsg->rpcMsg; + SRpcMsg *pReq = &pMsg->rpcMsg; SCompactVnodeReq compatcReq = {0}; tDeserializeSDropVnodeReq(pReq->pCont, pReq->contLen, &compatcReq); diff --git a/source/dnode/mgmt/vnode/src/vmWorker.c b/source/dnode/mgmt/vnode/src/vmWorker.c index b1dba6d000..ee0a4b216e 100644 --- a/source/dnode/mgmt/vnode/src/vmWorker.c +++ b/source/dnode/mgmt/vnode/src/vmWorker.c @@ -14,8 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "vmWorker.h" -#include "vmMsg.h" +#include "vmInt.h" static void vmProcessQueryQueue(SVnodeObj *pVnode, SRpcMsg *pMsg) { vnodeProcessQueryMsg(pVnode->pImpl, pMsg); }