From 6a7a3da3db17fd4e3049835cc4b33fcca4a13afa Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 21 Jul 2022 11:56:18 +0000 Subject: [PATCH] fix some crash --- source/dnode/vnode/src/tsdb/tsdbCommit.c | 2 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index c4dc341a63..194bd2e924 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -1151,7 +1151,7 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) { STsdb *pTsdb = pCommitter->pTsdb; SMemTable *pMemTable = pTsdb->imem; - ASSERT(eno); + ASSERT(eno == 0); code = tsdbFSCommit1(pTsdb, &pCommitter->fs); if (code) goto _err; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 27afd7d0c5..6be79f7578 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -286,8 +286,6 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet, int32 return TSDB_CODE_SUCCESS; } -static void cleanupFilesetIterator(SFilesetIter* pIter) { taosArrayDestroy(pIter->pFileList); } - static bool filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader) { bool asc = ASCENDING_TRAVERSE(pIter->order); int32_t step = asc ? 1 : -1; @@ -2829,6 +2827,9 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl SDataBlockIter* pBlockIter = &pReader->status.blockIter; + code = tsdbTakeReadSnap(pVnode->pTsdb, &pReader->pReadSnap); + if (code) goto _err; + initFilesetIterator(&pReader->status.fileIter, (*ppReader)->pReadSnap->fs.aDFileSet, pReader->order, pReader->idStr); resetDataBlockIterator(&pReader->status.blockIter, pReader->order); @@ -2842,9 +2843,6 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl } } - code = tsdbTakeReadSnap(pVnode->pTsdb, &pReader->pReadSnap); - if (code) goto _err; - tsdbDebug("%p total numOfTable:%d in this query %s", pReader, numOfTables, pReader->idStr); return code; @@ -2873,7 +2871,6 @@ void tsdbReaderClose(STsdbReader* pReader) { } taosMemoryFree(pSupInfo->buildBuf); - cleanupFilesetIterator(&pReader->status.fileIter); cleanupDataBlockIterator(&pReader->status.blockIter); destroyBlockScanInfo(pReader->status.pTableMap); blockDataDestroy(pReader->pResBlock); -- GitLab