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 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;
|
||||||
|
|
Loading…
Reference in New Issue