Merge pull request #27427 from taosdata/fix/TD-31623
fix: meta cache insert freed issue
This commit is contained in:
commit
676ad15e19
|
@ -592,6 +592,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
|||
SMetaReader mr = {0};
|
||||
const char* idStr = pTask->id.str;
|
||||
int32_t insertRet = TAOS_LRU_STATUS_OK;
|
||||
STableCachedVal* pVal = NULL;
|
||||
|
||||
// currently only the tbname pseudo column
|
||||
if (numOfExpr <= 0) {
|
||||
|
@ -656,19 +657,11 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
|||
|
||||
pHandle->api.metaReaderFn.readerReleaseLock(&mr);
|
||||
|
||||
STableCachedVal* pVal = NULL;
|
||||
code = createTableCacheVal(&mr, &pVal);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
val = *pVal;
|
||||
freeReader = true;
|
||||
|
||||
insertRet = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(uint64_t), pVal,
|
||||
sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
if (insertRet != TAOS_LRU_STATUS_OK) {
|
||||
qError("failed to put meta into lru cache, code:%d, %s", insertRet, idStr);
|
||||
taosMemoryFreeClear(pVal);
|
||||
}
|
||||
} else {
|
||||
pCache->cacheHit += 1;
|
||||
STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h);
|
||||
|
@ -742,9 +735,17 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
|||
pBlock->info.rows = backupRows;
|
||||
|
||||
_end:
|
||||
if (insertRet != TAOS_LRU_STATUS_OK) {
|
||||
freeTableCachedValObj(&val);
|
||||
|
||||
if (NULL != pVal) {
|
||||
insertRet = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(uint64_t), pVal,
|
||||
sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
if (insertRet != TAOS_LRU_STATUS_OK) {
|
||||
qError("failed to put meta into lru cache, code:%d, %s", insertRet, idStr);
|
||||
taosMemoryFreeClear(pVal);
|
||||
freeTableCachedValObj(&val);
|
||||
}
|
||||
}
|
||||
|
||||
if (freeReader) {
|
||||
pHandle->api.metaReaderFn.clearReader(&mr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue