[TD-13062]<fix>: file system write fsync error
This commit is contained in:
parent
7ba4e6f49b
commit
52bfe618e5
|
@ -240,6 +240,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
fflush((*ppFile)->fp);
|
fflush((*ppFile)->fp);
|
||||||
|
fsync((*ppFile)->fd);
|
||||||
close((*ppFile)->fd);
|
close((*ppFile)->fd);
|
||||||
(*ppFile)->fd = -1;
|
(*ppFile)->fd = -1;
|
||||||
(*ppFile)->fp = NULL;
|
(*ppFile)->fp = NULL;
|
||||||
|
@ -295,12 +296,14 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
fsync(pFile->fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
nleft -= nwritten;
|
nleft -= nwritten;
|
||||||
tbuf += nwritten;
|
tbuf += nwritten;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fsync(pFile->fd);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue