提交 50e76f9a 编写于 作者: H Hongze Cheng

Merge branch 'feat/tsdb_refact' of https://github.com/taosdata/TDengine into feat/tsdb_snapshot

...@@ -223,13 +223,13 @@ int32_t tsdbReadBlockData(SDataFReader *pReader, SBlockIdx *pBlockIdx, SBlock *p ...@@ -223,13 +223,13 @@ int32_t tsdbReadBlockData(SDataFReader *pReader, SBlockIdx *pBlockIdx, SBlock *p
int32_t tsdbReadBlockSma(SDataFReader *pReader, SBlock *pBlock, SArray *aColumnDataAgg, uint8_t **ppBuf); int32_t tsdbReadBlockSma(SDataFReader *pReader, SBlock *pBlock, SArray *aColumnDataAgg, uint8_t **ppBuf);
// SDelFWriter // SDelFWriter
int32_t tsdbDelFWriterOpen(SDelFWriter **ppWriter, SDelFile *pFile, STsdb *pTsdb); int32_t tsdbDelFWriterOpen(SDelFWriter **ppWriter, SDelFile *pFile, STsdb *pTsdb);
int32_t tsdbDelFWriterClose(SDelFWriter *pWriter, int8_t sync); int32_t tsdbDelFWriterClose(SDelFWriter **ppWriter, int8_t sync);
int32_t tsdbWriteDelData(SDelFWriter *pWriter, SArray *aDelData, uint8_t **ppBuf, SDelIdx *pDelIdx); int32_t tsdbWriteDelData(SDelFWriter *pWriter, SArray *aDelData, uint8_t **ppBuf, SDelIdx *pDelIdx);
int32_t tsdbWriteDelIdx(SDelFWriter *pWriter, SArray *aDelIdx, uint8_t **ppBuf); int32_t tsdbWriteDelIdx(SDelFWriter *pWriter, SArray *aDelIdx, uint8_t **ppBuf);
int32_t tsdbUpdateDelFileHdr(SDelFWriter *pWriter); int32_t tsdbUpdateDelFileHdr(SDelFWriter *pWriter);
// SDelFReader // SDelFReader
int32_t tsdbDelFReaderOpen(SDelFReader **ppReader, SDelFile *pFile, STsdb *pTsdb, uint8_t **ppBuf); int32_t tsdbDelFReaderOpen(SDelFReader **ppReader, SDelFile *pFile, STsdb *pTsdb, uint8_t **ppBuf);
int32_t tsdbDelFReaderClose(SDelFReader *pReader); int32_t tsdbDelFReaderClose(SDelFReader **ppReader);
int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData, uint8_t **ppBuf); int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData, uint8_t **ppBuf);
int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx, uint8_t **ppBuf); int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx, uint8_t **ppBuf);
......
...@@ -672,7 +672,7 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, STSRow **ppRo ...@@ -672,7 +672,7 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, STSRow **ppRo
code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pSkyline); code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pSkyline);
if (code) goto _err; if (code) goto _err;
tsdbDelFReaderClose(pDelFReader); tsdbDelFReaderClose(&pDelFReader);
} else { } else {
code = getTableDelSkyline(pMem, pIMem, NULL, NULL, pSkyline); code = getTableDelSkyline(pMem, pIMem, NULL, NULL, pSkyline);
if (code) goto _err; if (code) goto _err;
...@@ -854,7 +854,7 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) { ...@@ -854,7 +854,7 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) {
code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pSkyline); code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pSkyline);
if (code) goto _err; if (code) goto _err;
tsdbDelFReaderClose(pDelFReader); tsdbDelFReaderClose(&pDelFReader);
} else { } else {
code = getTableDelSkyline(pMem, pIMem, NULL, NULL, pSkyline); code = getTableDelSkyline(pMem, pIMem, NULL, NULL, pSkyline);
if (code) goto _err; if (code) goto _err;
......
...@@ -231,11 +231,11 @@ static int32_t tsdbCommitDelEnd(SCommitter *pCommitter) { ...@@ -231,11 +231,11 @@ static int32_t tsdbCommitDelEnd(SCommitter *pCommitter) {
code = tsdbFSStateUpsertDelFile(pTsdb->fs->nState, &pCommitter->pDelFWriter->fDel); code = tsdbFSStateUpsertDelFile(pTsdb->fs->nState, &pCommitter->pDelFWriter->fDel);
if (code) goto _err; if (code) goto _err;
code = tsdbDelFWriterClose(pCommitter->pDelFWriter, 1); code = tsdbDelFWriterClose(&pCommitter->pDelFWriter, 1);
if (code) goto _err; if (code) goto _err;
if (pCommitter->pDelFReader) { if (pCommitter->pDelFReader) {
code = tsdbDelFReaderClose(pCommitter->pDelFReader); code = tsdbDelFReaderClose(&pCommitter->pDelFReader);
if (code) goto _err; if (code) goto _err;
} }
......
...@@ -60,8 +60,9 @@ _err: ...@@ -60,8 +60,9 @@ _err:
return code; return code;
} }
int32_t tsdbDelFWriterClose(SDelFWriter *pWriter, int8_t sync) { int32_t tsdbDelFWriterClose(SDelFWriter **ppWriter, int8_t sync) {
int32_t code = 0; int32_t code = 0;
SDelFWriter *pWriter = *ppWriter;
// sync // sync
if (sync && taosFsyncFile(pWriter->pWriteH) < 0) { if (sync && taosFsyncFile(pWriter->pWriteH) < 0) {
...@@ -75,6 +76,7 @@ int32_t tsdbDelFWriterClose(SDelFWriter *pWriter, int8_t sync) { ...@@ -75,6 +76,7 @@ int32_t tsdbDelFWriterClose(SDelFWriter *pWriter, int8_t sync) {
goto _err; goto _err;
} }
*ppWriter = NULL;
return code; return code;
_err: _err:
...@@ -286,8 +288,9 @@ _err: ...@@ -286,8 +288,9 @@ _err:
return code; return code;
} }
int32_t tsdbDelFReaderClose(SDelFReader *pReader) { int32_t tsdbDelFReaderClose(SDelFReader **ppReader) {
int32_t code = 0; int32_t code = 0;
SDelFReader *pReader = *ppReader;
if (pReader) { if (pReader) {
if (taosCloseFile(&pReader->pReadH) < 0) { if (taosCloseFile(&pReader->pReadH) < 0) {
...@@ -296,6 +299,7 @@ int32_t tsdbDelFReaderClose(SDelFReader *pReader) { ...@@ -296,6 +299,7 @@ int32_t tsdbDelFReaderClose(SDelFReader *pReader) {
} }
taosMemoryFree(pReader); taosMemoryFree(pReader);
} }
*ppReader = NULL;
_exit: _exit:
return code; return code;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册