提交 1145aabb 编写于 作者: H Hongze Cheng

adjust some apis

上级 b8899c82
......@@ -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);
// SDelFWriter
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 tsdbWriteDelIdx(SDelFWriter *pWriter, SArray *aDelIdx, uint8_t **ppBuf);
int32_t tsdbUpdateDelFileHdr(SDelFWriter *pWriter);
// SDelFReader
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 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
code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pSkyline);
if (code) goto _err;
tsdbDelFReaderClose(pDelFReader);
tsdbDelFReaderClose(&pDelFReader);
} else {
code = getTableDelSkyline(pMem, pIMem, NULL, NULL, pSkyline);
if (code) goto _err;
......@@ -854,7 +854,7 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) {
code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pSkyline);
if (code) goto _err;
tsdbDelFReaderClose(pDelFReader);
tsdbDelFReaderClose(&pDelFReader);
} else {
code = getTableDelSkyline(pMem, pIMem, NULL, NULL, pSkyline);
if (code) goto _err;
......
......@@ -231,11 +231,11 @@ static int32_t tsdbCommitDelEnd(SCommitter *pCommitter) {
code = tsdbFSStateUpsertDelFile(pTsdb->fs->nState, &pCommitter->pDelFWriter->fDel);
if (code) goto _err;
code = tsdbDelFWriterClose(pCommitter->pDelFWriter, 1);
code = tsdbDelFWriterClose(&pCommitter->pDelFWriter, 1);
if (code) goto _err;
if (pCommitter->pDelFReader) {
code = tsdbDelFReaderClose(pCommitter->pDelFReader);
code = tsdbDelFReaderClose(&pCommitter->pDelFReader);
if (code) goto _err;
}
......
......@@ -60,8 +60,9 @@ _err:
return code;
}
int32_t tsdbDelFWriterClose(SDelFWriter *pWriter, int8_t sync) {
int32_t code = 0;
int32_t tsdbDelFWriterClose(SDelFWriter **ppWriter, int8_t sync) {
int32_t code = 0;
SDelFWriter *pWriter = *ppWriter;
// sync
if (sync && taosFsyncFile(pWriter->pWriteH) < 0) {
......@@ -75,6 +76,7 @@ int32_t tsdbDelFWriterClose(SDelFWriter *pWriter, int8_t sync) {
goto _err;
}
*ppWriter = NULL;
return code;
_err:
......@@ -286,8 +288,9 @@ _err:
return code;
}
int32_t tsdbDelFReaderClose(SDelFReader *pReader) {
int32_t code = 0;
int32_t tsdbDelFReaderClose(SDelFReader **ppReader) {
int32_t code = 0;
SDelFReader *pReader = *ppReader;
if (pReader) {
if (taosCloseFile(&pReader->pReadH) < 0) {
......@@ -296,6 +299,7 @@ int32_t tsdbDelFReaderClose(SDelFReader *pReader) {
}
taosMemoryFree(pReader);
}
*ppReader = NULL;
_exit:
return code;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册