From 63861e65d0908f62f79115148aba9f01e1c58c1a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Mar 2022 19:25:33 +0800 Subject: [PATCH] shm --- source/dnode/mgmt/bnode/inc/bmMsg.h | 2 +- source/dnode/mgmt/container/inc/dndInt.h | 6 +-- source/dnode/mgmt/container/src/dndMonitor.c | 2 +- source/dnode/mgmt/container/src/dndNode.c | 2 +- .../dnode/mgmt/container/src/dndTransport.c | 2 +- source/dnode/mgmt/dnode/inc/dm.h | 5 ++- source/dnode/mgmt/dnode/inc/dmInt.h | 2 - source/dnode/mgmt/dnode/src/dmWorker.c | 5 +-- source/dnode/mgmt/mnode/inc/{mmMsg.h => mm.h} | 18 +++++---- source/dnode/mgmt/mnode/inc/mmFile.h | 32 ---------------- source/dnode/mgmt/mnode/inc/mmInt.h | 26 ++++++++----- source/dnode/mgmt/mnode/inc/mmWorker.h | 38 ------------------- source/dnode/mgmt/mnode/src/mmFile.c | 2 +- source/dnode/mgmt/mnode/src/mmInt.c | 4 +- source/dnode/mgmt/mnode/src/mmMsg.c | 4 +- 15 files changed, 42 insertions(+), 108 deletions(-) rename source/dnode/mgmt/mnode/inc/{mmMsg.h => mm.h} (58%) delete mode 100644 source/dnode/mgmt/mnode/inc/mmFile.h delete mode 100644 source/dnode/mgmt/mnode/inc/mmWorker.h diff --git a/source/dnode/mgmt/bnode/inc/bmMsg.h b/source/dnode/mgmt/bnode/inc/bmMsg.h index 3444b19fc5..d9ab4a204b 100644 --- a/source/dnode/mgmt/bnode/inc/bmMsg.h +++ b/source/dnode/mgmt/bnode/inc/bmMsg.h @@ -16,7 +16,7 @@ #ifndef _TD_DND_BNODE_HANDLE_H_ #define _TD_DND_BNODE_HANDLE_H_ -#include "mmInt.h" +#include "mm.h" #ifdef __cplusplus extern "C" { diff --git a/source/dnode/mgmt/container/inc/dndInt.h b/source/dnode/mgmt/container/inc/dndInt.h index dba1822b76..fe19365ef9 100644 --- a/source/dnode/mgmt/container/inc/dndInt.h +++ b/source/dnode/mgmt/container/inc/dndInt.h @@ -22,7 +22,7 @@ extern "C" { #endif -// dndInt.h +// dndInt.c int32_t dndInit(); void dndCleanup(); const char *dndStatStr(EDndStatus stat); @@ -30,14 +30,14 @@ void dndGetStartup(SDnode *pDnode, SStartupReq *pStartup); TdFilePtr dndCheckRunning(char *dataDir); void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pMsg); -// dndNode.h +// dndNode.c SDnode *dndCreate(const SDnodeOpt *pOption); void dndClose(SDnode *pDnode); int32_t dndRun(SDnode *pDnode); void dndHandleEvent(SDnode *pDnode, EDndEvent event); void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, SEpSet *pEpSet); -// dndTransport.h +// dndTransport.c int32_t dndInitServer(SDnode *pDnode); void dndCleanupServer(SDnode *pDnode); int32_t dndInitClient(SDnode *pDnode); diff --git a/source/dnode/mgmt/container/src/dndMonitor.c b/source/dnode/mgmt/container/src/dndMonitor.c index 9b4e270766..157d8b7547 100644 --- a/source/dnode/mgmt/container/src/dndMonitor.c +++ b/source/dnode/mgmt/container/src/dndMonitor.c @@ -17,7 +17,7 @@ #include "dndInt.h" #include "dmInt.h" -#include "mmInt.h" +#include "mm.h" #include "vmInt.h" static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) { diff --git a/source/dnode/mgmt/container/src/dndNode.c b/source/dnode/mgmt/container/src/dndNode.c index f22c08a6b9..20020d8963 100644 --- a/source/dnode/mgmt/container/src/dndNode.c +++ b/source/dnode/mgmt/container/src/dndNode.c @@ -18,7 +18,7 @@ #include "bmInt.h" #include "dmInt.h" -#include "mmInt.h" +#include "mm.h" #include "qmInt.h" #include "smInt.h" #include "vmInt.h" diff --git a/source/dnode/mgmt/container/src/dndTransport.c b/source/dnode/mgmt/container/src/dndTransport.c index 049aacd875..6c0d929d82 100644 --- a/source/dnode/mgmt/container/src/dndTransport.c +++ b/source/dnode/mgmt/container/src/dndTransport.c @@ -17,7 +17,7 @@ #include "dndInt.h" #include "dmInt.h" -#include "mmInt.h" +#include "mm.h" #define INTERNAL_USER "_dnd" #define INTERNAL_CKEY "_key" diff --git a/source/dnode/mgmt/dnode/inc/dm.h b/source/dnode/mgmt/dnode/inc/dm.h index d4f48f0796..05de6e0436 100644 --- a/source/dnode/mgmt/dnode/inc/dm.h +++ b/source/dnode/mgmt/dnode/inc/dm.h @@ -22,11 +22,12 @@ extern "C" { #endif -void dmGetMgmtFp(SMgmtWrapper *pWrapper); +void dmGetMgmtFp(SMgmtWrapper *pWrapper); +void dmInitMsgHandles(SMgmtWrapper *pWrapper); + void dmGetMnodeEpSet(SMgmtWrapper *pWrapper, SEpSet *pEpSet); void dmUpdateMnodeEpSet(SMgmtWrapper *pWrapper, SEpSet *pEpSet); void dmSendRedirectRsp(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); -void dmInitMsgHandles(SMgmtWrapper *pWrapper); int32_t dmStart(SMgmtWrapper *pWrapper); #ifdef __cplusplus diff --git a/source/dnode/mgmt/dnode/inc/dmInt.h b/source/dnode/mgmt/dnode/inc/dmInt.h index dd52aea8c1..8e67fe3639 100644 --- a/source/dnode/mgmt/dnode/inc/dmInt.h +++ b/source/dnode/mgmt/dnode/inc/dmInt.h @@ -43,8 +43,6 @@ int32_t dmReadFile(SDnodeMgmt *pMgmt); int32_t dmWriteFile(SDnodeMgmt *pMgmt); void dmUpdateDnodeEps(SDnodeMgmt *pMgmt, SArray *pDnodeEps); -// dmInt.c - // dmMsg.c void dmSendStatusReq(SDnodeMgmt *pMgmt); int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SNodeMsg *pMsg); diff --git a/source/dnode/mgmt/dnode/src/dmWorker.c b/source/dnode/mgmt/dnode/src/dmWorker.c index de57d1714c..f876fdc91c 100644 --- a/source/dnode/mgmt/dnode/src/dmWorker.c +++ b/source/dnode/mgmt/dnode/src/dmWorker.c @@ -17,7 +17,7 @@ #include "dmInt.h" #include "bmInt.h" -#include "mmInt.h" +#include "mm.h" #include "qmInt.h" #include "smInt.h" #include "vmInt.h" @@ -62,9 +62,6 @@ static void dmProcessQueue(SDnode *pDnode, SNodeMsg *pMsg) { case TDMT_DND_CREATE_MNODE: code = mmProcessCreateReq(dndGetWrapper(pDnode, MNODE)->pMgmt, pMsg); break; - case TDMT_DND_ALTER_MNODE: - code = mmProcessAlterReq(dndGetWrapper(pDnode, MNODE)->pMgmt, pMsg); - break; case TDMT_DND_DROP_MNODE: code = mmProcessDropReq(dndGetWrapper(pDnode, MNODE)->pMgmt, pMsg); break; diff --git a/source/dnode/mgmt/mnode/inc/mmMsg.h b/source/dnode/mgmt/mnode/inc/mm.h similarity index 58% rename from source/dnode/mgmt/mnode/inc/mmMsg.h rename to source/dnode/mgmt/mnode/inc/mm.h index bf577dad10..6d4e7f3598 100644 --- a/source/dnode/mgmt/mnode/inc/mmMsg.h +++ b/source/dnode/mgmt/mnode/inc/mm.h @@ -13,23 +13,27 @@ * along with this program. If not, see . */ -#ifndef _TD_DND_MNODE_MSG_H_ -#define _TD_DND_MNODE_MSG_H_ +#ifndef _TD_DND_MNODE_H_ +#define _TD_DND_MNODE_H_ -#include "mmInt.h" +#include "dnd.h" #ifdef __cplusplus extern "C" { #endif +void mmGetMgmtFp(SMgmtWrapper *pMgmt); void mmInitMsgHandles(SMgmtWrapper *pWrapper); -// int32_t mmProcessCreateReq(SDnode *pDnode, SRpcMsg *pRpcMsg); -// int32_t mmProcessAlterReq(SDnode *pDnode, SRpcMsg *pRpcMsg); -// int32_t mmProcessDropReq(SDnode *pDnode, SRpcMsg *pRpcMsg); +int32_t mmProcessCreateReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); +int32_t mmProcessDropReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); + +int32_t mmGetUserAuth(SMgmtWrapper *pWrapper, char *user, char *spi, char *encrypt, char *secret, char *ckey); +int32_t mmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo, + SMonGrantInfo *pGrantInfo); #ifdef __cplusplus } #endif -#endif /*_TD_DND_MNODE_MSG_H_*/ \ No newline at end of file +#endif /*_TD_DND_MNODE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/mnode/inc/mmFile.h b/source/dnode/mgmt/mnode/inc/mmFile.h deleted file mode 100644 index 8beceea305..0000000000 --- a/source/dnode/mgmt/mnode/inc/mmFile.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_DND_MNODE_FILE_H_ -#define _TD_DND_MNODE_FILE_H_ - -#include "mmInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t mmReadFile(SMnodeMgmt *pMgmt); -int32_t mmWriteFile(SMnodeMgmt *pMgmt); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_MNODE_FILE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/mnode/inc/mmInt.h b/source/dnode/mgmt/mnode/inc/mmInt.h index 3b43a34b52..357f60f703 100644 --- a/source/dnode/mgmt/mnode/inc/mmInt.h +++ b/source/dnode/mgmt/mnode/inc/mmInt.h @@ -16,7 +16,7 @@ #ifndef _TD_DND_MNODE_INT_H_ #define _TD_DND_MNODE_INT_H_ -#include "dnd.h" +#include "mm.h" #ifdef __cplusplus extern "C" { @@ -39,13 +39,11 @@ typedef struct SMnodeMgmt { SDnodeWorker syncWorker; } SMnodeMgmt; -// interface -void mmGetMgmtFp(SMgmtWrapper *pMgmt); -int32_t mmGetUserAuth(SMgmtWrapper *pWrapper, char *user, char *spi, char *encrypt, char *secret, char *ckey); -int32_t mmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo, - SMonGrantInfo *pGrantInfo); +// mmFile.c +int32_t mmReadFile(SMnodeMgmt *pMgmt); +int32_t mmWriteFile(SMnodeMgmt *pMgmt); -// mmInt.h +// mmInt.c SMnode *mmAcquire(SMnodeMgmt *pMgmt); void mmRelease(SMnodeMgmt *pMgmt, SMnode *pMnode); int32_t mmOpen(SMnodeMgmt *pMgmt, SMnodeOpt *pOption); @@ -53,10 +51,18 @@ int32_t mmAlter(SMnodeMgmt *pMgmt, SMnodeOpt *pOption); int32_t mmDrop(SMnodeMgmt *pMgmt); int32_t mmBuildOptionFromReq(SMnodeMgmt *pMgmt, SMnodeOpt *pOption, SDCreateMnodeReq *pCreate); -// mmHandle.h -int32_t mmProcessCreateReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); +// mmMsg.c int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); -int32_t mmProcessDropReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); + +// mmWorker.c +int32_t mmStartWorker(SMnodeMgmt *pMgmt); +void mmStopWorker(SMnodeMgmt *pMgmt); +int32_t mmProcessWriteMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); +int32_t mmProcessSyncMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); +int32_t mmProcessReadMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); + +int32_t mmPutMsgToWriteQueue(void *wrapper, SRpcMsg *pRpcMsg); +int32_t mmPutMsgToReadQueue(void *wrapper, SRpcMsg *pRpcMsg); #ifdef __cplusplus } diff --git a/source/dnode/mgmt/mnode/inc/mmWorker.h b/source/dnode/mgmt/mnode/inc/mmWorker.h deleted file mode 100644 index 91c1b30ff8..0000000000 --- a/source/dnode/mgmt/mnode/inc/mmWorker.h +++ /dev/null @@ -1,38 +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_MNODE_WORKER_H_ -#define _TD_DND_MNODE_WORKER_H_ - -#include "mmInt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t mmStartWorker(SMnodeMgmt *pMgmt); -void mmStopWorker(SMnodeMgmt *pMgmt); -int32_t mmProcessWriteMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); -int32_t mmProcessSyncMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); -int32_t mmProcessReadMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg); - -int32_t mmPutMsgToWriteQueue(void *wrapper, SRpcMsg *pRpcMsg); -int32_t mmPutMsgToReadQueue(void *wrapper, SRpcMsg *pRpcMsg); - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DND_MNODE_WORKER_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/mnode/src/mmFile.c b/source/dnode/mgmt/mnode/src/mmFile.c index a232d9a3ad..734654d9d4 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 "mmFile.h" +#include "mmInt.h" int32_t mmReadFile(SMnodeMgmt *pMgmt) { int32_t code = TSDB_CODE_DND_MNODE_READ_FILE_ERROR; diff --git a/source/dnode/mgmt/mnode/src/mmInt.c b/source/dnode/mgmt/mnode/src/mmInt.c index a33f570a19..9b1db6757a 100644 --- a/source/dnode/mgmt/mnode/src/mmInt.c +++ b/source/dnode/mgmt/mnode/src/mmInt.c @@ -15,10 +15,8 @@ #define _DEFAULT_SOURCE #include "mmInt.h" + #include "dmInt.h" -#include "mmFile.h" -#include "mmMsg.h" -#include "mmWorker.h" SMnode *mmAcquire(SMnodeMgmt *pMgmt) { SMnode *pMnode = NULL; diff --git a/source/dnode/mgmt/mnode/src/mmMsg.c b/source/dnode/mgmt/mnode/src/mmMsg.c index ef8585d61a..dcd2f07aa8 100644 --- a/source/dnode/mgmt/mnode/src/mmMsg.c +++ b/source/dnode/mgmt/mnode/src/mmMsg.c @@ -14,9 +14,8 @@ */ #define _DEFAULT_SOURCE -#include "mmMsg.h" +#include "mmInt.h" #include "dmInt.h" -#include "mmWorker.h" int32_t mmProcessCreateReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) { SDnode *pDnode = pMgmt->pDnode; @@ -181,6 +180,7 @@ void mmInitMsgHandles(SMgmtWrapper *pWrapper) { dndSetMsgHandle(pWrapper, TDMT_MND_KILL_TRANS, (NodeMsgFp)mmProcessWriteMsg); dndSetMsgHandle(pWrapper, TDMT_MND_GRANT, (NodeMsgFp)mmProcessWriteMsg); dndSetMsgHandle(pWrapper, TDMT_MND_AUTH, (NodeMsgFp)mmProcessReadMsg); + dndSetMsgHandle(pWrapper, TDMT_DND_ALTER_MNODE, (NodeMsgFp)mmProcessWriteMsg); dndSetMsgHandle(pWrapper, TDMT_MND_CREATE_TOPIC, (NodeMsgFp)mmProcessWriteMsg); dndSetMsgHandle(pWrapper, TDMT_MND_ALTER_TOPIC, (NodeMsgFp)mmProcessWriteMsg); dndSetMsgHandle(pWrapper, TDMT_MND_DROP_TOPIC, (NodeMsgFp)mmProcessWriteMsg); -- GitLab