refactor: mnode pre process msg
This commit is contained in:
parent
cc0b48f7be
commit
c9509acf22
|
@ -59,6 +59,12 @@ void mndClose(SMnode *pMnode);
|
||||||
* @param pMnode The mnode object.
|
* @param pMnode The mnode object.
|
||||||
*/
|
*/
|
||||||
int32_t mndStart(SMnode *pMnode);
|
int32_t mndStart(SMnode *pMnode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stop mnode
|
||||||
|
*
|
||||||
|
* @param pMnode The mnode object.
|
||||||
|
*/
|
||||||
void mndStop(SMnode *pMnode);
|
void mndStop(SMnode *pMnode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,17 +77,25 @@ void mndStop(SMnode *pMnode);
|
||||||
* @return int32_t 0 for success, -1 for failure.
|
* @return int32_t 0 for success, -1 for failure.
|
||||||
*/
|
*/
|
||||||
int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pCluster, SMonVgroupInfo *pVgroup, SMonGrantInfo *pGrant);
|
int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pCluster, SMonVgroupInfo *pVgroup, SMonGrantInfo *pGrant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get mnode loads for status msg.
|
||||||
|
*
|
||||||
|
* @param pMnode The mnode object.
|
||||||
|
* @param pLoad
|
||||||
|
* @return int32_t 0 for success, -1 for failure.
|
||||||
|
*/
|
||||||
int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad);
|
int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Process the read, write, sync request.
|
* @brief Process the rpc, sync request.
|
||||||
*
|
*
|
||||||
* @param pMsg The request msg.
|
* @param pMsg The request msg.
|
||||||
* @return int32_t 0 for success, -1 for failure.
|
* @return int32_t 0 for success, -1 for failure.
|
||||||
*/
|
*/
|
||||||
int32_t mndProcessRpcMsg(SRpcMsg *pMsg);
|
int32_t mndProcessRpcMsg(SRpcMsg *pMsg);
|
||||||
int32_t mndProcessSyncMsg(SRpcMsg *pMsg);
|
int32_t mndProcessSyncMsg(SRpcMsg *pMsg);
|
||||||
int32_t mndPreprocessQueryMsg(SMnode * pMnode, SRpcMsg * pMsg);
|
int32_t mndPreProcessMsg(SRpcMsg *pMsg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generate machine code
|
* @brief Generate machine code
|
||||||
|
|
|
@ -114,7 +114,8 @@ int32_t mmPutMsgToReadQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mmPutMsgToQueryQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t mmPutMsgToQueryQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
if (mndPreprocessQueryMsg(pMgmt->pMnode, pMsg) != 0) {
|
pMsg->info.node = pMgmt->pMnode;
|
||||||
|
if (mndPreProcessMsg(pMsg) != 0) {
|
||||||
dError("msg:%p, failed to pre-process in mnode since %s, type:%s", pMsg, terrstr(), TMSG_INFO(pMsg->msgType));
|
dError("msg:%p, failed to pre-process in mnode since %s, type:%s", pMsg, terrstr(), TMSG_INFO(pMsg->msgType));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,10 @@
|
||||||
#include "mndMnode.h"
|
#include "mndMnode.h"
|
||||||
#include "qworker.h"
|
#include "qworker.h"
|
||||||
|
|
||||||
int32_t mndPreprocessQueryMsg(SMnode * pMnode, SRpcMsg * pMsg) {
|
int32_t mndPreProcessMsg(SRpcMsg *pMsg) {
|
||||||
if (TDMT_VND_QUERY != pMsg->msgType) {
|
if (TDMT_VND_QUERY != pMsg->msgType) return 0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
SMnode *pMnode = pMsg->info.node;
|
||||||
return qWorkerPreprocessQueryMsg(pMnode->pQuery, pMsg);
|
return qWorkerPreprocessQueryMsg(pMnode->pQuery, pMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue