提交 288904e9 编写于 作者: H Hongze Cheng

more work

上级 f80db38c
......@@ -151,6 +151,8 @@ int32_t tPutBlockIdx(uint8_t *p, void *ph);
int32_t tGetBlockIdx(uint8_t *p, void *ph);
// SBlock
int32_t tPutBlock(uint8_t *p, void *ph);
int32_t tGetBlock(uint8_t *p, void *ph);
int32_t tBlockCmprFn(const void *p1, const void *p2);
// SDelIdx
......
......@@ -355,6 +355,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
int32_t iBlock;
int32_t nBlock;
SBlock *pBlock;
SBlock block;
// check
if (pTbData) {
......@@ -389,6 +390,25 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
blockIdx.size = -1;
// impl (todo)
iBlock = 0;
nBlock = pCommitter->oBlock.nItem;
do {
pRow = tsdbTbDataIterGet(pIter);
if (iBlock < nBlock) {
pBlock = &block;
code = tMapDataGetItemByIdx(&pCommitter->oBlock, iBlock, pBlock, tGetBlock);
if (code) goto _err;
} else {
pBlock == NULL;
}
if ((pRow == NULL || pRow->pTSRow->ts > pCommitter->maxKey) && pBlock == NULL) break;
code = tsdbMergeData(pCommitter, pIter, pBlock);
if (code) goto _err;
if (iBlock < nBlock) iBlock++;
} while (true);
// end
code = tsdbWriteBlock(pCommitter->pWriter, &pCommitter->nBlock, NULL, &blockIdx);
......
......@@ -273,6 +273,9 @@ bool tsdbTbDataIterNext(STbDataIter *pIter) {
}
TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) {
// we add here for commit usage
if (pIter == NULL) return NULL;
if (pIter->pRow) {
goto _exit;
}
......
......@@ -281,6 +281,20 @@ int32_t tGetBlockIdx(uint8_t *p, void *ph) {
}
// SBlock ======================================================
int32_t tPutBlock(uint8_t *p, void *ph) {
int32_t n = 0;
ASSERT(0);
// TODO
return n;
}
int32_t tGetBlock(uint8_t *p, void *ph) {
int32_t n = 0;
ASSERT(0);
// TODO
return n;
}
int32_t tBlockCmprFn(const void *p1, const void *p2) {
int32_t c;
SBlock *pBlock1 = (SBlock *)p1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册