This commit is contained in:
Hongze Cheng 2020-11-26 07:08:47 +00:00
parent fb0609f014
commit 4b1803528b
4 changed files with 7 additions and 5 deletions

View File

@ -162,7 +162,7 @@ const char *TFS_DISK_PATH(int level, int id) { return DISK_DIR(TFS_DISK_AT(level
// TFILE APIs ====================================
static void tfsSetFileAname(TFILE *pf) {
if (TFS_IS_VALID_DISK(pf->level, pf->id)) {
SDisk *pDisk = TFS_DISK_AT(pf->level, pf->level);
SDisk *pDisk = TFS_DISK_AT(pf->level, pf->id);
ASSERT(pDisk != NULL);
snprintf(pf->aname, TSDB_FILENAME_LEN, "%s/%s", DISK_DIR(pDisk), pf->rname);
}

View File

@ -511,7 +511,7 @@ static FORCE_INLINE STsdbBufBlock* tsdbGetCurrBufBlock(STsdbRepo* pRepo) {
STsdbFileH* tsdbNewFileH(STsdbCfg* pCfg);
void tsdbFreeFileH(STsdbFileH* pFileH);
int tsdbOpenFileH(STsdbRepo* pRepo);
void tsdbCloseFileH(STsdbRepo* pRepo);
void tsdbCloseFileH(STsdbRepo* pRepo, bool isRestart);
SFileGroup *tsdbCreateFGroup(STsdbRepo *pRepo, int fid, int level);
void tsdbInitFileGroupIter(STsdbFileH* pFileH, SFileGroupIter* pIter, int direction);
void tsdbSeekFileGroupIter(SFileGroupIter* pIter, int fid);

View File

@ -124,7 +124,7 @@ int tsdbOpenFileH(STsdbRepo *pRepo) {
return 0;
}
void tsdbCloseFileH(STsdbRepo *pRepo) {
void tsdbCloseFileH(STsdbRepo *pRepo, bool isRestart) {
STsdbFileH *pFileH = pRepo->tsdbFileH;
for (int i = 0; i < pFileH->nFGroups; i++) {
@ -132,7 +132,9 @@ void tsdbCloseFileH(STsdbRepo *pRepo) {
for (int type = 0; type < TSDB_FILE_TYPE_MAX; type++) {
tsdbCloseFile(&(pFGroup->files[type]));
}
tfsDecDiskFile(pFGroup->files[0].file.level, pFGroup->files[0].file.level, TSDB_FILE_TYPE_MAX);
if (isRestart) {
tfsDecDiskFile(pFGroup->files[0].file.level, pFGroup->files[0].file.level, TSDB_FILE_TYPE_MAX);
}
}
}

View File

@ -151,7 +151,7 @@ int tsdbCloseRepo(TSDB_REPO_T *repo, int toCommit) {
pRepo->mem = NULL;
pRepo->imem = NULL;
tsdbCloseFileH(pRepo);
tsdbCloseFileH(pRepo, !toCommit);
tsdbCloseBufPool(pRepo);
tsdbCloseMeta(pRepo);
tsdbFreeRepo(pRepo);