提交 a2dafefe 编写于 作者: H Hongze Cheng

more code

上级 33afb08e
......@@ -32,31 +32,36 @@ typedef TARRAY2(SColumnDataAgg) TColumnDataAggArray;
typedef struct SDataFileReader SDataFileReader;
typedef struct SDataFileReaderConfig {
STsdb *tsdb;
STFile f[TSDB_FTYPE_MAX];
int32_t szPage;
struct {
bool exist;
STFile file;
} files[TSDB_FTYPE_MAX];
uint8_t **bufArr;
} SDataFileReaderConfig;
int32_t tsdbDataFileReaderOpen(const char *fname[/* TSDB_FTYPE_MAX */], const SDataFileReaderConfig *config,
SDataFileReader **reader);
int32_t tsdbDataFileReaderClose(SDataFileReader *reader);
int32_t tsdbDataFileReaderClose(SDataFileReader **reader);
int32_t tsdbDataFileReadBlockIdx(SDataFileReader *reader, const TBlockIdxArray **blockIdxArray);
int32_t tsdbDataFileReadDataBlk(SDataFileReader *reader, const SBlockIdx *blockIdx, const TDataBlkArray **dataBlkArray);
int32_t tsdbDataFileReadDataBlock(SDataFileReader *reader, const SDataBlk *dataBlk, SBlockData *bData);
int32_t tsdbDataFileReadDelData(SDataFileReader *reader, const SDelBlk *delBlk, SDelData *dData);
// SDataFileWriter =============================================
typedef struct SDataFileWriter SDataFileWriter;
typedef struct SDataFileWriterConfig {
STsdb *tsdb;
bool hasOldFile;
STFile of[TSDB_FTYPE_MAX];
int8_t cmprAlg;
int32_t maxRow;
int32_t szPage;
int64_t cid;
SDiskID did[1];
int64_t compactVersion;
STsdb *tsdb;
int8_t cmprAlg;
int32_t maxRow;
int32_t szPage;
int32_t fid;
int64_t cid;
SDiskID did;
int64_t compactVersion;
struct {
bool exist;
STFile file;
} files[TSDB_FTYPE_MAX];
SSkmInfo *skmTb;
SSkmInfo *skmRow;
uint8_t **bufArr;
......@@ -66,7 +71,7 @@ int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWri
int32_t tsdbDataFileWriterClose(SDataFileWriter **writer, bool abort, STFileOp op[/*TSDB_FTYPE_MAX*/]);
int32_t tsdbDataFileWriteTSData(SDataFileWriter *writer, SRowInfo *row);
int32_t tsdbDataFileWriteTSDataBlock(SDataFileWriter *writer, SBlockData *bData);
int32_t tsdbDataFileFLushTSDataBlock(SDataFileWriter *writer);
int32_t tsdbDataFileFlushTSDataBlock(SDataFileWriter *writer);
#ifdef __cplusplus
}
......
......@@ -127,7 +127,7 @@ static int32_t tsdbMergeToDataTableEnd(SMerger *merger) {
TSDB_CHECK_CODE(code, lino, _exit);
}
code = tsdbDataFileFLushTSDataBlock(merger->dataWriter);
code = tsdbDataFileFlushTSDataBlock(merger->dataWriter);
TSDB_CHECK_CODE(code, lino, _exit);
for (int32_t i = numRow; i < merger->ctx->bData[pidx].nRow; i++) {
......@@ -406,54 +406,35 @@ static int32_t tsdbMergeFileSetBeginOpenWriter(SMerger *merger) {
}
if (merger->ctx->toData) {
// TODO
SDiskID did[1];
SDiskID did;
int32_t level = tsdbFidLevel(merger->ctx->fset->fid, &merger->tsdb->keepCfg, merger->ctx->now);
if (tfsAllocDisk(merger->tsdb->pVnode->pTfs, level, did) < 0) {
if (tfsAllocDisk(merger->tsdb->pVnode->pTfs, level, &did) < 0) {
code = TSDB_CODE_FS_NO_VALID_DISK;
TSDB_CHECK_CODE(code, lino, _exit);
}
SDataFileWriterConfig config = {
SDataFileWriterConfig config[1] = {{
.tsdb = merger->tsdb,
.cmprAlg = merger->cmprAlg,
.maxRow = merger->maxRow,
.of =
{
[0] =
{
.type = TSDB_FTYPE_HEAD,
.did = did[0],
.fid = merger->ctx->fset->fid,
.cid = merger->cid,
.size = 0,
},
[1] =
{
.type = TSDB_FTYPE_DATA,
.did = did[0],
.fid = merger->ctx->fset->fid,
.cid = merger->cid,
.size = 0,
},
[2] =
{
.type = TSDB_FTYPE_SMA,
.did = did[0],
.fid = merger->ctx->fset->fid,
.cid = merger->cid,
.size = 0,
},
[3] =
{
.type = TSDB_FTYPE_TOMB,
.did = did[0],
.fid = merger->ctx->fset->fid,
.cid = merger->cid,
.size = 0,
},
},
};
code = tsdbDataFileWriterOpen(&config, &merger->dataWriter);
.szPage = merger->szPage,
.fid = merger->ctx->fset->fid,
.cid = merger->cid,
.did = did,
.compactVersion = merger->compactVersion,
}};
for (int32_t i = 0; i < TSDB_FTYPE_MAX; i++) {
if (merger->ctx->fset->farr[i]) {
config->files[i].exist = true;
config->files[i].file = merger->ctx->fset->farr[i]->f[0];
} else {
config->files[i].exist = false;
}
}
code = tsdbDataFileWriterOpen(config, &merger->dataWriter);
TSDB_CHECK_CODE(code, lino, _exit);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册