From 552236d4b0fba54e2286ea4ab83d5cf2f65a0237 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 8 Dec 2021 10:12:37 +0800 Subject: [PATCH] TD-10431 user drop --- source/dnode/mgmt/impl/test/user/user.cpp | 2 +- source/dnode/mnode/impl/src/mndTrans.c | 5 ++++- source/dnode/mnode/sdb/src/sdbHash.c | 12 ++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source/dnode/mgmt/impl/test/user/user.cpp b/source/dnode/mgmt/impl/test/user/user.cpp index 081229f825..9dc8d99596 100644 --- a/source/dnode/mgmt/impl/test/user/user.cpp +++ b/source/dnode/mgmt/impl/test/user/user.cpp @@ -286,7 +286,7 @@ TEST_F(DndTestUser, AlterUser_01) { SRpcMsg rpcMsg = {0}; rpcMsg.pCont = pReq; - rpcMsg.contLen = sizeof(SDropUserMsg); + rpcMsg.contLen = sizeof(SAlterUserMsg); rpcMsg.msgType = TSDB_MSG_TYPE_ALTER_USER; sendMsg(pClient, &rpcMsg); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 0a15f03149..3a53472d45 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -263,7 +263,10 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOldTrans, STrans *pNewT return 0; } -static int32_t trnGenerateTransId() { return 1; } +static int32_t trnGenerateTransId() { + static int32_t tmp = 0; + return ++tmp; +} STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, void *rpcHandle) { STrans *pTrans = calloc(1, sizeof(STrans)); diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index a852389d80..8d8daf5ce5 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -56,7 +56,8 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * if (pOldRow != NULL) { taosWUnLockLatch(pLock); sdbFreeRow(pRow); - return TSDB_CODE_SDB_OBJ_ALREADY_THERE; + terrno = TSDB_CODE_SDB_OBJ_ALREADY_THERE; + return terrno; } pRow->refCount = 1; @@ -65,7 +66,8 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * if (taosHashPut(hash, pRow->pObj, keySize, &pRow, sizeof(void *)) != 0) { taosWUnLockLatch(pLock); sdbFreeRow(pRow); - return TSDB_CODE_SDB_OBJ_ALREADY_THERE; + terrno = TSDB_CODE_SDB_OBJ_ALREADY_THERE; + return terrno; } taosWUnLockLatch(pLock); @@ -78,7 +80,8 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * taosHashRemove(hash, pRow->pObj, keySize); taosWUnLockLatch(pLock); sdbFreeRow(pRow); - return code; + terrno = code; + return terrno; } } @@ -120,7 +123,8 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * if (ppOldRow == NULL || *ppOldRow == NULL) { taosWUnLockLatch(pLock); sdbFreeRow(pRow); - return TSDB_CODE_SDB_OBJ_NOT_THERE; + terrno = TSDB_CODE_SDB_OBJ_NOT_THERE; + return terrno; } SSdbRow *pOldRow = *ppOldRow;