Merge branch 'enh/tsdb_optimize' of github.com:taosdata/tdengine into enh/tsdb_optimize

This commit is contained in:
Haojun Liao 2023-06-21 19:22:58 +08:00
commit 3ca3dc54ae
1 changed files with 9 additions and 1 deletions

View File

@ -44,6 +44,7 @@ typedef struct {
TSKEY maxKey; TSKEY maxKey;
STFileSet *fset; STFileSet *fset;
TABLEID tbid[1]; TABLEID tbid[1];
bool hasTSData;
} ctx[1]; } ctx[1];
// reader // reader
@ -109,9 +110,10 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) {
int32_t lino = 0; int32_t lino = 0;
SMetaInfo info; SMetaInfo info;
committer->ctx->hasTSData = false;
for (SRowInfo *row; (row = tsdbIterMergerGetData(committer->dataIterMerger)) != NULL;) { for (SRowInfo *row; (row = tsdbIterMergerGetData(committer->dataIterMerger)) != NULL;) {
if (row->uid != committer->ctx->tbid->uid) { if (row->uid != committer->ctx->tbid->uid) {
// Ignore table of obsolescence
if (metaGetInfo(committer->tsdb->pVnode->pMeta, row->uid, &info, NULL) != 0) { if (metaGetInfo(committer->tsdb->pVnode->pMeta, row->uid, &info, NULL) != 0) {
code = tsdbIterMergerSkipTableData(committer->dataIterMerger, (TABLEID *)row); code = tsdbIterMergerSkipTableData(committer->dataIterMerger, (TABLEID *)row);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
@ -130,6 +132,8 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) {
continue; continue;
} }
committer->ctx->hasTSData = true;
code = tsdbFSetWriteRow(committer->writer, row); code = tsdbFSetWriteRow(committer->writer, row);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
@ -148,6 +152,10 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino = 0;
if (committer->ctx->fset == NULL && !committer->ctx->hasTSData) {
return 0;
}
for (STombRecord *record; (record = tsdbIterMergerGetTombRecord(committer->tombIterMerger));) { for (STombRecord *record; (record = tsdbIterMergerGetTombRecord(committer->tombIterMerger));) {
if (record->ekey < committer->ctx->minKey) { if (record->ekey < committer->ctx->minKey) {
goto _next; goto _next;