提交 4cb4c638 编写于 作者: H Hongze Cheng

more code

上级 f5286359
...@@ -43,6 +43,8 @@ typedef void (*TArray2Cb)(void *); ...@@ -43,6 +43,8 @@ typedef void (*TArray2Cb)(void *);
#define TARRAY2_INITIALIZER \ #define TARRAY2_INITIALIZER \
{ 0, 0, NULL } { 0, 0, NULL }
#define TARRAY2_SIZE(a) ((a)->size) #define TARRAY2_SIZE(a) ((a)->size)
#define TARRAY2_CAPACITY(a) ((a)->capacity)
#define TARRAY2_DATA(a) ((a)->data)
#define TARRAY2_GET(a, i) ((a)->data[i]) #define TARRAY2_GET(a, i) ((a)->data[i])
#define TARRAY2_GET_PTR(a, i) (&((a)->data[i])) #define TARRAY2_GET_PTR(a, i) (&((a)->data[i]))
#define TARRAY2_FIRST(a) ((a)->data[0]) #define TARRAY2_FIRST(a) ((a)->data[0])
......
...@@ -57,8 +57,8 @@ SSttLvl *tsdbTFileSetGetLvl(STFileSet *fset, int32_t level); ...@@ -57,8 +57,8 @@ SSttLvl *tsdbTFileSetGetLvl(STFileSet *fset, int32_t level);
bool tsdbTFileSetIsEmpty(const STFileSet *fset); bool tsdbTFileSetIsEmpty(const STFileSet *fset);
struct STFileOp { struct STFileOp {
int32_t fid;
tsdb_fop_t optype; tsdb_fop_t optype;
int32_t fid;
STFile of; // old file state STFile of; // old file state
STFile nf; // new file state STFile nf; // new file state
}; };
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
extern "C" { extern "C" {
#endif #endif
typedef TARRAY2(SSttBlk) TSttBlkArray;
// SSttFileReader ========================================== // SSttFileReader ==========================================
typedef struct SSttFSegReader SSttFSegReader; typedef struct SSttFSegReader SSttFSegReader;
typedef struct SSttFileReader SSttFileReader; typedef struct SSttFileReader SSttFileReader;
...@@ -54,19 +56,20 @@ struct SSttFileReaderConfig { ...@@ -54,19 +56,20 @@ struct SSttFileReaderConfig {
typedef struct SSttFileWriter SSttFileWriter; typedef struct SSttFileWriter SSttFileWriter;
typedef struct SSttFileWriterConfig SSttFileWriterConfig; typedef struct SSttFileWriterConfig SSttFileWriterConfig;
int32_t tsdbSttFWriterOpen(const SSttFileWriterConfig *config, SSttFileWriter **ppWriter); int32_t tsdbSttFWriterOpen(const SSttFileWriterConfig *config, SSttFileWriter **writer);
int32_t tsdbSttFWriterClose(SSttFileWriter **ppWriter, int8_t abort, struct STFileOp *op); int32_t tsdbSttFWriterClose(SSttFileWriter **writer, int8_t abort, STFileOp *op);
int32_t tsdbSttFWriteTSData(SSttFileWriter *pWriter, SRowInfo *pRowInfo); int32_t tsdbSttFWriteTSData(SSttFileWriter *writer, SRowInfo *pRowInfo);
int32_t tsdbSttFWriteTSDataBlock(SSttFileWriter *pWriter, SBlockData *pBlockData); int32_t tsdbSttFWriteTSDataBlock(SSttFileWriter *writer, SBlockData *pBlockData);
int32_t tsdbSttFWriteDLData(SSttFileWriter *pWriter, TABLEID *tbid, SDelData *pDelData); int32_t tsdbSttFWriteDLData(SSttFileWriter *writer, TABLEID *tbid, SDelData *pDelData);
struct SSttFileWriterConfig { struct SSttFileWriterConfig {
STsdb *pTsdb; STsdb *tsdb;
int32_t maxRow; int32_t maxRow;
int32_t szPage; int32_t szPage;
int8_t cmprAlg; int8_t cmprAlg;
SSkmInfo *pSkmTb; int64_t compVer; // compact version
SSkmInfo *pSkmRow; SSkmInfo *skmTb;
SSkmInfo *skmRow;
uint8_t **aBuf; uint8_t **aBuf;
STFile file; STFile file;
}; };
......
...@@ -58,12 +58,12 @@ static int32_t open_writer_with_new_stt(SCommitter *pCommitter) { ...@@ -58,12 +58,12 @@ static int32_t open_writer_with_new_stt(SCommitter *pCommitter) {
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
} }
config.pTsdb = pTsdb; config.tsdb = pTsdb;
config.maxRow = pCommitter->maxRow; config.maxRow = pCommitter->maxRow;
config.szPage = pVnode->config.tsdbPageSize; config.szPage = pVnode->config.tsdbPageSize;
config.cmprAlg = pCommitter->cmprAlg; config.cmprAlg = pCommitter->cmprAlg;
config.pSkmTb = NULL; config.skmTb = NULL;
config.pSkmRow = NULL; config.skmRow = NULL;
config.aBuf = NULL; config.aBuf = NULL;
config.file.type = TSDB_FTYPE_STT; config.file.type = TSDB_FTYPE_STT;
config.file.did = did; config.file.did = did;
...@@ -93,12 +93,12 @@ static int32_t open_writer_with_exist_stt(SCommitter *pCommitter, const STFile * ...@@ -93,12 +93,12 @@ static int32_t open_writer_with_exist_stt(SCommitter *pCommitter, const STFile *
SSttFileWriterConfig config = { SSttFileWriterConfig config = {
// //
.pTsdb = pTsdb, .tsdb = pTsdb,
.maxRow = pCommitter->maxRow, .maxRow = pCommitter->maxRow,
.szPage = pVnode->config.tsdbPageSize, .szPage = pVnode->config.tsdbPageSize,
.cmprAlg = pCommitter->cmprAlg, .cmprAlg = pCommitter->cmprAlg,
.pSkmTb = NULL, .skmTb = NULL,
.pSkmRow = NULL, .skmRow = NULL,
.aBuf = NULL, .aBuf = NULL,
.file = *pFile // .file = *pFile //
}; };
......
...@@ -222,12 +222,12 @@ static int32_t tsdbMergeFileSetBegin(SMerger *merger) { ...@@ -222,12 +222,12 @@ static int32_t tsdbMergeFileSetBegin(SMerger *merger) {
// open stt file writer // open stt file writer
if (lvl) { if (lvl) {
SSttFileWriterConfig config = { SSttFileWriterConfig config = {
.pTsdb = merger->tsdb, .tsdb = merger->tsdb,
.maxRow = merger->maxRow, .maxRow = merger->maxRow,
.szPage = merger->szPage, .szPage = merger->szPage,
.cmprAlg = merger->cmprAlg, .cmprAlg = merger->cmprAlg,
.pSkmTb = &merger->skmTb, .skmTb = &merger->skmTb,
.pSkmRow = &merger->skmRow, .skmRow = &merger->skmRow,
.aBuf = merger->aBuf, .aBuf = merger->aBuf,
.file = fobj->f, .file = fobj->f,
}; };
...@@ -235,12 +235,12 @@ static int32_t tsdbMergeFileSetBegin(SMerger *merger) { ...@@ -235,12 +235,12 @@ static int32_t tsdbMergeFileSetBegin(SMerger *merger) {
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
} else { } else {
SSttFileWriterConfig config = { SSttFileWriterConfig config = {
.pTsdb = merger->tsdb, .tsdb = merger->tsdb,
.maxRow = merger->maxRow, .maxRow = merger->maxRow,
.szPage = merger->szPage, .szPage = merger->szPage,
.cmprAlg = merger->cmprAlg, .cmprAlg = merger->cmprAlg,
.pSkmTb = &merger->skmTb, .skmTb = &merger->skmTb,
.pSkmRow = &merger->skmRow, .skmRow = &merger->skmRow,
.aBuf = merger->aBuf, .aBuf = merger->aBuf,
.file = .file =
(STFile){ (STFile){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册