From c336ec749a74adc530c2f20012dd261c8e15646e Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sun, 23 Apr 2023 14:02:43 +0800 Subject: [PATCH] more code --- source/dnode/vnode/src/tsdb/dev/dev.h | 11 +++++++++++ source/dnode/vnode/src/tsdb/dev/tsdbFSet.c | 2 +- source/dnode/vnode/src/tsdb/dev/tsdbFSet.h | 8 ++++---- source/dnode/vnode/src/tsdb/dev/tsdbSttFReader.c | 7 +++++++ source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c | 6 ------ source/dnode/vnode/src/tsdb/dev/tsdbUtil.h | 5 ----- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/dev/dev.h b/source/dnode/vnode/src/tsdb/dev/dev.h index 4dc39874e2..36e5dbc625 100644 --- a/source/dnode/vnode/src/tsdb/dev/dev.h +++ b/source/dnode/vnode/src/tsdb/dev/dev.h @@ -22,6 +22,17 @@ extern "C" { #endif +typedef struct SFDataPtr { + int64_t offset; + int64_t size; +} SFDataPtr; + +typedef struct { + int64_t prevFooter; + SFDataPtr dict[4]; // 0:bloom filter, 1:SSttBlk, 2:STbStatisBlk, 3:SDelBlk + uint8_t reserved[24]; +} SFSttFooter; + #include "tsdbUtil.h" #include "tsdbFile.h" diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbFSet.c b/source/dnode/vnode/src/tsdb/dev/tsdbFSet.c index fb719cfec6..e6c564e381 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbFSet.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbFSet.c @@ -51,7 +51,7 @@ int32_t tsdbFileSetEdit(struct SFileSet *pSet, struct SFileOp *pOp) { ppFile = &pSet->fTomb; } break; case TSDB_FTYPE_STT: { - ppFile = &pSet->lStt[0].fStt; + // ppFile = &pSet->lStt[0].fStt; } break; default: { ASSERTS(0, "Invalid file type"); diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbFSet.h b/source/dnode/vnode/src/tsdb/dev/tsdbFSet.h index d4df14f552..ce08048484 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbFSet.h +++ b/source/dnode/vnode/src/tsdb/dev/tsdbFSet.h @@ -22,7 +22,7 @@ extern "C" { #endif -typedef struct SSttLevel SSttLevel; +typedef struct SSttLvl SSttLvl; typedef enum { TSDB_FOP_EXTEND = -2, @@ -39,10 +39,10 @@ struct SFileOp { struct STFile nState; // new file state }; -struct SSttLevel { +struct SSttLvl { int32_t level; int32_t nStt; - SSttLevel *pNext; + SSttLvl *pNext; struct STFile *fSttList; }; @@ -53,7 +53,7 @@ struct SFileSet { struct STFile *fData; // .data struct STFile *fSma; // .sma struct STFile *fTomb; // .tomb - SSttLevel *sttLevelList; + SSttLvl *sttLevelList; }; int32_t tsdbFileSetCreate(int32_t fid, struct SFileSet **ppSet); diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbSttFReader.c b/source/dnode/vnode/src/tsdb/dev/tsdbSttFReader.c index ab07f48dfd..f975b91abd 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbSttFReader.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbSttFReader.c @@ -14,6 +14,13 @@ */ #include "tsdbSttFReader.h" +#include "dev.h" + +struct SSttFReader { + STsdb *pTsdb; + SFSttFooter footer; + const void *bloomFilter; +}; int32_t tsdbSttFReaderOpen(const struct SSttFReaderConf *pConf, struct SSttFReader **ppReader) { int32_t code = 0; diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c b/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c index 795db6f6da..5407130d9c 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c @@ -21,12 +21,6 @@ extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, extern int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size); extern int32_t tsdbFsyncFile(STsdbFD *pFD); -typedef struct { - int64_t prevFooter; - SFDataPtr dict[4]; // 0:bloom filter, 1:SSttBlk, 2:STbStatisBlk, 3:SDelBlk - uint8_t reserved[24]; -} SFSttFooter; - struct SSttFWriter { struct SSttFWriterConf config; // file diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbUtil.h b/source/dnode/vnode/src/tsdb/dev/tsdbUtil.h index fd2b983661..292f14395b 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbUtil.h +++ b/source/dnode/vnode/src/tsdb/dev/tsdbUtil.h @@ -26,11 +26,6 @@ extern "C" { typedef struct SDelBlock SDelBlock; typedef struct SDelBlk SDelBlk; -typedef struct SFDataPtr { - int64_t offset; - int64_t size; -} SFDataPtr; - int32_t tDelBlockCreate(SDelBlock *pDelBlock, int32_t capacity); int32_t tDelBlockDestroy(SDelBlock *pDelBlock); int32_t tDelBlockClear(SDelBlock *pDelBlock); -- GitLab