diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 050891c9da..502e08a381 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -379,6 +379,7 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3 int32_t fid = tsdbKeyFid(skey, pWriter->minutes, pWriter->precision); ASSERT(fid == tsdbKeyFid(ekey, pWriter->minutes, pWriter->precision)); + // begin if (pWriter->pDataFWriter == NULL || pWriter->fid != fid) { code = tsdbSnapWriteDataEnd(pWriter); if (code) goto _err; @@ -411,6 +412,29 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3 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; _err: