fix(tsdb/cache): del from mem with time range
This commit is contained in:
parent
0ffc707f1b
commit
a9309cb295
|
@ -1167,26 +1167,33 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
||||||
|
|
||||||
// taosThreadMutexLock(&pTsdb->lruMutex);
|
// taosThreadMutexLock(&pTsdb->lruMutex);
|
||||||
|
|
||||||
|
bool erase = false;
|
||||||
LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[i], klen);
|
LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[i], klen);
|
||||||
if (h) {
|
if (h) {
|
||||||
SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h);
|
SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h);
|
||||||
if (pLastCol->dirty) {
|
if (pLastCol->dirty && (pLastCol->ts <= eKey && pLastCol->ts >= sKey)) {
|
||||||
pLastCol->dirty = 0;
|
pLastCol->dirty = 0;
|
||||||
|
erase = true;
|
||||||
}
|
}
|
||||||
taosLRUCacheRelease(pTsdb->lruCache, h, true);
|
taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||||
|
}
|
||||||
|
if (erase) {
|
||||||
|
taosLRUCacheErase(pTsdb->lruCache, keys_list[i], klen);
|
||||||
}
|
}
|
||||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[i], klen);
|
|
||||||
|
|
||||||
|
erase = false;
|
||||||
h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[num_keys + i], klen);
|
h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[num_keys + i], klen);
|
||||||
if (h) {
|
if (h) {
|
||||||
SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h);
|
SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h);
|
||||||
if (pLastCol->dirty) {
|
if (pLastCol->dirty && (pLastCol->ts <= eKey && pLastCol->ts >= sKey)) {
|
||||||
pLastCol->dirty = 0;
|
pLastCol->dirty = 0;
|
||||||
|
erase = true;
|
||||||
}
|
}
|
||||||
taosLRUCacheRelease(pTsdb->lruCache, h, true);
|
taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||||
|
}
|
||||||
|
if (erase) {
|
||||||
|
taosLRUCacheErase(pTsdb->lruCache, keys_list[num_keys + i], klen);
|
||||||
}
|
}
|
||||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[num_keys + i], klen);
|
|
||||||
|
|
||||||
// taosThreadMutexUnlock(&pTsdb->lruMutex);
|
// taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < num_keys; ++i) {
|
for (int i = 0; i < num_keys; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue