1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Add pg_file_sync() to adminpack extension.

This function allows us to fsync the specified file or directory.
It's useful, for example, when we want to sync the file that
pg_file_write() writes out or that COPY TO exports the data into,
for durability.

Author: Fujii Masao
Reviewed-By: Julien Rouhaud, Arthur Zakirov, Michael Paquier, Atsushi Torikoshi
Discussion: https://www.postgresql.org/message-id/CAHGQGwGY8uzZ_k8dHRoW1zDcy1Z7=5GQ+So4ZkVy2u=nLsk=hA@mail.gmail.com
This commit is contained in:
Fujii Masao
2020-01-24 20:42:52 +09:00
parent cc25464763
commit d694e0bb79
9 changed files with 89 additions and 4 deletions

View File

@@ -43,6 +43,13 @@
Write, or append to, a text file
</entry>
</row>
<row>
<entry><function>pg_catalog.pg_file_sync(filename text)</function></entry>
<entry><type>void</type></entry>
<entry>
Flush a file or directory to disk
</entry>
</row>
<row>
<entry><function>pg_catalog.pg_file_rename(oldname text, newname text <optional>, archivename text</optional>)</function></entry>
<entry><type>boolean</type></entry>
@@ -79,6 +86,18 @@
Returns the number of bytes written.
</para>
<indexterm>
<primary>pg_file_sync</primary>
</indexterm>
<para>
<function>pg_file_sync</function> fsyncs the specified file or directory
named by <parameter>filename</parameter>. An error is thrown
on failure (e.g., the specified file is not present). Note that
<xref linkend="guc-data-sync-retry"/> has no effect on this function,
and therefore a PANIC-level error will not be raised even on failure to
flush database files.
</para>
<indexterm>
<primary>pg_file_rename</primary>
</indexterm>