提交 e89ab2c7 编写于 作者: S Shengliang Guan

Merge remote-tracking branch 'origin/master' into hotfix/os

...@@ -132,7 +132,7 @@ int tsdbOpenFileH(STsdbRepo *pRepo) { ...@@ -132,7 +132,7 @@ int tsdbOpenFileH(STsdbRepo *pRepo) {
char *fname = malloc(strlen(tDataDir) + strlen(dp->d_name) + 2); char *fname = malloc(strlen(tDataDir) + strlen(dp->d_name) + 2);
if (fname == NULL) goto _err; if (fname == NULL) goto _err;
sprintf(fname, "%s/%s", tDataDir, dp->d_name); sprintf(fname, "%s/%s", tDataDir, dp->d_name);
remove(fname); (void)remove(fname);
free(fname); free(fname);
} else if (code == REG_NOMATCH) { } else if (code == REG_NOMATCH) {
tsdbError("vgId:%d invalid file %s exists, ignore it", REPO_ID(pRepo), dp->d_name); tsdbError("vgId:%d invalid file %s exists, ignore it", REPO_ID(pRepo), dp->d_name);
...@@ -447,6 +447,8 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int32_t *size) { ...@@ -447,6 +447,8 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int32_t *size) {
*magic = info.magic; *magic = info.magic;
*size = (int32_t)offset; *size = (int32_t)offset;
return;
_err: _err:
if (fd >= 0) close(fd); if (fd >= 0) close(fd);
*magic = TSDB_FILE_INIT_MAGIC; *magic = TSDB_FILE_INIT_MAGIC;
......
...@@ -683,11 +683,11 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe ...@@ -683,11 +683,11 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe
pthread_rwlock_wrlock(&(pFileH->fhlock)); pthread_rwlock_wrlock(&(pFileH->fhlock));
rename(helperNewHeadF(pHelper)->fname, helperHeadF(pHelper)->fname); (void)rename(helperNewHeadF(pHelper)->fname, helperHeadF(pHelper)->fname);
pGroup->files[TSDB_FILE_TYPE_HEAD].info = helperNewHeadF(pHelper)->info; pGroup->files[TSDB_FILE_TYPE_HEAD].info = helperNewHeadF(pHelper)->info;
if (newLast) { if (newLast) {
rename(helperNewLastF(pHelper)->fname, helperLastF(pHelper)->fname); (void)rename(helperNewLastF(pHelper)->fname, helperLastF(pHelper)->fname);
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperNewLastF(pHelper)->info; pGroup->files[TSDB_FILE_TYPE_LAST].info = helperNewLastF(pHelper)->info;
} else { } else {
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperLastF(pHelper)->info; pGroup->files[TSDB_FILE_TYPE_LAST].info = helperLastF(pHelper)->info;
......
...@@ -351,6 +351,8 @@ void tsdbGetStoreInfo(char *fname, uint32_t *magic, int32_t *size) { ...@@ -351,6 +351,8 @@ void tsdbGetStoreInfo(char *fname, uint32_t *magic, int32_t *size) {
*magic = info.magic; *magic = info.magic;
*size = (int32_t)offset; *size = (int32_t)offset;
return;
_err: _err:
if (fd >= 0) close(fd); if (fd >= 0) close(fd);
*magic = TD_KVSTORE_INIT_MAGIC; *magic = TD_KVSTORE_INIT_MAGIC;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册