提交 11e00e56 编写于 作者: C Cary Xu

code optimization

上级 4fbf2ad4
...@@ -1299,6 +1299,17 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { ...@@ -1299,6 +1299,17 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
} }
#endif #endif
// update the function if the DFileSet definition updates
static bool tsdbIsDFileSetValid(int nFiles) {
switch (nFiles) {
case TSDB_FILE_MIN:
case TSDB_FILE_MAX:
return true;
default:
return false;
}
}
#if 1 #if 1
static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
const TFILE *pf = NULL; const TFILE *pf = NULL;
...@@ -1359,13 +1370,13 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { ...@@ -1359,13 +1370,13 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
++nDFiles; ++nDFiles;
pDFile->f = *pf; pDFile->f = *pf;
// (1) the array ends // (1) the array ends
if ((index == fArraySize - 1) && (nDFiles >= TSDB_FILE_MIN)) { if ((index == fArraySize - 1) && tsdbIsDFileSetValid(nDFiles)) {
tsdbInfo("vgId:%d DFileSet %d is fetched, nDFiles=%" PRIu8, REPO_ID(pRepo), fset.fid, nDFiles); tsdbInfo("vgId:%d DFileSet %d is fetched, nDFiles=%" PRIu8, REPO_ID(pRepo), fset.fid, nDFiles);
isOneFSetFinish = true; isOneFSetFinish = true;
} }
} else { } else {
// (2) encounter different fid // (2) encounter different fid
if (nDFiles >= TSDB_FILE_MIN) { if (tsdbIsDFileSetValid(nDFiles)) {
tsdbInfo("vgId:%d DFileSet %d is fetched, nDFiles=%" PRIu8, REPO_ID(pRepo), fset.fid, nDFiles); tsdbInfo("vgId:%d DFileSet %d is fetched, nDFiles=%" PRIu8, REPO_ID(pRepo), fset.fid, nDFiles);
isOneFSetFinish = true; isOneFSetFinish = true;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册