未验证 提交 889a4f37 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #22364 from taosdata/fix/TS-3798

fix: update assert issue
...@@ -49,7 +49,7 @@ typedef struct { ...@@ -49,7 +49,7 @@ typedef struct {
} ctx[1]; } ctx[1];
// reader // reader
SSttFileReader *sttReader; TSttFileReaderArray sttReaderArray[1];
// iter // iter
TTsdbIterArray dataIterArray[1]; TTsdbIterArray dataIterArray[1];
...@@ -226,7 +226,7 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { ...@@ -226,7 +226,7 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino = 0;
ASSERT(committer->sttReader == NULL); ASSERT(TARRAY2_SIZE(committer->sttReaderArray) == 0);
if (committer->ctx->fset == NULL // if (committer->ctx->fset == NULL //
|| committer->sttTrigger > 1 // || committer->sttTrigger > 1 //
...@@ -241,20 +241,20 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { ...@@ -241,20 +241,20 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) {
ASSERT(lvl->level == 0); ASSERT(lvl->level == 0);
if (TARRAY2_SIZE(lvl->fobjArr) == 0) { STFileObj *fobj = NULL;
return 0; TARRAY2_FOREACH(lvl->fobjArr, fobj) {
} SSttFileReader *sttReader;
ASSERT(TARRAY2_SIZE(lvl->fobjArr) == 1);
STFileObj *fobj = TARRAY2_FIRST(lvl->fobjArr);
SSttFileReaderConfig config = { SSttFileReaderConfig config = {
.tsdb = committer->tsdb, .tsdb = committer->tsdb,
.szPage = committer->szPage, .szPage = committer->szPage,
.file = fobj->f[0], .file = fobj->f[0],
}; };
code = tsdbSttFileReaderOpen(fobj->fname, &config, &committer->sttReader);
code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader);
TSDB_CHECK_CODE(code, lino, _exit);
code = TARRAY2_APPEND(committer->sttReaderArray, sttReader);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
STFileOp op = { STFileOp op = {
...@@ -265,6 +265,7 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { ...@@ -265,6 +265,7 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) {
code = TARRAY2_APPEND(committer->fopArray, op); code = TARRAY2_APPEND(committer->fopArray, op);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
}
_exit: _exit:
if (code) { if (code) {
...@@ -273,7 +274,10 @@ _exit: ...@@ -273,7 +274,10 @@ _exit:
return code; return code;
} }
static int32_t tsdbCommitCloseReader(SCommitter2 *committer) { return tsdbSttFileReaderClose(&committer->sttReader); } static int32_t tsdbCommitCloseReader(SCommitter2 *committer) {
TARRAY2_CLEAR(committer->sttReaderArray, tsdbSttFileReaderClose);
return 0;
}
static int32_t tsdbCommitOpenIter(SCommitter2 *committer) { static int32_t tsdbCommitOpenIter(SCommitter2 *committer) {
int32_t code = 0; int32_t code = 0;
...@@ -310,10 +314,11 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) { ...@@ -310,10 +314,11 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) {
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
// STT // STT
if (committer->sttReader) { SSttFileReader *sttReader;
TARRAY2_FOREACH(committer->sttReaderArray, sttReader) {
// data iter // data iter
config.type = TSDB_ITER_TYPE_STT; config.type = TSDB_ITER_TYPE_STT;
config.sttReader = committer->sttReader; config.sttReader = sttReader;
code = tsdbIterOpen(&config, &iter); code = tsdbIterOpen(&config, &iter);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
...@@ -323,7 +328,7 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) { ...@@ -323,7 +328,7 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) {
// tomb iter // tomb iter
config.type = TSDB_ITER_TYPE_STT_TOMB; config.type = TSDB_ITER_TYPE_STT_TOMB;
config.sttReader = committer->sttReader; config.sttReader = sttReader;
code = tsdbIterOpen(&config, &iter); code = tsdbIterOpen(&config, &iter);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册