From 99e15e0d6d1644721442ef3c187232c29b595605 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 31 Jul 2020 16:31:19 +0800 Subject: [PATCH] [td-225] update the hash func --- src/query/src/qExecutor.c | 2 +- src/util/src/tcache.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 8afc44f939..9ae407e078 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -6640,7 +6640,7 @@ void freeqinfoFn(void *qhandle) { } 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}; sprintf(cacheName, "qhandle_%d", vgId); diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 65b2e99337..3efa31dc84 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -108,7 +108,7 @@ static void taosTrashCanEmpty(SCacheObj *pCacheObj, bool force); /** * release node * @param pCacheObj cache object - * @param pNode data node + * @param pNode data node */ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNode *pNode) { if (pNode->signature != (uint64_t)pNode) { @@ -207,7 +207,7 @@ SCacheObj *taosCacheInit(int32_t keyType, int64_t refreshTimeInSeconds, bool ext 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); if (pCacheObj->pHashTable == NULL) { free(pCacheObj); @@ -648,12 +648,12 @@ void doCleanupDataCache(SCacheObj *pCacheObj) { static void doCacheRefresh(SCacheObj* pCacheObj, int64_t time, __cache_free_fn_t fp) { SHashMutableIterator *pIter = taosHashCreateIter(pCacheObj->pHashTable); - __cache_wr_lock(pCacheObj); +// __cache_wr_lock(pCacheObj); while (taosHashIterNext(pIter)) { SCacheDataNode *pNode = *(SCacheDataNode **)taosHashIterGet(pIter); if (pNode->expireTime < time && T_REF_VAL_GET(pNode) <= 0) { - taosCacheReleaseNode(pCacheObj, pNode); +// taosCacheReleaseNode(pCacheObj, pNode); continue; } @@ -662,7 +662,7 @@ static void doCacheRefresh(SCacheObj* pCacheObj, int64_t time, __cache_free_fn_t } } - __cache_unlock(pCacheObj); +// __cache_unlock(pCacheObj); taosHashDestroyIter(pIter); } -- GitLab