diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index c327b64fdb..f9fc65f688 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -177,6 +177,11 @@ struct SColData { uint8_t *pData; }; +struct SColDataBatch { + uint8_t flags; + SColData *aColData[]; +}; + #if 1 //================================================================================================================================================ // Imported since 3.0 and use bitmap to demonstrate None/Null/Norm, while use Null/Norm below 3.0 without of bitmap. #define TD_SUPPORT_BITMAP diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index b98568d75b..5da718b2c2 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -46,6 +46,7 @@ typedef struct SMergeInfo SMergeInfo; typedef struct STable STable; typedef struct SOffset SOffset; typedef struct SMapData SMapData; +typedef struct SVDataCols SVDataCols; // tsdbMemTable ============================================================================================== @@ -127,18 +128,18 @@ typedef struct SDFileSetReader SDFileSetReader; typedef struct SDFileSetWriter SDFileSetWriter; // SDFileSetWriter -int32_t tsdbDFileSetWriterOpen(SDFileSetWriter *pWriter, STsdb *pTsdb, SDFileSet *pSet); -int32_t tsdbDFileSetWriterClose(SDFileSetWriter *pWriter, int8_t sync); -int32_t tsdbWriteBlockData(SDFileSetWriter *pWriter, SDataCols *pDataCols, SBlock *pBlock); -int32_t tsdbWriteSBlockInfo(SDFileSetWriter *pWriter, SBlockInfo *pBlockInfo, SBlockIdx *pBlockIdx); -int32_t tsdbWriteSBlockIdx(SDFileSetWriter *pWriter, SBlockIdx *pBlockIdx); +// int32_t tsdbDFileSetWriterOpen(SDFileSetWriter *pWriter, STsdb *pTsdb, SDFileSet *pSet); +// int32_t tsdbDFileSetWriterClose(SDFileSetWriter *pWriter, int8_t sync); +// int32_t tsdbWriteBlockData(SDFileSetWriter *pWriter, SDataCols *pDataCols, SBlock *pBlock); +// int32_t tsdbWriteSBlockInfo(SDFileSetWriter *pWriter, SBlockInfo *pBlockInfo, SBlockIdx *pBlockIdx); +// int32_t tsdbWriteSBlockIdx(SDFileSetWriter *pWriter, SBlockIdx *pBlockIdx); // SDFileSetReader -int32_t tsdbDFileSetReaderOpen(SDFileSetReader *pReader, STsdb *pTsdb, SDFileSet *pSet); -int32_t tsdbDFileSetReaderClose(SDFileSetReader *pReader); -int32_t tsdbLoadSBlockIdx(SDFileSetReader *pReader, SArray *pArray); -int32_t tsdbLoadSBlockInfo(SDFileSetReader *pReader, SBlockIdx *pBlockIdx, SBlockInfo *pBlockInfo); -int32_t tsdbLoadSBlockStatis(SDFileSetReader *pReader, SBlock *pBlock, SBlockStatis *pBlockStatis); +// int32_t tsdbDFileSetReaderOpen(SDFileSetReader *pReader, STsdb *pTsdb, SDFileSet *pSet); +// int32_t tsdbDFileSetReaderClose(SDFileSetReader *pReader); +// int32_t tsdbLoadSBlockIdx(SDFileSetReader *pReader, SArray *pArray); +// int32_t tsdbLoadSBlockInfo(SDFileSetReader *pReader, SBlockIdx *pBlockIdx, SBlockInfo *pBlockInfo); +// int32_t tsdbLoadSBlockStatis(SDFileSetReader *pReader, SBlock *pBlock, SBlockStatis *pBlockStatis); // SDelFWriter @@ -306,13 +307,24 @@ struct SBlockItem { int64_t maxVersion; }; +struct SBlockInfo { + uint8_t flags; + int32_t nCols; + int64_t offset; + int64_t size; + int32_t nSmaCols; + int64_t smaOffset; + int64_t smaSize; +}; + struct SBlock { - uint32_t delimiter; - int64_t suid; - int64_t uid; - SOffset offset; - uint32_t nData; - uint8_t *pData; + TSDBKEY minKey; + TSDBKEY maxKey; + int64_t minVersion; + int64_t maxVersion; + int32_t nRows; + int8_t nBlockInfo; + SBlockInfo blockInfos[]; }; struct SBlockCol { @@ -436,6 +448,11 @@ struct SMapData { uint8_t *pData; }; +struct SVDataCols { + int64_t *aVersion; + SDataCols dataCols; +}; + #ifdef __cplusplus } #endif diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 7e5cd6cf95..1655f222ac 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -37,9 +37,11 @@ struct SCommitter { SMapData oBlockIdx; SMapData nBlockIdx; // commit table data - SBlockIdx *pBlockIdx; - SMapData oBlock; - SMapData nBlock; + SBlockIdx *pBlockIdx; + SMapData oBlock; + SMapData nBlock; + SColDataBatch oBatch; + SColDataBatch nBatch; /* commit del */ SDelFReader *pDelFReader; SDelFWriter *pDelFWriter;