diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbCommit.c b/source/dnode/vnode/src/tsdb/dev/tsdbCommit.c index a9fe9d8574..e8bac47ae8 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbCommit.c @@ -59,7 +59,7 @@ static int32_t open_committer_writer(SCommitter *pCommitter) { } else { conf.file.type = TSDB_FTYPE_STT; - if (tfsAllocDisk(pTsdb->pVnode->pTfs, pCommitter->expLevel, &conf.file.diskId) < 0) { + if (tfsAllocDisk(pTsdb->pVnode->pTfs, pCommitter->expLevel, &conf.file.did) < 0) { code = TSDB_CODE_FS_NO_VALID_DISK; TSDB_CHECK_CODE(code, lino, _exit); } diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbFSet.h b/source/dnode/vnode/src/tsdb/dev/tsdbFSet.h index 4e37d6df78..effe8c0494 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbFSet.h +++ b/source/dnode/vnode/src/tsdb/dev/tsdbFSet.h @@ -49,8 +49,8 @@ struct SSttLvl { struct SFileSet { int32_t fid; int64_t nextid; - struct STFile *farr[TSDB_FTYPE_MAX]; - SSttLvl lvl0; // level 0 of .stt + struct STFile *farr[TSDB_FTYPE_MAX]; // file array + SSttLvl lvl0; // level 0 of .stt }; int32_t tsdbFileSetCreate(int32_t fid, struct SFileSet **ppSet); diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbFile.c b/source/dnode/vnode/src/tsdb/dev/tsdbFile.c index 13a677e21d..05c4d5d57e 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbFile.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbFile.c @@ -51,16 +51,16 @@ int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile) { STfs *pTfs = pVnode->pTfs; if (pTfs) { - snprintf(pFile->fname, // - TSDB_FILENAME_LEN, // - "%s%s%s%sv%df%dver%" PRId64 "%s", // - tfsGetDiskPath(pTfs, pFile->diskId), // - TD_DIRSEP, // - pTsdb->path, // - TD_DIRSEP, // - TD_VID(pVnode), // - pFile->fid, // - pFile->cid, // + snprintf(pFile->fname, // + TSDB_FILENAME_LEN, // + "%s%s%s%sv%df%dver%" PRId64 "%s", // + tfsGetDiskPath(pTfs, pFile->did), // + TD_DIRSEP, // + pTsdb->path, // + TD_DIRSEP, // + TD_VID(pVnode), // + pFile->fid, // + pFile->cid, // tsdb_ftype_suffix[pFile->type]); } else { snprintf(pFile->fname, // diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbFile.h b/source/dnode/vnode/src/tsdb/dev/tsdbFile.h index fe7579f01f..c70a523636 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbFile.h +++ b/source/dnode/vnode/src/tsdb/dev/tsdbFile.h @@ -22,6 +22,8 @@ extern "C" { #endif +typedef struct STFile STFile; + typedef enum { TSDB_FTYPE_HEAD = 0, // .head TSDB_FTYPE_DATA, // .data @@ -31,21 +33,42 @@ typedef enum { TSDB_FTYPE_STT, // .stt } tsdb_ftype_t; -struct STFile { - char fname[TSDB_FILENAME_LEN]; - int32_t ref; - tsdb_ftype_t type; - SDiskID diskId; - int64_t size; - int64_t cid; - int32_t fid; -}; - int32_t tsdbTFileCreate(const struct STFile *config, struct STFile **ppFile); int32_t tsdbTFileDestroy(struct STFile *pFile); int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile); int32_t tsdbTFileClear(struct STFile *pFile); +struct STFile { + char fname[TSDB_FILENAME_LEN]; + int32_t ref; + int32_t state; + tsdb_ftype_t type; + SDiskID did; + int64_t size; + int64_t cid; + int32_t fid; + union { + struct { + int32_t level; // level of .stt + int32_t nSeg; // number of segments in .stt + } stt; + struct { + // TODO + } head; + struct { + // TODO + } data; + struct { + // TODO + } sma; + struct { + // TODO + } tomb; + }; + + LISTD(struct STFile) listNode; +}; + #ifdef __cplusplus } #endif