From 6e53fa15dce46c7c5d4e00563e26db6b053e8db8 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 26 Aug 2024 17:06:31 +0800 Subject: [PATCH 1/3] fix trans retry error --- source/dnode/mnode/impl/src/mndIndex.c | 14 +++++++------- source/dnode/vnode/src/meta/metaTable.c | 2 +- source/dnode/vnode/src/vnd/vnodeSvr.c | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndIndex.c b/source/dnode/mnode/impl/src/mndIndex.c index 8786c3a934..6dd963b0ba 100644 --- a/source/dnode/mnode/impl/src/mndIndex.c +++ b/source/dnode/mnode/impl/src/mndIndex.c @@ -89,7 +89,7 @@ static int32_t mndFindSuperTableTagId(const SStbObj *pStb, const char *tagName, } } - return -1; + return TSDB_CODE_MND_TAG_NOT_EXIST; } int mndSetCreateIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb, SIdxObj *pIdx) { @@ -188,7 +188,7 @@ int mndSetDropIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbOb sdbRelease(pSdb, pVgroup); code = TSDB_CODE_MND_RETURN_VALUE_NULL; if (terrno != 0) code = terrno; - return -1; + return code; } STransAction action = {0}; action.epSet = mndGetVgroupEpset(pMnode, pVgroup); @@ -199,7 +199,7 @@ int mndSetDropIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbOb taosMemoryFree(pReq); sdbCancelFetch(pSdb, pIter); sdbRelease(pSdb, pVgroup); - return -1; + return code; } sdbRelease(pSdb, pVgroup); } @@ -899,8 +899,8 @@ static int32_t mndProcessGetIdxReq(SRpcMsg *pReq) { int32_t mndDropIdxsByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { int32_t code = 0; - SSdb *pSdb = pMnode->pSdb; - void *pIter = NULL; + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; while (1) { SIdxObj *pIdx = NULL; @@ -944,8 +944,8 @@ int32_t mndGetIdxsByTagName(SMnode *pMnode, SStbObj *pStb, char *tagName, SIdxOb } int32_t mndDropIdxsByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { int32_t code = 0; - SSdb *pSdb = pMnode->pSdb; - void *pIter = NULL; + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; while (1) { SIdxObj *pIdx = NULL; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 0334990365..9270a3e681 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -808,7 +808,7 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq) } if (pCol == NULL) { - code = TSDB_CODE_VND_COL_NOT_EXISTS; + code = 0; goto _err; } diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 75db6e2925..7b61ed3cdf 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -2327,6 +2327,7 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t ver, void *pReq, pRsp->contLen = 0; if ((code = tDeserializeSDropIdxReq(pReq, len, &req))) { + pRsp->code = code; return code; } From 9c6dcda4d82df90c75d23a5d53d5aa6554640fd9 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 26 Aug 2024 17:35:59 +0800 Subject: [PATCH 2/3] fix trans retry error --- source/dnode/vnode/src/meta/metaTable.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 9270a3e681..2e7efb004d 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -808,7 +808,10 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq) } if (pCol == NULL) { + metaError("vgId:%d, failed to drop index on %s.%s,since %s", TD_VID(pMeta->pVnode), pReq->stb, pReq->colName, + tstrerror(TSDB_CODE_VND_COL_NOT_EXISTS)); code = 0; + goto _err; } From e2481c4409aaa397ec64c8f929137ab0bff8aaa4 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 26 Aug 2024 17:40:29 +0800 Subject: [PATCH 3/3] fix trans retry error --- source/dnode/mnode/impl/src/mndIndex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndIndex.c b/source/dnode/mnode/impl/src/mndIndex.c index 6dd963b0ba..5ff577ae06 100644 --- a/source/dnode/mnode/impl/src/mndIndex.c +++ b/source/dnode/mnode/impl/src/mndIndex.c @@ -824,7 +824,7 @@ static int32_t mndDropIdx(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SIdxObj *p } mInfo("trans:%d, used to drop idx:%s", pTrans->id, pIdx->name); - mndTransSetDbName(pTrans, pDb->name, NULL); + mndTransSetDbName(pTrans, pDb->name, pStb->name); TAOS_CHECK_GOTO(mndTransCheckConflict(pMnode, pTrans), NULL, _OVER); mndTransSetSerial(pTrans);