From 344237071edd706c9057988a04cf9fe56f59babd Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 20 May 2022 15:37:39 +0800 Subject: [PATCH] fix user auth failed issue --- source/client/src/clientHb.c | 14 ++++++++++---- source/dnode/mnode/impl/src/mndUser.c | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index fc39e80c1e..5d6241d4f4 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -45,7 +45,7 @@ static int32_t hbProcessUserAuthInfoRsp(void *value, int32_t valueLen, struct SC catalogUpdateUserAuthInfo(pCatalog, rsp); } - tFreeSUserAuthBatchRsp(&batchRsp); + taosArrayDestroy(batchRsp.pArray); return TSDB_CODE_SUCCESS; } @@ -285,6 +285,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) { int64_t *rid = pIter; SRequestObj *pRequest = acquireRequest(*rid); if (NULL == pRequest) { + pIter = taosHashIterate(pObj->pRequests, pIter); continue; } @@ -544,7 +545,7 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) { } taosArrayPush(pBatchReq->reqs, pOneReq); - hbClearClientHbReq(pOneReq); + //hbClearClientHbReq(pOneReq); pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); } @@ -565,6 +566,11 @@ void hbClearReqInfo(SAppHbMgr *pAppHbMgr) { tFreeReqKvHash(pOneReq->info); taosHashClear(pOneReq->info); + if (pOneReq->query) { + taosArrayDestroy(pOneReq->query->queryDesc); + taosMemoryFreeClear(pOneReq->query); + } + pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); } } @@ -745,13 +751,13 @@ int hbMgrInit() { hbMgrInitHandle(); // init backgroud thread - /*hbCreateThread();*/ + hbCreateThread(); return 0; } void hbMgrCleanUp() { - // hbStopThread(); + hbStopThread(); // destroy all appHbMgr int8_t old = atomic_val_compare_exchange_8(&clientHbMgr.inited, 1, 0); diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index b59175d86c..f2a42e3083 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -233,6 +233,7 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) { mTrace("user:%s, perform update action, old row:%p new row:%p", pOld->user, pOld, pNew); taosWLockLatch(&pOld->lock); pOld->updateTime = pNew->updateTime; + pOld->authVersion = pNew->authVersion; memcpy(pOld->pass, pNew->pass, TSDB_PASSWORD_LEN); TSWAP(pOld->readDbs, pNew->readDbs); TSWAP(pOld->writeDbs, pNew->writeDbs); @@ -765,6 +766,7 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_ continue; } + pUsers[i].version = ntohl(pUsers[i].version); if (pUser->authVersion <= pUsers[i].version) { mndReleaseUser(pMnode, pUser); continue;