未验证 提交 2a087a9b 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #19469 from taosdata/FIX/TD-21851-main

fix: synchronize access within walFsync
......@@ -635,6 +635,7 @@ int32_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, in
}
void walFsync(SWal *pWal, bool forceFsync) {
taosThreadMutexLock(&pWal->mutex);
if (forceFsync || (pWal->cfg.level == TAOS_WAL_FSYNC && pWal->cfg.fsyncPeriod == 0)) {
wTrace("vgId:%d, fileId:%" PRId64 ".idx, do fsync", pWal->cfg.vgId, walGetCurFileFirstVer(pWal));
if (taosFsyncFile(pWal->pIdxFile) < 0) {
......@@ -647,4 +648,5 @@ void walFsync(SWal *pWal, bool forceFsync) {
strerror(errno));
}
}
taosThreadMutexUnlock(&pWal->mutex);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册