|
| 1 | +<!-- doc/src/sgml/syncfs.sgml --> |
| 2 | + |
| 3 | +<appendix id="syncfs"> |
| 4 | + <title><function>syncfs()</function> Caveats</title> |
| 5 | + |
| 6 | + <indexterm zone="syncfs"> |
| 7 | + <primary>syncfs</primary> |
| 8 | + </indexterm> |
| 9 | + |
| 10 | + <para> |
| 11 | + On Linux <function>syncfs()</function> may be specified for some |
| 12 | + configuration parameters (e.g., |
| 13 | + <xref linkend="guc-recovery-init-sync-method"/>), server applications (e.g., |
| 14 | + <application>pg_upgrade</application>), and client applications (e.g., |
| 15 | + <application>pg_basebackup</application>) that involve synchronizing many |
| 16 | + files to disk. <function>syncfs()</function> is advantageous in many cases, |
| 17 | + but there are some trade-offs to keep in mind. |
| 18 | + </para> |
| 19 | + |
| 20 | + <para> |
| 21 | + Since <function>syncfs()</function> instructs the operating system to |
| 22 | + synchronize a whole file system, it typically requires many fewer system |
| 23 | + calls than using <function>fsync()</function> to synchronize each file one by |
| 24 | + one. Therefore, using <function>syncfs()</function> may be a lot faster than |
| 25 | + using <function>fsync()</function>. However, it may be slower if a file |
| 26 | + system is shared by other applications that modify a lot of files, since |
| 27 | + those files will also be written to disk. |
| 28 | + </para> |
| 29 | + |
| 30 | + <para> |
| 31 | + Furthermore, on versions of Linux before 5.8, I/O errors encountered while |
| 32 | + writing data to disk may not be reported to the calling program, and relevant |
| 33 | + error messages may appear only in kernel logs. |
| 34 | + </para> |
| 35 | + |
| 36 | +</appendix> |
0 commit comments