From a4b92760f09d4eab9ac336abc7603b6a04995134 Mon Sep 17 00:00:00 2001 From: kailixu Date: Sat, 23 Sep 2023 18:10:08 +0800 Subject: [PATCH] enh: grant notify optimize --- source/common/src/tmsg.c | 7 ++++--- source/dnode/mnode/impl/src/mndDnode.c | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e1ea76f463..a9f83cc21a 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1076,9 +1076,10 @@ int32_t tDeserializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) { goto _exit; } for (int32_t i = 0; i < nVgroup; ++i) { - SVnodeLoadLite *vload = TARRAY_GET_ELEM(pReq->pVloads, i); - if (tDecodeI32(&decoder, &(vload->vgId)) < 0) goto _exit; - if (tDecodeI64(&decoder, &(vload->nTimeSeries)) < 0) goto _exit; + SVnodeLoadLite vload; + if (tDecodeI32(&decoder, &(vload.vgId)) < 0) goto _exit; + if (tDecodeI64(&decoder, &(vload.nTimeSeries)) < 0) goto _exit; + taosArrayPush(pReq->pVloads, &vload); } } diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 300bd6fbb9..9c7d8ee90f 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -697,13 +697,13 @@ static int32_t mndProcessNotifyReq(SRpcMsg *pReq) { goto _OVER; } - // int64_t clusterid = mndGetClusterId(pMnode); - // if (notifyReq.clusterId != 0 && notifyReq.clusterId != clusterid) { - // code = TSDB_CODE_MND_DNODE_DIFF_CLUSTER; - // mWarn("dnode:%d, its clusterid:%" PRId64 " differ from current cluster:%" PRId64 " since %s", notifyReq.dnodeId, - // notifyReq.clusterId, clusterid, tstrerror(code)); - // goto _OVER; - // } + int64_t clusterid = mndGetClusterId(pMnode); + if (notifyReq.clusterId != 0 && notifyReq.clusterId != clusterid) { + code = TSDB_CODE_MND_DNODE_DIFF_CLUSTER; + mWarn("dnode:%d, its clusterid:%" PRId64 " differ from current cluster:%" PRId64 " since %s", notifyReq.dnodeId, + notifyReq.clusterId, clusterid, tstrerror(code)); + goto _OVER; + } int32_t nVgroup = taosArrayGetSize(notifyReq.pVloads); for (int32_t v = 0; v < nVgroup; ++v) {