提交 d4f4ac1d 编写于 作者: H Hongze Cheng

more code

上级 dc890126
...@@ -35,18 +35,18 @@ typedef TARRAY2(SSttFileReader *) TSttFileReaderArray; ...@@ -35,18 +35,18 @@ typedef TARRAY2(SSttFileReader *) TSttFileReaderArray;
typedef TARRAY2(SSttSegReader *) TSttSegReaderArray; typedef TARRAY2(SSttSegReader *) TSttSegReaderArray;
// SSttFileReader // SSttFileReader
int32_t tsdbSttFReaderOpen(const char *fname, const SSttFileReaderConfig *config, SSttFileReader **reader); int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *config, SSttFileReader **reader);
int32_t tsdbSttFReaderClose(SSttFileReader **reader); int32_t tsdbSttFileReaderClose(SSttFileReader **reader);
int32_t tsdbSttFReaderGetSegReader(SSttFileReader *reader, const TSttSegReaderArray **readerArray); int32_t tsdbSttFileReaderGetSegReader(SSttFileReader *reader, const TSttSegReaderArray **readerArray);
// SSttSegReader // SSttSegReader
int32_t tsdbSttFReadSttBlk(SSttSegReader *reader, const TSttBlkArray **sttBlkArray); int32_t tsdbSttFileReadSttBlk(SSttSegReader *reader, const TSttBlkArray **sttBlkArray);
int32_t tsdbSttFReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArray); int32_t tsdbSttFileReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArray);
int32_t tsdbSttFReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **statisBlkArray); int32_t tsdbSttFileReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **statisBlkArray);
int32_t tsdbSttFReadSttBlock(SSttSegReader *reader, const SSttBlk *sttBlk, SBlockData *bData); int32_t tsdbSttFileReadSttBlock(SSttSegReader *reader, const SSttBlk *sttBlk, SBlockData *bData);
int32_t tsdbSttFReadDelBlock(SSttSegReader *reader, const SDelBlk *delBlk, SDelBlock *dData); int32_t tsdbSttFileReadDelBlock(SSttSegReader *reader, const SDelBlk *delBlk, SDelBlock *dData);
int32_t tsdbSttFReadStatisBlock(SSttSegReader *reader, const STbStatisBlk *statisBlk, STbStatisBlock *sData); int32_t tsdbSttFileReadStatisBlock(SSttSegReader *reader, const STbStatisBlk *statisBlk, STbStatisBlock *sData);
struct SSttFileReaderConfig { struct SSttFileReaderConfig {
STsdb *tsdb; STsdb *tsdb;
......
...@@ -77,7 +77,7 @@ static int32_t tsdbSttIterNext(STsdbIter *iter, const TABLEID *tbid) { ...@@ -77,7 +77,7 @@ static int32_t tsdbSttIterNext(STsdbIter *iter, const TABLEID *tbid) {
continue; continue;
} }
int32_t code = tsdbSttFReadSttBlock(iter->stt->reader, sttBlk, iter->stt->bData); int32_t code = tsdbSttFileReadSttBlock(iter->stt->reader, sttBlk, iter->stt->bData);
if (code) return code; if (code) return code;
iter->stt->iRow = 0; iter->stt->iRow = 0;
...@@ -200,7 +200,7 @@ _exit: ...@@ -200,7 +200,7 @@ _exit:
static int32_t tsdbSttIterOpen(STsdbIter *iter) { static int32_t tsdbSttIterOpen(STsdbIter *iter) {
int32_t code; int32_t code;
code = tsdbSttFReadSttBlk(iter->stt->reader, &iter->stt->sttBlkArray); code = tsdbSttFileReadSttBlk(iter->stt->reader, &iter->stt->sttBlkArray);
if (code) return code; if (code) return code;
if (TARRAY2_SIZE(iter->stt->sttBlkArray) == 0) { if (TARRAY2_SIZE(iter->stt->sttBlkArray) == 0) {
......
...@@ -229,7 +229,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { ...@@ -229,7 +229,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
.szPage = merger->szPage, .szPage = merger->szPage,
.file[0] = merger->ctx->fobj->f[0], .file[0] = merger->ctx->fobj->f[0],
}}; }};
code = tsdbSttFReaderOpen(merger->ctx->fobj->fname, config, &reader); code = tsdbSttFileReaderOpen(merger->ctx->fobj->fname, config, &reader);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
code = TARRAY2_APPEND(merger->sttReaderArr, reader); code = TARRAY2_APPEND(merger->sttReaderArr, reader);
...@@ -253,7 +253,7 @@ static int32_t tsdbMergeFileSetBeginOpenIter(SMerger *merger) { ...@@ -253,7 +253,7 @@ static int32_t tsdbMergeFileSetBeginOpenIter(SMerger *merger) {
TARRAY2_FOREACH(merger->sttReaderArr, sttReader) { TARRAY2_FOREACH(merger->sttReaderArr, sttReader) {
const TSttSegReaderArray *segReaderArr; const TSttSegReaderArray *segReaderArr;
code = tsdbSttFReaderGetSegReader(sttReader, &segReaderArr); code = tsdbSttFileReaderGetSegReader(sttReader, &segReaderArr);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
SSttSegReader *segReader; SSttSegReader *segReader;
...@@ -450,7 +450,7 @@ static int32_t tsdbMergeFileSetEndCloseIter(SMerger *merger) { ...@@ -450,7 +450,7 @@ static int32_t tsdbMergeFileSetEndCloseIter(SMerger *merger) {
} }
static int32_t tsdbMergeFileSetEndCloseReader(SMerger *merger) { static int32_t tsdbMergeFileSetEndCloseReader(SMerger *merger) {
TARRAY2_CLEAR(merger->sttReaderArr, tsdbSttFReaderClose); TARRAY2_CLEAR(merger->sttReaderArr, tsdbSttFileReaderClose);
return 0; return 0;
} }
......
...@@ -84,7 +84,7 @@ static int32_t tsdbSttSegReaderClose(SSttSegReader **reader) { ...@@ -84,7 +84,7 @@ static int32_t tsdbSttSegReaderClose(SSttSegReader **reader) {
return 0; return 0;
} }
int32_t tsdbSttFReaderOpen(const char *fname, const SSttFileReaderConfig *config, SSttFileReader **reader) { int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *config, SSttFileReader **reader) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino = 0;
int32_t vid = TD_VID(config->tsdb->pVnode); int32_t vid = TD_VID(config->tsdb->pVnode);
...@@ -117,12 +117,12 @@ int32_t tsdbSttFReaderOpen(const char *fname, const SSttFileReaderConfig *config ...@@ -117,12 +117,12 @@ int32_t tsdbSttFReaderOpen(const char *fname, const SSttFileReaderConfig *config
_exit: _exit:
if (code) { if (code) {
tsdbError("vgId:%d %s failed at line %d since %s", vid, __func__, lino, tstrerror(code)); tsdbError("vgId:%d %s failed at line %d since %s", vid, __func__, lino, tstrerror(code));
tsdbSttFReaderClose(reader); tsdbSttFileReaderClose(reader);
} }
return code; return code;
} }
int32_t tsdbSttFReaderClose(SSttFileReader **reader) { int32_t tsdbSttFileReaderClose(SSttFileReader **reader) {
tsdbCloseFile(&reader[0]->fd); tsdbCloseFile(&reader[0]->fd);
TARRAY2_CLEAR_FREE(reader[0]->readerArray, tsdbSttSegReaderClose); TARRAY2_CLEAR_FREE(reader[0]->readerArray, tsdbSttSegReaderClose);
taosMemoryFree(reader[0]); taosMemoryFree(reader[0]);
...@@ -130,13 +130,13 @@ int32_t tsdbSttFReaderClose(SSttFileReader **reader) { ...@@ -130,13 +130,13 @@ int32_t tsdbSttFReaderClose(SSttFileReader **reader) {
return 0; return 0;
} }
int32_t tsdbSttFReaderGetSegReader(SSttFileReader *reader, const TSttSegReaderArray **readerArray) { int32_t tsdbSttFileReaderGetSegReader(SSttFileReader *reader, const TSttSegReaderArray **readerArray) {
readerArray[0] = reader->readerArray; readerArray[0] = reader->readerArray;
return 0; return 0;
} }
// SSttFSegReader // SSttFSegReader
int32_t tsdbSttFReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **statisBlkArray) { int32_t tsdbSttFileReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **statisBlkArray) {
if (!reader->ctx.statisBlkLoaded) { if (!reader->ctx.statisBlkLoaded) {
if (reader->footer->statisBlkPtr->size > 0) { if (reader->footer->statisBlkPtr->size > 0) {
ASSERT(reader->footer->statisBlkPtr->size % sizeof(STbStatisBlk) == 0); ASSERT(reader->footer->statisBlkPtr->size % sizeof(STbStatisBlk) == 0);
...@@ -161,7 +161,7 @@ int32_t tsdbSttFReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **sta ...@@ -161,7 +161,7 @@ int32_t tsdbSttFReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **sta
return 0; return 0;
} }
int32_t tsdbSttFReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArray) { int32_t tsdbSttFileReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArray) {
if (!reader->ctx.delBlkLoaded) { if (!reader->ctx.delBlkLoaded) {
if (reader->footer->delBlkPtr->size > 0) { if (reader->footer->delBlkPtr->size > 0) {
ASSERT(reader->footer->delBlkPtr->size % sizeof(SDelBlk) == 0); ASSERT(reader->footer->delBlkPtr->size % sizeof(SDelBlk) == 0);
...@@ -186,7 +186,7 @@ int32_t tsdbSttFReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArr ...@@ -186,7 +186,7 @@ int32_t tsdbSttFReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArr
return 0; return 0;
} }
int32_t tsdbSttFReadSttBlk(SSttSegReader *reader, const TSttBlkArray **sttBlkArray) { int32_t tsdbSttFileReadSttBlk(SSttSegReader *reader, const TSttBlkArray **sttBlkArray) {
if (!reader->ctx.sttBlkLoaded) { if (!reader->ctx.sttBlkLoaded) {
if (reader->footer->sttBlkPtr->size > 0) { if (reader->footer->sttBlkPtr->size > 0) {
ASSERT(reader->footer->sttBlkPtr->size % sizeof(SSttBlk) == 0); ASSERT(reader->footer->sttBlkPtr->size % sizeof(SSttBlk) == 0);
...@@ -211,13 +211,13 @@ int32_t tsdbSttFReadSttBlk(SSttSegReader *reader, const TSttBlkArray **sttBlkArr ...@@ -211,13 +211,13 @@ int32_t tsdbSttFReadSttBlk(SSttSegReader *reader, const TSttBlkArray **sttBlkArr
return 0; return 0;
} }
int32_t tsdbSttFReadSttBlock(SSttSegReader *reader, const SSttBlk *sttBlk, SBlockData *bData) { int32_t tsdbSttFileReadSttBlock(SSttSegReader *reader, const SSttBlk *sttBlk, SBlockData *bData) {
int32_t code = 0; int32_t code = 0;
// TODO // TODO
return code; return code;
} }
int32_t tsdbSttFReadDelBlock(SSttSegReader *reader, const SDelBlk *delBlk, SDelBlock *dData) { int32_t tsdbSttFileReadDelBlock(SSttSegReader *reader, const SDelBlk *delBlk, SDelBlock *dData) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino = 0;
int32_t vid = TD_VID(reader->reader->config->tsdb->pVnode); int32_t vid = TD_VID(reader->reader->config->tsdb->pVnode);
...@@ -246,7 +246,7 @@ _exit: ...@@ -246,7 +246,7 @@ _exit:
return code; return code;
} }
int32_t tsdbSttFReadStatisBlock(SSttSegReader *reader, const STbStatisBlk *statisBlk, STbStatisBlock *sData) { int32_t tsdbSttFileReadStatisBlock(SSttSegReader *reader, const STbStatisBlk *statisBlk, STbStatisBlock *sData) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino = 0;
int32_t vid = TD_VID(reader->reader->config->tsdb->pVnode); int32_t vid = TD_VID(reader->reader->config->tsdb->pVnode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册