tsdbCache/last: add DCLP to last lookup
This commit is contained in:
parent
ceb2948421
commit
bd0523ddb9
|
@ -1287,8 +1287,11 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUHand
|
||||||
// getTableCacheKeyS(uid, "l", key, &keyLen);
|
// getTableCacheKeyS(uid, "l", key, &keyLen);
|
||||||
getTableCacheKey(uid, 1, key, &keyLen);
|
getTableCacheKey(uid, 1, key, &keyLen);
|
||||||
LRUHandle *h = taosLRUCacheLookup(pCache, key, keyLen);
|
LRUHandle *h = taosLRUCacheLookup(pCache, key, keyLen);
|
||||||
if (h) {
|
if (!h) {
|
||||||
} else {
|
taosThreadMutexLock(&pTsdb->lruMutex);
|
||||||
|
|
||||||
|
h = taosLRUCacheLookup(pCache, key, keyLen);
|
||||||
|
if (!h) {
|
||||||
SArray *pLastArray = NULL;
|
SArray *pLastArray = NULL;
|
||||||
code = mergeLast(uid, pTsdb, &pLastArray);
|
code = mergeLast(uid, pTsdb, &pLastArray);
|
||||||
// if table's empty or error, return code of -1
|
// if table's empty or error, return code of -1
|
||||||
|
@ -1299,13 +1302,18 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUHand
|
||||||
}
|
}
|
||||||
|
|
||||||
_taos_lru_deleter_t deleter = deleteTableCacheLast;
|
_taos_lru_deleter_t deleter = deleteTableCacheLast;
|
||||||
LRUStatus status =
|
LRUStatus status = taosLRUCacheInsert(pCache, key, keyLen, pLastArray, pLastArray->capacity, deleter, NULL,
|
||||||
taosLRUCacheInsert(pCache, key, keyLen, pLastArray, pLastArray->capacity, deleter, NULL, TAOS_LRU_PRIORITY_LOW);
|
TAOS_LRU_PRIORITY_LOW);
|
||||||
if (status != TAOS_LRU_STATUS_OK) {
|
if (status != TAOS_LRU_STATUS_OK) {
|
||||||
code = -1;
|
code = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||||
|
|
||||||
h = taosLRUCacheLookup(pCache, key, keyLen);
|
h = taosLRUCacheLookup(pCache, key, keyLen);
|
||||||
|
} else {
|
||||||
|
taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*handle = h;
|
*handle = h;
|
||||||
|
|
Loading…
Reference in New Issue