Merge pull request #27642 from taosdata/fix/TD-31845

fix(tsdb/cache): copy entry before transfering to lru
This commit is contained in:
Hongze Cheng 2024-09-03 19:01:00 +08:00 committed by GitHub
commit 9810df98c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 9 deletions

View File

@ -1692,19 +1692,18 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
goto _exit;
}
SLastCol lastCol = *pLastCol;
TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(&lastCol, NULL));
LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter,
NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
if (status != TAOS_LRU_STATUS_OK) {
code = -1;
}
SLastCol lastCol = *pLastCol;
TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(&lastCol, NULL));
taosArraySet(pLastArray, idxKey->idx, &lastCol);
taosArrayRemove(remainCols, j);
taosArrayRemove(ignoreFromRocks, j);
} else {
++j;
}