提交 38b7cfe1 编写于 作者: H Hongze Cheng

more work

上级 78774c33
...@@ -729,9 +729,29 @@ _err: ...@@ -729,9 +729,29 @@ _err:
return code; return code;
} }
static int32_t tsdbCommitMoveDiskBlock(SCommitter *pCommitter, SBlock *pBlock) { static int32_t tsdbCommitTableDiskData(SCommitter *pCommitter, SBlock *pBlock) {
int32_t code = 0; int32_t code = 0;
// TODO
if (pBlock->last) {
// TODO
code = tsdbReadBlockData(pCommitter->pReader, NULL, pBlock, &pCommitter->oBlockData, NULL, NULL);
if (code) goto _err;
code =
tsdbWriteBlockData(pCommitter->pWriter, &pCommitter->oBlockData, NULL, NULL, NULL, NULL, pCommitter->cmprAlg);
if (code) goto _err;
code = tMapDataPutItem(&pCommitter->nBlockMap, &pCommitter->nBlock, tPutBlock);
if (code) goto _err;
} else {
code = tMapDataPutItem(&pCommitter->nBlockMap, pBlock, tPutBlock);
if (code) goto _err;
}
return code;
_err:
tsdbError("vgId:%d tsdb commit table disk data failed since %s", TD_VID(pCommitter->pTsdb->pVnode), tstrerror(code));
return code; return code;
} }
...@@ -789,7 +809,7 @@ static int32_t tsdbMergeMemDisk(SCommitter *pCommitter, STbData *pTbData, SBlock ...@@ -789,7 +809,7 @@ static int32_t tsdbMergeMemDisk(SCommitter *pCommitter, STbData *pTbData, SBlock
pRow = tsdbTbDataIterGet(pIter); pRow = tsdbTbDataIterGet(pIter);
} else if (c > 0) { } else if (c > 0) {
// just move the block (todo) // just move the block (todo)
code = tsdbCommitMoveDiskBlock(pCommitter, pBlock); code = tsdbCommitTableDiskData(pCommitter, pBlock);
if (code) goto _err; if (code) goto _err;
iBlock++; iBlock++;
...@@ -815,7 +835,7 @@ static int32_t tsdbMergeMemDisk(SCommitter *pCommitter, STbData *pTbData, SBlock ...@@ -815,7 +835,7 @@ static int32_t tsdbMergeMemDisk(SCommitter *pCommitter, STbData *pTbData, SBlock
} }
} }
} else if (pBlock) { } else if (pBlock) {
code = tsdbCommitMoveDiskBlock(pCommitter, pBlock); code = tsdbCommitTableDiskData(pCommitter, pBlock);
if (code) goto _err; if (code) goto _err;
iBlock++; iBlock++;
...@@ -879,6 +899,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl ...@@ -879,6 +899,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
if ((pRow == NULL || TSDBROW_TS(pRow) > pCommitter->maxKey) && nBlock == 0) goto _exit; if ((pRow == NULL || TSDBROW_TS(pRow) > pCommitter->maxKey) && nBlock == 0) goto _exit;
// start =========== // start ===========
tMapDataReset(&pCommitter->nBlockMap);
SBlock *pBlock = NULL; // (todo) SBlock *pBlock = NULL; // (todo)
int32_t c; int32_t c;
...@@ -897,7 +918,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl ...@@ -897,7 +918,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
} else { } else {
c = tBlockCmprFn(&(SBlock){}, pBlock); c = tBlockCmprFn(&(SBlock){}, pBlock);
if (c > 0) { if (c > 0) {
code = tsdbCommitMoveDiskBlock(pCommitter, pBlock); code = tsdbCommitTableDiskData(pCommitter, pBlock);
if (code) goto _err; if (code) goto _err;
iBlock++; iBlock++;
...@@ -924,7 +945,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl ...@@ -924,7 +945,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
} }
} }
} else if (pBlock) { } else if (pBlock) {
code = tsdbCommitMoveDiskBlock(pCommitter, pBlock); code = tsdbCommitTableDiskData(pCommitter, pBlock);
if (code) goto _err; if (code) goto _err;
// move to next block (todo) // move to next block (todo)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册