diff --git a/source/dnode/mnode/impl/src/mndOffset.c b/source/dnode/mnode/impl/src/mndOffset.c index 00753de0ecf726b90613e46bd0afd5bb20f9d88e..9f6108004db0809b70907e13ca32988e6d278a48 100644 --- a/source/dnode/mnode/impl/src/mndOffset.c +++ b/source/dnode/mnode/impl/src/mndOffset.c @@ -281,7 +281,7 @@ static int32_t mndSetDropOffsetRedoLogs(SMnode *pMnode, STrans *pTrans, SMqOffse } int32_t mndDropOffsetByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { - int32_t code = -1; + int32_t code = 0; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; @@ -297,15 +297,15 @@ int32_t mndDropOffsetByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { if (mndSetDropOffsetCommitLogs(pMnode, pTrans, pOffset) < 0) { sdbRelease(pSdb, pOffset); - goto END; + sdbCancelFetch(pSdb, pIter); + code = -1; + break; } sdbRelease(pSdb, pOffset); } - code = 0; -END: - return code; + return code; } int32_t mndDropOffsetByTopic(SMnode *pMnode, STrans *pTrans, const char *topic) { diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 245dc413f1c2e701e9ced22f353cf6a78f9815f1..8feed476cd6ed217e6d5b91ec948bcad0abbcc8f 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -824,7 +824,7 @@ int32_t mndSetDropSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj } int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { - int32_t code = -1; + int32_t code = 0; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; @@ -840,12 +840,14 @@ int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { if (mndSetDropSubCommitLogs(pMnode, pTrans, pSub) < 0) { sdbRelease(pSdb, pSub); - goto END; + sdbCancelFetch(pSdb, pIter); + code = -1; + break; } + + sdbRelease(pSdb, pSub); } - code = 0; -END: return code; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 7acfc95bfc2f658e0667e93a8ab5876eeb30dfd5..7e3e5a9838839b596e5ae5bf07bd3d19a2820d3f 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -833,7 +833,7 @@ static void mndCancelGetNextTopic(SMnode *pMnode, void *pIter) { } int32_t mndDropTopicByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { - int32_t code = -1; + int32_t code = 0; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; @@ -848,11 +848,14 @@ int32_t mndDropTopicByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { } if (mndSetDropTopicCommitLogs(pMnode, pTrans, pTopic) < 0) { - goto END; + sdbRelease(pSdb, pTopic); + sdbCancelFetch(pSdb, pIter); + code = -1; + break; } + + sdbRelease(pSdb, pTopic); } - code = 0; -END: return code; } diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 096a1534fdde3a12479ef295fbf459cca2973656..04587d96a8834e51b02ed6c93fbf2255ba82ac24 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -794,6 +794,7 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) { mError("trans:%d, can't execute since conflict with trans:%d, db1:%s db2:%s", pNew->id, pTrans->id, pTrans->dbname1, pTrans->dbname2); + conflict = true; sdbRelease(pMnode->pSdb, pTrans); }