enh: fsync WAL idx and log when walRollImpl
This commit is contained in:
parent
b09bb40e2d
commit
ca23365d68
|
@ -387,20 +387,33 @@ END:
|
|||
|
||||
int32_t walRollImpl(SWal *pWal) {
|
||||
int32_t code = 0;
|
||||
|
||||
if (pWal->pIdxFile != NULL) {
|
||||
code = taosFsyncFile(pWal->pIdxFile);
|
||||
if (code != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
goto END;
|
||||
}
|
||||
code = taosCloseFile(&pWal->pIdxFile);
|
||||
if (code != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
goto END;
|
||||
}
|
||||
}
|
||||
|
||||
if (pWal->pLogFile != NULL) {
|
||||
code = taosFsyncFile(pWal->pLogFile);
|
||||
if (code != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
goto END;
|
||||
}
|
||||
code = taosCloseFile(&pWal->pLogFile);
|
||||
if (code != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
goto END;
|
||||
}
|
||||
}
|
||||
|
||||
TdFilePtr pIdxFile, pLogFile;
|
||||
// create new file
|
||||
int64_t newFileFirstVer = pWal->vers.lastVer + 1;
|
||||
|
|
Loading…
Reference in New Issue