fix: minor changes

This commit is contained in:
Shengliang Guan 2023-01-06 15:55:16 +08:00
parent 4a90f84e26
commit f5a6108ca0
1 changed files with 7 additions and 2 deletions

View File

@ -650,6 +650,9 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
goto _OVER;
}
taosCloseFile(&pIter->file);
pIter->file = NULL;
char datafile[PATH_MAX] = {0};
snprintf(datafile, sizeof(datafile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
if (taosRenameFile(pIter->name, datafile) != 0) {
@ -677,8 +680,10 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
code = 0;
_OVER:
taosCloseFile(&pIter->file);
pIter->file = NULL;
if (pIter->file != NULL) {
taosCloseFile(&pIter->file);
pIter->file = NULL;
}
sdbCloseIter(pIter);
return code;
}