mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +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:
@ -319,7 +319,6 @@ static void pre_sync_fname(const char *fname, bool isdir, int elevel);
|
||||
static void datadir_fsync_fname(const char *fname, bool isdir, int elevel);
|
||||
static void unlink_if_exists_fname(const char *fname, bool isdir, int elevel);
|
||||
|
||||
static int fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel);
|
||||
static int fsync_parent_path(const char *fname, int elevel);
|
||||
|
||||
|
||||
@ -3376,7 +3375,7 @@ unlink_if_exists_fname(const char *fname, bool isdir, int elevel)
|
||||
*
|
||||
* Returns 0 if the operation succeeded, -1 otherwise.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel)
|
||||
{
|
||||
int fd;
|
||||
|
@ -145,6 +145,7 @@ extern int pg_fsync_writethrough(int fd);
|
||||
extern int pg_fdatasync(int fd);
|
||||
extern void pg_flush_data(int fd, off_t offset, off_t amount);
|
||||
extern void fsync_fname(const char *fname, bool isdir);
|
||||
extern int fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel);
|
||||
extern int durable_rename(const char *oldfile, const char *newfile, int loglevel);
|
||||
extern int durable_unlink(const char *fname, int loglevel);
|
||||
extern int durable_link_or_rename(const char *oldfile, const char *newfile, int loglevel);
|
||||
|
Reference in New Issue
Block a user