diff --git a/src/tsdb/inc/tsdbFile.h b/src/tsdb/inc/tsdbFile.h index fcd435728da0b2f77ee0e9debf2fc650967073f9..776b24870b28af17d2638990daf1c9939b53a6c5 100644 --- a/src/tsdb/inc/tsdbFile.h +++ b/src/tsdb/inc/tsdbFile.h @@ -325,11 +325,11 @@ static FORCE_INLINE uint8_t tsdbGetNFiles(SDFileSet* pSet) { #define TSDB_DFILE_IN_SET(s, t) ((s)->files + (t)) #define TSDB_FSET_LEVEL(s) TSDB_FILE_LEVEL(TSDB_DFILE_IN_SET(s, 0)) #define TSDB_FSET_ID(s) TSDB_FILE_ID(TSDB_DFILE_IN_SET(s, 0)) -#define TSDB_FSET_SET_CLOSED(s) \ - do { \ - for (TSDB_FILE_T ftype = TSDB_FILE_HEAD; ftype < tsdbGetNFiles(s); ftype++) { \ - TSDB_FILE_SET_CLOSED(TSDB_DFILE_IN_SET(s, ftype)); \ - } \ +#define TSDB_FSET_SET_CLOSED(s) \ + do { \ + for (TSDB_FILE_T ftype = TSDB_FILE_HEAD; ftype < TSDB_FILE_MAX; ftype++) { \ + TSDB_FILE_SET_CLOSED(TSDB_DFILE_IN_SET(s, ftype)); \ + } \ } while (0); #define TSDB_FSET_FSYNC(s) \ do { \ @@ -337,12 +337,6 @@ static FORCE_INLINE uint8_t tsdbGetNFiles(SDFileSet* pSet) { TSDB_FILE_FSYNC(TSDB_DFILE_IN_SET(s, ftype)); \ } \ } while (0); -#define TSDB_FSET_SET_INIT(s) \ - do { \ - for (TSDB_FILE_T ftype = TSDB_FILE_HEAD; ftype < TSDB_FILE_MAX; ftype++) { \ - TSDB_FILE_SET_CLOSED(TSDB_DFILE_IN_SET(s, ftype)); \ - } \ - } while (0); void tsdbInitDFileSet(SDFileSet* pSet, SDiskID did, int vid, int fid, uint32_t ver, uint8_t fsetVer); void tsdbInitDFileSetEx(SDFileSet* pSet, SDFileSet* pOSet); diff --git a/src/tsdb/src/tsdbCommit.c b/src/tsdb/src/tsdbCommit.c index 27945ca66d3f44832c7d9f5f29876583550e8cb3..539713d4fa2f43700ace9f063e98b92f1338226e 100644 --- a/src/tsdb/src/tsdbCommit.c +++ b/src/tsdb/src/tsdbCommit.c @@ -844,7 +844,7 @@ static int tsdbInitCommitH(SCommitH *pCommith, STsdbRepo *pRepo) { memset(pCommith, 0, sizeof(*pCommith)); tsdbGetRtnSnap(pRepo, &(pCommith->rtn)); - TSDB_FSET_SET_INIT(TSDB_COMMIT_WRITE_FSET(pCommith)); + TSDB_FSET_SET_CLOSED(TSDB_COMMIT_WRITE_FSET(pCommith)); // Init read handle if (tsdbInitReadH(&(pCommith->readh), pRepo) < 0) { diff --git a/src/tsdb/src/tsdbCompact.c b/src/tsdb/src/tsdbCompact.c index fbd5622c138c9209a0e868b3d740ee26f0ef8c36..4722b0e420034645a9aa76a384dde3eec8396050 100644 --- a/src/tsdb/src/tsdbCompact.c +++ b/src/tsdb/src/tsdbCompact.c @@ -274,7 +274,7 @@ static int tsdbCompactMeta(STsdbRepo *pRepo) { memset(pComph, 0, sizeof(*pComph)); - TSDB_FSET_SET_INIT(TSDB_COMPACT_WSET(pComph)); + TSDB_FSET_SET_CLOSED(TSDB_COMPACT_WSET(pComph)); tsdbGetRtnSnap(pRepo, &(pComph->rtn)); tsdbFSIterInit(&(pComph->fsIter), REPO_FS(pRepo), TSDB_FS_ITER_FORWARD); diff --git a/src/tsdb/src/tsdbFS.c b/src/tsdb/src/tsdbFS.c index 1edf21644885b2740b6492dfbe7695af54d0ac60..a559ddb0d14c537fab8e5f1bf01b261ec5ee34e5 100644 --- a/src/tsdb/src/tsdbFS.c +++ b/src/tsdb/src/tsdbFS.c @@ -1200,7 +1200,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { SDFileSet fset = {0}; - TSDB_FSET_SET_INIT(&fset); + TSDB_FSET_SET_CLOSED(&fset); // Loop to recover ONE fset for (TSDB_FILE_T ftype = 0; ftype < TSDB_FILE_MAX; ftype++) { @@ -1355,7 +1355,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { if (index == 0) { memset(&fset, 0, sizeof(SDFileSet)); - TSDB_FSET_SET_INIT(&fset); + TSDB_FSET_SET_CLOSED(&fset); nDFiles = 1; fset.fid = tfid; pDFile->f = *pf; @@ -1377,7 +1377,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { } else { // next FSet memset(&fset, 0, sizeof(SDFileSet)); - TSDB_FSET_SET_INIT(&fset); + TSDB_FSET_SET_CLOSED(&fset); nDFiles = 1; fset.fid = tfid; pDFile->f = *pf; @@ -1437,7 +1437,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { // next FSet memset(&fset, 0, sizeof(SDFileSet)); - TSDB_FSET_SET_INIT(&fset); + TSDB_FSET_SET_CLOSED(&fset); nDFiles = 1; fset.fid = tfid; pDFile->f = *pf;