提交 e48bdbfd 编写于 作者: M Minglei Jin

tsdb/log-query: new proactive flag for mem table unref

上级 bff8c216
......@@ -291,7 +291,7 @@ int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData
int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx);
// tsdbRead.c ==============================================================================================
int32_t tsdbTakeReadSnap(STsdbReader *pReader, _query_reseek_func_t reseek, STsdbReadSnap **ppSnap);
void tsdbUntakeReadSnap(STsdbReader *pReader, STsdbReadSnap *pSnap);
void tsdbUntakeReadSnap(STsdbReader *pReader, STsdbReadSnap *pSnap, bool proactive);
// tsdbMerge.c ==============================================================================================
int32_t tsdbMerge(STsdb *pTsdb);
......
......@@ -383,7 +383,7 @@ _end:
tsdbDataFReaderClose(&pr->pDataFReader);
resetLastBlockLoadInfo(pr->pLoadInfo);
tsdbUntakeReadSnap((STsdbReader*)pr, pr->pReadSnap);
tsdbUntakeReadSnap((STsdbReader*)pr, pr->pReadSnap, true);
taosThreadMutexUnlock(&pr->readerMutex);
for (int32_t j = 0; j < pr->numOfCols; ++j) {
......
......@@ -3953,7 +3953,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
}
qTrace("tsdb/reader: %p, untake snapshot", pReader);
tsdbUntakeReadSnap(pReader, pReader->pReadSnap);
tsdbUntakeReadSnap(pReader, pReader->pReadSnap, true);
taosThreadMutexDestroy(&pReader->readerMutex);
......@@ -4052,7 +4052,7 @@ int32_t tsdbReaderSuspend(STsdbReader* pReader) {
}
}
tsdbUntakeReadSnap(pReader, pReader->pReadSnap);
tsdbUntakeReadSnap(pReader, pReader->pReadSnap, false);
pReader->suspended = true;
......@@ -4083,7 +4083,8 @@ static int32_t tsdbSetQueryReseek(void* pQHandle) {
} else if (code == EBUSY) {
return TSDB_CODE_VND_QUERY_BUSY;
} else {
return -1;
terrno = TAOS_SYSTEM_ERROR(code);
return TSDB_CODE_FAILED;
}
}
......@@ -4714,16 +4715,16 @@ _exit:
return code;
}
void tsdbUntakeReadSnap(STsdbReader* pReader, STsdbReadSnap* pSnap) {
void tsdbUntakeReadSnap(STsdbReader* pReader, STsdbReadSnap* pSnap, bool proactive) {
STsdb* pTsdb = pReader->pTsdb;
if (pSnap) {
if (pSnap->pMem) {
tsdbUnrefMemTable(pSnap->pMem, pSnap->pNode, true);
tsdbUnrefMemTable(pSnap->pMem, pSnap->pNode, proactive);
}
if (pSnap->pIMem) {
tsdbUnrefMemTable(pSnap->pIMem, pSnap->pINode, true);
tsdbUnrefMemTable(pSnap->pIMem, pSnap->pINode, proactive);
}
tsdbFSUnref(pTsdb, &pSnap->fs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册