提交 cebb964e 编写于 作者: H Hongze Cheng

fix more code

上级 1d6c5e63
...@@ -701,11 +701,14 @@ _exit: ...@@ -701,11 +701,14 @@ _exit:
int32_t tsdbFSCommit(STsdb *pTsdb) { int32_t tsdbFSCommit(STsdb *pTsdb) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino = 0;
STsdbFS fs = {0};
char current[TSDB_FILENAME_LEN] = {0}; char current[TSDB_FILENAME_LEN] = {0};
char current_t[TSDB_FILENAME_LEN] = {0}; char current_t[TSDB_FILENAME_LEN] = {0};
tsdbGetCurrentFName(pTsdb, current, current_t); tsdbGetCurrentFName(pTsdb, current, current_t);
if (!taosCheckExistFile(current_t)) goto _exit;
// rename the file // rename the file
if (taosRenameFile(current_t, current) < 0) { if (taosRenameFile(current_t, current) < 0) {
code = TAOS_SYSTEM_ERROR(errno); code = TAOS_SYSTEM_ERROR(errno);
...@@ -713,11 +716,10 @@ int32_t tsdbFSCommit(STsdb *pTsdb) { ...@@ -713,11 +716,10 @@ int32_t tsdbFSCommit(STsdb *pTsdb) {
} }
// Load the new FS // Load the new FS
STsdbFS fs = {0};
code = tsdbFSCreate(&fs); code = tsdbFSCreate(&fs);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
code = tsdbLoadFSFromFile(current_t, &fs); code = tsdbLoadFSFromFile(current, &fs);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
// apply file change // apply file change
...@@ -727,7 +729,7 @@ int32_t tsdbFSCommit(STsdb *pTsdb) { ...@@ -727,7 +729,7 @@ int32_t tsdbFSCommit(STsdb *pTsdb) {
_exit: _exit:
tsdbFSDestroy(&fs); tsdbFSDestroy(&fs);
if (code) { if (code) {
tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(errno)); tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
} }
return code; return code;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册