From 29cb13cf281bc35106237340a061d11aed782737 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 10 Feb 2022 16:37:22 +0800 Subject: [PATCH] update vload info every time --- source/dnode/mnode/impl/src/mndDnode.c | 42 +++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 4cbf7ea07c..93c6b492bd 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -322,6 +322,27 @@ static int32_t mndProcessStatusReq(SMnodeMsg *pReq) { } } + int32_t numOfVloads = (int32_t)taosArrayGetSize(statusReq.pVloads); + for (int32_t v = 0; v < numOfVloads; ++v) { + SVnodeLoad *pVload = taosArrayGet(statusReq.pVloads, v); + + SVgObj *pVgroup = mndAcquireVgroup(pMnode, pVload->vgId); + if (pVgroup != NULL) { + if (pVload->role == TAOS_SYNC_STATE_LEADER) { + pVgroup->numOfTables = pVload->numOfTables; + pVgroup->numOfTimeSeries = pVload->numOfTimeSeries; + pVgroup->totalStorage = pVload->totalStorage; + pVgroup->compStorage = pVload->compStorage; + pVgroup->pointsWritten = pVload->pointsWritten; + } + for (int32_t vg = 0; vg < pVgroup->replica; ++vg) { + pVgroup->vnodeGid[vg].role = pVload->role; + } + } + + mndReleaseVgroup(pMnode, pVgroup); + } + int64_t curMs = taosGetTimestampMs(); bool online = mndIsDnodeOnline(pMnode, pDnode, curMs); bool dnodeChanged = (statusReq.dver != sdbGetTableVer(pMnode->pSdb, SDB_DNODE)); @@ -374,27 +395,6 @@ static int32_t mndProcessStatusReq(SMnodeMsg *pReq) { pDnode->numOfCores = statusReq.numOfCores; pDnode->numOfSupportVnodes = statusReq.numOfSupportVnodes; - int32_t numOfVloads = (int32_t)taosArrayGetSize(statusReq.pVloads); - for (int32_t v = 0; v < numOfVloads; ++v) { - SVnodeLoad *pVload = taosArrayGet(statusReq.pVloads, v); - - SVgObj *pVgroup = mndAcquireVgroup(pMnode, pVload->vgId); - if (pVgroup != NULL) { - if (pVload->role == TAOS_SYNC_STATE_LEADER) { - pVgroup->numOfTables = pVload->numOfTables; - pVgroup->numOfTimeSeries = pVload->numOfTimeSeries; - pVgroup->totalStorage = pVload->totalStorage; - pVgroup->compStorage = pVload->compStorage; - pVgroup->pointsWritten = pVload->pointsWritten; - } - for (int32_t vg = 0; vg < pVgroup->replica; ++vg) { - pVgroup->vnodeGid[vg].role = pVload->role; - } - } - - mndReleaseVgroup(pMnode, pVgroup); - } - SStatusRsp statusRsp = {0}; statusRsp.dver = sdbGetTableVer(pMnode->pSdb, SDB_DNODE); statusRsp.dnodeCfg.dnodeId = pDnode->id; -- GitLab