more work

This commit is contained in:
Hongze Cheng 2022-06-15 08:04:26 +00:00
parent f80db38c59
commit 288904e901
4 changed files with 39 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -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;