提交 ca23365d 编写于 作者: B Benguang Zhao

enh: fsync WAL idx and log when walRollImpl

上级 b09bb40e
...@@ -387,20 +387,33 @@ END: ...@@ -387,20 +387,33 @@ END:
int32_t walRollImpl(SWal *pWal) { int32_t walRollImpl(SWal *pWal) {
int32_t code = 0; int32_t code = 0;
if (pWal->pIdxFile != NULL) { if (pWal->pIdxFile != NULL) {
code = taosFsyncFile(pWal->pIdxFile);
if (code != 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
goto END;
}
code = taosCloseFile(&pWal->pIdxFile); code = taosCloseFile(&pWal->pIdxFile);
if (code != 0) { if (code != 0) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
goto END; goto END;
} }
} }
if (pWal->pLogFile != NULL) { if (pWal->pLogFile != NULL) {
code = taosFsyncFile(pWal->pLogFile);
if (code != 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
goto END;
}
code = taosCloseFile(&pWal->pLogFile); code = taosCloseFile(&pWal->pLogFile);
if (code != 0) { if (code != 0) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
goto END; goto END;
} }
} }
TdFilePtr pIdxFile, pLogFile; TdFilePtr pIdxFile, pLogFile;
// create new file // create new file
int64_t newFileFirstVer = pWal->vers.lastVer + 1; int64_t newFileFirstVer = pWal->vers.lastVer + 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册