chore: code refactor

This commit is contained in:
kailixu 2023-09-25 15:57:54 +08:00
parent f689ef8fe4
commit b0b4d782fc
5 changed files with 10 additions and 12 deletions

View File

@ -53,7 +53,6 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg);
int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg);
// dmWorker.c
int32_t dmPutNodeMsgToMgmtQueue(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);

View File

@ -20,7 +20,7 @@ static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) {
if (dmStartStatusThread(pMgmt) != 0) {
return -1;
}
#ifdef TD_ENTERPRISE
#if defined(TD_ENTERPRISE) && !defined(_TD_DARWIN_64)
if (dmStartNotifyThread(pMgmt) != 0) {
return -1;
}

View File

@ -246,6 +246,11 @@ void dmStopCrashReportThread(SDnodeMgmt *pMgmt) {
}
}
#if defined(TD_ENTERPRISE) && !defined(_TD_DARWIN_64)
int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg);
#else
static int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg) { return 0; }
#endif
static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
SDnodeMgmt *pMgmt = pInfo->ahandle;
@ -294,9 +299,7 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
code = dmProcessGrantReq(&pMgmt->pData->clusterId, pMsg);
break;
case TDMT_MND_GRANT_NOTIFY:
#ifndef _TD_DARWIN_64
code = dmProcessGrantNotify(NULL, pMsg);
#endif
break;
default:
terrno = TSDB_CODE_MSG_NOT_PROCESSED;

View File

@ -81,10 +81,10 @@ static void mndCancelGetNextDnode(SMnode *pMnode, void *pIter);
static int32_t mndMCfgGetValInt32(SMCfgDnodeReq *pInMCfgReq, int32_t opLen, int32_t *pOutValue);
#ifndef TD_ENTERPRISE
static int32_t mndUpdClusterInfo(SRpcMsg *pReq) { return 0; }
#else
#if defined(TD_ENTERPRISE) && !defined(_TD_DARWIN_64)
int32_t mndUpdClusterInfo(SRpcMsg *pReq);
#else
static int32_t mndUpdClusterInfo(SRpcMsg *pReq) { return 0; }
#endif
int32_t mndInitDnode(SMnode *pMnode) {
@ -688,9 +688,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
_OVER:
mndReleaseDnode(pMnode, pDnode);
taosArrayDestroy(statusReq.pVloads);
#ifndef _TD_DARWIN_64
mndUpdClusterInfo(pReq);
#endif
return code;
}
@ -723,9 +721,7 @@ static int32_t mndProcessNotifyReq(SRpcMsg *pReq) {
}
}
_OVER:
#ifndef _TD_DARWIN_64
mndUpdClusterInfo(pReq);
#endif
tFreeSNotifyReq(&notifyReq);
return code;
}

View File

@ -195,7 +195,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
}
static inline void metaTimeSeriesNotifyCheck(SMeta *pMeta) {
#ifdef TD_ENTERPRISE
#if defined(TD_ENTERPRISE) && !defined(_TD_DARWIN_64)
int64_t nTimeSeries = metaGetTimeSeriesNum(pMeta, 0);
int64_t deltaTS = nTimeSeries - pMeta->pVnode->config.vndStats.numOfReportedTimeSeries;
if (deltaTS > tsTimeSeriesThreshold) tsem_post(&dmNotifySem);