enh(query): opt filter check.
This commit is contained in:
parent
94c416eb30
commit
2d73a50469
|
@ -549,6 +549,19 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
|
||||||
tdListAppend(&p->list, pKey);
|
tdListAppend(&p->list, pKey);
|
||||||
} else {
|
} else {
|
||||||
// check if it exists or not
|
// check if it exists or not
|
||||||
|
size_t size = listNEles(&(*pEntry)->list);
|
||||||
|
if (size == 0) {
|
||||||
|
tdListAppend(&(*pEntry)->list, pKey);
|
||||||
|
} else if (size == 1) {
|
||||||
|
SListNode* pNode = listHead(&(*pEntry)->list);
|
||||||
|
uint64_t* p = (uint64_t*) pNode->data;
|
||||||
|
if (p[1] == ((uint64_t*)pKey)[1] && p[2] == ((uint64_t*)pKey)[2]) {
|
||||||
|
taosThreadMutexUnlock(pLock);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
} else { // not equal, append it
|
||||||
|
tdListAppend(&(*pEntry)->list, pKey);
|
||||||
|
}
|
||||||
|
} else { // more than one element
|
||||||
SListIter iter = {0};
|
SListIter iter = {0};
|
||||||
tdListInitIter(&(*pEntry)->list, &iter, TD_LIST_FORWARD);
|
tdListInitIter(&(*pEntry)->list, &iter, TD_LIST_FORWARD);
|
||||||
|
|
||||||
|
@ -565,6 +578,7 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
|
||||||
|
|
||||||
tdListAppend(&(*pEntry)->list, pKey);
|
tdListAppend(&(*pEntry)->list, pKey);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add to cache.
|
// add to cache.
|
||||||
taosLRUCacheInsert(pCache, buf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL,
|
taosLRUCacheInsert(pCache, buf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL,
|
||||||
|
|
Loading…
Reference in New Issue