提交 21d97293 编写于 作者: H Hongze Cheng

more fix

上级 f35db3ba
...@@ -108,6 +108,7 @@ static int32_t tsdbCommitCloseWriter(SCommitter2 *committer) { ...@@ -108,6 +108,7 @@ static int32_t tsdbCommitCloseWriter(SCommitter2 *committer) {
static int32_t tsdbCommitTSData(SCommitter2 *committer) { static int32_t tsdbCommitTSData(SCommitter2 *committer) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino = 0;
int64_t numOfRow = 0;
SMetaInfo info; SMetaInfo info;
committer->ctx->hasTSData = false; committer->ctx->hasTSData = false;
...@@ -135,6 +136,7 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) { ...@@ -135,6 +136,7 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) {
} }
committer->ctx->hasTSData = true; committer->ctx->hasTSData = true;
numOfRow++;
code = tsdbFSetWriteRow(committer->writer, row); code = tsdbFSetWriteRow(committer->writer, row);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
...@@ -146,6 +148,8 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) { ...@@ -146,6 +148,8 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) {
_exit: _exit:
if (code) { if (code) {
TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, 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; return code;
} }
...@@ -153,6 +157,7 @@ _exit: ...@@ -153,6 +157,7 @@ _exit:
static int32_t tsdbCommitTombData(SCommitter2 *committer) { static int32_t tsdbCommitTombData(SCommitter2 *committer) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino = 0;
int64_t numRecord = 0;
SMetaInfo info; SMetaInfo info;
if (committer->ctx->fset == NULL && !committer->ctx->hasTSData) { if (committer->ctx->fset == NULL && !committer->ctx->hasTSData) {
...@@ -187,6 +192,7 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) { ...@@ -187,6 +192,7 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) {
record->skey = TMAX(record->skey, committer->ctx->minKey); record->skey = TMAX(record->skey, committer->ctx->minKey);
record->ekey = TMIN(record->ekey, committer->ctx->maxKey); record->ekey = TMIN(record->ekey, committer->ctx->maxKey);
numRecord++;
code = tsdbFSetWriteTombRecord(committer->writer, record); code = tsdbFSetWriteTombRecord(committer->writer, record);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
...@@ -198,6 +204,9 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) { ...@@ -198,6 +204,9 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) {
_exit: _exit:
if (code) { if (code) {
TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, 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; return code;
} }
......
...@@ -703,6 +703,15 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, int8_t cmprAl ...@@ -703,6 +703,15 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, int8_t cmprAl
*fileSize += brinBlk->size[j]; *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 // append to brinBlkArray
code = TARRAY2_APPEND_PTR(brinBlkArray, brinBlk); code = TARRAY2_APPEND_PTR(brinBlkArray, brinBlk);
if (code) return code; if (code) return code;
......
...@@ -107,6 +107,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { ...@@ -107,6 +107,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
merger->ctx->toData = true; merger->ctx->toData = true;
merger->ctx->level = 0; merger->ctx->level = 0;
// TODO: optimize merge strategy
for (int32_t i = 0;; ++i) { for (int32_t i = 0;; ++i) {
if (i >= TARRAY2_SIZE(merger->ctx->fset->lvlArr)) { if (i >= TARRAY2_SIZE(merger->ctx->fset->lvlArr)) {
merger->ctx->lvl = NULL; merger->ctx->lvl = NULL;
...@@ -150,6 +151,8 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { ...@@ -150,6 +151,8 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
code = TARRAY2_APPEND(merger->sttReaderArr, reader); code = TARRAY2_APPEND(merger->sttReaderArr, reader);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
numFile++;
} }
} }
...@@ -354,10 +357,9 @@ static int32_t tsdbMergeFileSet(SMerger *merger, STFileSet *fset) { ...@@ -354,10 +357,9 @@ static int32_t tsdbMergeFileSet(SMerger *merger, STFileSet *fset) {
} }
// tomb // tomb
STombRecord *record;
merger->ctx->tbid->suid = 0; merger->ctx->tbid->suid = 0;
merger->ctx->tbid->uid = 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) { if (record->uid != merger->ctx->tbid->uid) {
merger->ctx->tbid->uid = record->uid; merger->ctx->tbid->uid = record->uid;
merger->ctx->tbid->suid = record->suid; merger->ctx->tbid->suid = record->suid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册