提交 71ca1d84 编写于 作者: H Haojun Liao

refactor: do some internal refactor.

上级 6bffcfaa
...@@ -451,7 +451,7 @@ static int checkAllEntriesInCache(const STagFilterResEntry* pEntry, SArray* pInv ...@@ -451,7 +451,7 @@ static int checkAllEntriesInCache(const STagFilterResEntry* pEntry, SArray* pInv
#define NEED_CHECK_CACHE_ITEM(_size, _acc_times) ((_size) >= 100 || (_acc_times) > 5000) #define NEED_CHECK_CACHE_ITEM(_size, _acc_times) ((_size) >= 100 || (_acc_times) > 5000)
static void removeInvalidCacheItem(SArray* pInvalidRes, struct STagFilterResEntry* pEntry) { static void removeInvalidCacheItem(SArray* pInvalidRes, struct STagFilterResEntry* pEntry, bool triggerByGet) {
if (pInvalidRes == NULL) { if (pInvalidRes == NULL) {
return; return;
} }
...@@ -464,7 +464,8 @@ static void removeInvalidCacheItem(SArray* pInvalidRes, struct STagFilterResEntr ...@@ -464,7 +464,8 @@ static void removeInvalidCacheItem(SArray* pInvalidRes, struct STagFilterResEntr
taosMemoryFree(*p1); taosMemoryFree(*p1);
} }
metaInfo("clear %d items in cache, remain:%d", s, TD_DLIST_NELES(&pEntry->list)); metaInfo("clear %d items in cache, remain:%d, acctime:%d, trigger by get:%d", s, listNEles(&pEntry->list),
pEntry->qTimes, triggerByGet);
pEntry->qTimes = 0; // reset the query times pEntry->qTimes = 0; // reset the query times
taosArrayDestroy(pInvalidRes); taosArrayDestroy(pInvalidRes);
} }
...@@ -515,7 +516,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK ...@@ -515,7 +516,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK
SArray* pInvalidRes = taosArrayInit(64, POINTER_BYTES); SArray* pInvalidRes = taosArrayInit(64, POINTER_BYTES);
checkAllEntriesInCache(*pEntry, pInvalidRes, keyLen, pCache, suid); checkAllEntriesInCache(*pEntry, pInvalidRes, keyLen, pCache, suid);
removeInvalidCacheItem(pInvalidRes, *pEntry); // remove the keys, of which query uid lists have been replaced already. removeInvalidCacheItem(pInvalidRes, *pEntry, true); // remove the keys, of which query uid lists have been replaced already.
taosThreadMutexUnlock(pLock); taosThreadMutexUnlock(pLock);
} }
...@@ -619,7 +620,7 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int ...@@ -619,7 +620,7 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
if (p[1] == ((uint64_t*)pKey)[1] && p[0] == ((uint64_t*)pKey)[0]) { if (p[1] == ((uint64_t*)pKey)[1] && p[0] == ((uint64_t*)pKey)[0]) {
// do remove invalid entry in hash // do remove invalid entry in hash
if (pInvalidRes != NULL) { if (pInvalidRes != NULL) {
removeInvalidCacheItem(pInvalidRes, *pEntry); removeInvalidCacheItem(pInvalidRes, *pEntry, false);
} }
taosThreadMutexUnlock(pLock); taosThreadMutexUnlock(pLock);
...@@ -643,7 +644,7 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int ...@@ -643,7 +644,7 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
// do remove invalid entry in hash // do remove invalid entry in hash
if (pInvalidRes != NULL) { if (pInvalidRes != NULL) {
removeInvalidCacheItem(pInvalidRes, *pEntry); removeInvalidCacheItem(pInvalidRes, *pEntry, false);
} }
tdListAppend(&(*pEntry)->list, pKey); tdListAppend(&(*pEntry)->list, pKey);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册