[TD-13062]<fix>: file system write fsync error

This commit is contained in:
afwerar 2022-02-28 01:15:03 +08:00
parent 52bfe618e5
commit c4a1bae79c
1 changed files with 2 additions and 0 deletions

View File

@ -296,6 +296,7 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
if (errno == EINTR) { if (errno == EINTR) {
continue; continue;
} }
fflush(pFile->fp);
fsync(pFile->fd); fsync(pFile->fd);
return -1; return -1;
} }
@ -303,6 +304,7 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
tbuf += nwritten; tbuf += nwritten;
} }
fflush(pFile->fp);
fsync(pFile->fd); fsync(pFile->fd);
return count; return count;
} }