From 52bfe618e5295d25e598cacee43c21a7c9fda0c0 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Mon, 28 Feb 2022 01:08:12 +0800 Subject: [PATCH] [TD-13062]: file system write fsync error --- source/os/src/osFile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index c34513a2f1..70b4611dd2 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -240,6 +240,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile) { return 0; } fflush((*ppFile)->fp); + fsync((*ppFile)->fd); close((*ppFile)->fd); (*ppFile)->fd = -1; (*ppFile)->fp = NULL; @@ -295,12 +296,14 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) { if (errno == EINTR) { continue; } + fsync(pFile->fd); return -1; } nleft -= nwritten; tbuf += nwritten; } + fsync(pFile->fd); return count; } -- GitLab