diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index 170700aeb863a7039884fadfd24b7a33f4f6b3ec..8a9dbf37b9b4ffb2691024cea8d6ff6f9436d001 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -108,6 +108,7 @@ static int32_t tsdbCommitCloseWriter(SCommitter2 *committer) { static int32_t tsdbCommitTSData(SCommitter2 *committer) { int32_t code = 0; int32_t lino = 0; + int64_t numOfRow = 0; SMetaInfo info; committer->ctx->hasTSData = false; @@ -135,6 +136,7 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) { } committer->ctx->hasTSData = true; + numOfRow++; code = tsdbFSetWriteRow(committer->writer, row); TSDB_CHECK_CODE(code, lino, _exit); @@ -146,6 +148,8 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) { _exit: if (code) { TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, code); + } else { + tsdbDebug("vgId:%d fid:%d commit %" PRId64 " rows", TD_VID(committer->tsdb->pVnode), committer->ctx->fid, numOfRow); } return code; } @@ -153,6 +157,7 @@ _exit: static int32_t tsdbCommitTombData(SCommitter2 *committer) { int32_t code = 0; int32_t lino = 0; + int64_t numRecord = 0; SMetaInfo info; if (committer->ctx->fset == NULL && !committer->ctx->hasTSData) { @@ -187,6 +192,7 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) { record->skey = TMAX(record->skey, committer->ctx->minKey); record->ekey = TMIN(record->ekey, committer->ctx->maxKey); + numRecord++; code = tsdbFSetWriteTombRecord(committer->writer, record); TSDB_CHECK_CODE(code, lino, _exit); @@ -198,6 +204,9 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) { _exit: if (code) { TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, code); + } else { + tsdbDebug("vgId:%d fid:%d commit %" PRId64 " tomb records", TD_VID(committer->tsdb->pVnode), committer->ctx->fid, + numRecord); } return code; } diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c index 53db3b49cd27e93163c2b7546e01ba9a8689b83c..9d07bcb446285696f4ebb6085028075c7ce12b6f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c @@ -703,6 +703,15 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, int8_t cmprAl *fileSize += brinBlk->size[j]; } +#if 0 + SBrinRecord record; + for (int32_t i = 0; i < BRIN_BLOCK_SIZE(brinBlock); i++) { + tBrinBlockGet(brinBlock, i, &record); + tsdbInfo("write brin block, block num:%04d, idx:%04d suid:%ld, uid:%ld, offset:%ld, numRow:%d, count:%d", + TARRAY2_SIZE(brinBlkArray), i, record.suid, record.uid, record.blockOffset, record.numRow, record.count); + } +#endif + // append to brinBlkArray code = TARRAY2_APPEND_PTR(brinBlkArray, brinBlk); if (code) return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbMerge.c b/source/dnode/vnode/src/tsdb/tsdbMerge.c index a6de924c2191ff5d03d2297f3ba8194fe5c52107..ec0ea3c60ffa1c8ef0a5564dcdb2e2f59bd6935a 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMerge.c +++ b/source/dnode/vnode/src/tsdb/tsdbMerge.c @@ -107,6 +107,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { merger->ctx->toData = true; merger->ctx->level = 0; + // TODO: optimize merge strategy for (int32_t i = 0;; ++i) { if (i >= TARRAY2_SIZE(merger->ctx->fset->lvlArr)) { merger->ctx->lvl = NULL; @@ -150,6 +151,8 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { code = TARRAY2_APPEND(merger->sttReaderArr, reader); TSDB_CHECK_CODE(code, lino, _exit); + + numFile++; } } @@ -354,10 +357,9 @@ static int32_t tsdbMergeFileSet(SMerger *merger, STFileSet *fset) { } // tomb - STombRecord *record; merger->ctx->tbid->suid = 0; merger->ctx->tbid->uid = 0; - while ((record = tsdbIterMergerGetTombRecord(merger->tombIterMerger)) != NULL) { + for (STombRecord *record; (record = tsdbIterMergerGetTombRecord(merger->tombIterMerger)) != NULL;) { if (record->uid != merger->ctx->tbid->uid) { merger->ctx->tbid->uid = record->uid; merger->ctx->tbid->suid = record->suid;