more work

This commit is contained in:
Hongze Cheng 2022-07-06 10:44:28 +00:00
parent aa27f51dea
commit 9a90714ecc
1 changed files with 24 additions and 0 deletions

View File

@ -379,6 +379,7 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3
int32_t fid = tsdbKeyFid(skey, pWriter->minutes, pWriter->precision); int32_t fid = tsdbKeyFid(skey, pWriter->minutes, pWriter->precision);
ASSERT(fid == tsdbKeyFid(ekey, pWriter->minutes, pWriter->precision)); ASSERT(fid == tsdbKeyFid(ekey, pWriter->minutes, pWriter->precision));
// begin
if (pWriter->pDataFWriter == NULL || pWriter->fid != fid) { if (pWriter->pDataFWriter == NULL || pWriter->fid != fid) {
code = tsdbSnapWriteDataEnd(pWriter); code = tsdbSnapWriteDataEnd(pWriter);
if (code) goto _err; if (code) goto _err;
@ -411,6 +412,29 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3
taosArrayClear(pWriter->aBlockIdxN); taosArrayClear(pWriter->aBlockIdxN);
} }
// process
TABLEID id = {0}; // TODO
while (true) {
SBlockIdx* pBlockIdx = NULL;
if (pWriter->iBlockIdx < taosArrayGetSize(pWriter->aBlockIdx)) {
pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->aBlockIdx, pWriter->iBlockIdx);
}
if (pBlockIdx) {
int32_t c = tTABLEIDCmprFn(&id, pBlockIdx);
if (c == 0) {
// merge
} else if (c < 0) {
// write the block
} else {
// commit the block
}
}
}
return code; return code;
_err: _err: