提交 99e15e0d 编写于 作者: H Haojun Liao

[td-225] update the hash func

上级 285d732e
...@@ -6640,7 +6640,7 @@ void freeqinfoFn(void *qhandle) { ...@@ -6640,7 +6640,7 @@ void freeqinfoFn(void *qhandle) {
} }
void* qOpenQueryMgmt(int32_t vgId) { void* qOpenQueryMgmt(int32_t vgId) {
const int32_t REFRESH_HANDLE_INTERVAL = 30; // every 30 seconds, refresh handle pool const int32_t REFRESH_HANDLE_INTERVAL = 60; // every 30 seconds, refresh handle pool
char cacheName[128] = {0}; char cacheName[128] = {0};
sprintf(cacheName, "qhandle_%d", vgId); sprintf(cacheName, "qhandle_%d", vgId);
......
...@@ -207,7 +207,7 @@ SCacheObj *taosCacheInit(int32_t keyType, int64_t refreshTimeInSeconds, bool ext ...@@ -207,7 +207,7 @@ SCacheObj *taosCacheInit(int32_t keyType, int64_t refreshTimeInSeconds, bool ext
return NULL; return NULL;
} }
pCacheObj->pHashTable = taosHashInit(128, taosGetDefaultHashFunction(keyType), false, HASH_ENTRY_LOCK); pCacheObj->pHashTable = taosHashInit(4096, taosGetDefaultHashFunction(keyType), false, HASH_ENTRY_LOCK);
pCacheObj->name = strdup(cacheName); pCacheObj->name = strdup(cacheName);
if (pCacheObj->pHashTable == NULL) { if (pCacheObj->pHashTable == NULL) {
free(pCacheObj); free(pCacheObj);
...@@ -648,12 +648,12 @@ void doCleanupDataCache(SCacheObj *pCacheObj) { ...@@ -648,12 +648,12 @@ void doCleanupDataCache(SCacheObj *pCacheObj) {
static void doCacheRefresh(SCacheObj* pCacheObj, int64_t time, __cache_free_fn_t fp) { static void doCacheRefresh(SCacheObj* pCacheObj, int64_t time, __cache_free_fn_t fp) {
SHashMutableIterator *pIter = taosHashCreateIter(pCacheObj->pHashTable); SHashMutableIterator *pIter = taosHashCreateIter(pCacheObj->pHashTable);
__cache_wr_lock(pCacheObj); // __cache_wr_lock(pCacheObj);
while (taosHashIterNext(pIter)) { while (taosHashIterNext(pIter)) {
SCacheDataNode *pNode = *(SCacheDataNode **)taosHashIterGet(pIter); SCacheDataNode *pNode = *(SCacheDataNode **)taosHashIterGet(pIter);
if (pNode->expireTime < time && T_REF_VAL_GET(pNode) <= 0) { if (pNode->expireTime < time && T_REF_VAL_GET(pNode) <= 0) {
taosCacheReleaseNode(pCacheObj, pNode); // taosCacheReleaseNode(pCacheObj, pNode);
continue; continue;
} }
...@@ -662,7 +662,7 @@ static void doCacheRefresh(SCacheObj* pCacheObj, int64_t time, __cache_free_fn_t ...@@ -662,7 +662,7 @@ static void doCacheRefresh(SCacheObj* pCacheObj, int64_t time, __cache_free_fn_t
} }
} }
__cache_unlock(pCacheObj); // __cache_unlock(pCacheObj);
taosHashDestroyIter(pIter); taosHashDestroyIter(pIter);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册