From 5bab977a4359c24274d4d60e12613dfe71926693 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 16:36:35 +0800 Subject: [PATCH] fix: create db errors --- source/dnode/mnode/impl/src/mndDb.c | 6 +++++- source/dnode/mnode/impl/src/mndVgroup.c | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 58404caa83..2379975db2 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -57,7 +57,6 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq); #ifndef TD_ENTERPRISE int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; } -int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { return 0; } #endif int32_t mndInitDb(SMnode *pMnode) { @@ -926,6 +925,11 @@ _exit: TAOS_RETURN(code); } +int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { + terrno = TSDB_CODE_OPS_NOT_SUPPORT; + return terrno; +} + static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; int32_t code = -1; diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index ddf42e0a59..913e6e3295 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -724,15 +724,18 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2 } if (dnodeList != NULL) { - bool inDnodeList = false; - for (int32_t index = 0; index < taosArrayGetSize(dnodeList); ++index) { - int32_t dnodeId = *(int32_t *)taosArrayGet(dnodeList, index); - if (pDnode->id == dnodeId) { - inDnodeList = true; + int32_t dnodeListSize = taosArrayGetSize(dnodeList); + if (dnodeListSize > 0) { + bool inDnodeList = false; + for (int32_t index = 0; index < dnodeListSize; ++index) { + int32_t dnodeId = *(int32_t *)taosArrayGet(dnodeList, index); + if (pDnode->id == dnodeId) { + inDnodeList = true; + } + } + if (!inDnodeList) { + return true; } - } - if (!inDnodeList) { - return true; } }