fix: meta cache insert freed issue
This commit is contained in:
parent
c998f31044
commit
b40735baae
|
@ -592,6 +592,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
SMetaReader mr = {0};
|
SMetaReader mr = {0};
|
||||||
const char* idStr = pTask->id.str;
|
const char* idStr = pTask->id.str;
|
||||||
int32_t insertRet = TAOS_LRU_STATUS_OK;
|
int32_t insertRet = TAOS_LRU_STATUS_OK;
|
||||||
|
STableCachedVal* pVal = NULL;
|
||||||
|
|
||||||
// currently only the tbname pseudo column
|
// currently only the tbname pseudo column
|
||||||
if (numOfExpr <= 0) {
|
if (numOfExpr <= 0) {
|
||||||
|
@ -656,19 +657,11 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
|
|
||||||
pHandle->api.metaReaderFn.readerReleaseLock(&mr);
|
pHandle->api.metaReaderFn.readerReleaseLock(&mr);
|
||||||
|
|
||||||
STableCachedVal* pVal = NULL;
|
|
||||||
code = createTableCacheVal(&mr, &pVal);
|
code = createTableCacheVal(&mr, &pVal);
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
val = *pVal;
|
val = *pVal;
|
||||||
freeReader = true;
|
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 {
|
} else {
|
||||||
pCache->cacheHit += 1;
|
pCache->cacheHit += 1;
|
||||||
STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h);
|
STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h);
|
||||||
|
@ -742,9 +735,17 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
pBlock->info.rows = backupRows;
|
pBlock->info.rows = backupRows;
|
||||||
|
|
||||||
_end:
|
_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) {
|
if (freeReader) {
|
||||||
pHandle->api.metaReaderFn.clearReader(&mr);
|
pHandle->api.metaReaderFn.clearReader(&mr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue