Merge remote-tracking branch 'origin/enh/tsdb_optimize' into enh/tsdb_optimize
This commit is contained in:
commit
8f8dfc593b
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue