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