enh: remove user cache when user dropped
This commit is contained in:
parent
2ff0748022
commit
eb6b6ec882
|
@ -104,8 +104,6 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
releaseTscObj(pReq->connKey.tscRid);
|
releaseTscObj(pReq->connKey.tscRid);
|
||||||
// delete the tscObj
|
|
||||||
releaseTscObj(pReq->connKey.tscRid);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,6 +577,10 @@ static int32_t hbGetUserAuthInfo(SClientHbKey *connKey, SHbParam *param, SClient
|
||||||
return TSDB_CODE_APP_ERROR;
|
return TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if(pTscObj->dropped == 1) {
|
||||||
|
// releaseTscObj(connKey->tscRid);
|
||||||
|
// }
|
||||||
|
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
SKv kv = {.key = HEARTBEAT_KEY_USER_AUTHINFO};
|
SKv kv = {.key = HEARTBEAT_KEY_USER_AUTHINFO};
|
||||||
|
|
|
@ -2241,13 +2241,10 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t userDropped = msg->userAuth.dropped;
|
|
||||||
|
|
||||||
SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user));
|
SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user));
|
||||||
if (NULL == pUser) {
|
if (NULL == pUser) {
|
||||||
if (userDropped) {
|
if (msg->userAuth.dropped == 1) {
|
||||||
taosMemoryFreeClear(msg);
|
goto _return;
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SCtgUserAuth userAuth = {0};
|
SCtgUserAuth userAuth = {0};
|
||||||
|
@ -2265,8 +2262,10 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
|
||||||
CTG_CACHE_NUM_INC(CTG_CI_USER, 1);
|
CTG_CACHE_NUM_INC(CTG_CI_USER, 1);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
} else if(userDropped) {
|
} else if (msg->userAuth.dropped == 1) {
|
||||||
ctgRemoveCacheUser(pCtg, msg->userAuth.user);
|
if (ctgRemoveCacheUser(pCtg, msg->userAuth.user) == 0) {
|
||||||
|
CTG_CACHE_NUM_DEC(CTG_CI_USER, 1);
|
||||||
|
}
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -317,10 +317,14 @@ int32_t ctgRemoveCacheUser(SCatalog* pCtg, const char* user) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SCtgUserAuth* pUser = (SCtgUserAuth*)taosHashGet(pCtg->userCache, user, strlen(user));
|
SCtgUserAuth* pUser = (SCtgUserAuth*)taosHashGet(pCtg->userCache, user, strlen(user));
|
||||||
|
if (pUser) {
|
||||||
ctgFreeSCtgUserAuth(pUser);
|
ctgFreeSCtgUserAuth(pUser);
|
||||||
taosHashRemove(pCtg->userCache, user, strlen(user));
|
if (taosHashRemove(pCtg->userCache, user, strlen(user)) == 0) {
|
||||||
|
return 0; // user found and removed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctgFreeHandle(SCatalog* pCtg) {
|
void ctgFreeHandle(SCatalog* pCtg) {
|
||||||
|
|
Loading…
Reference in New Issue