37#if defined(HAVE_SYNC_FILE_RANGE)
38#define PG_FLUSH_DATA_WORKS 1
39#elif defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
40#define PG_FLUSH_DATA_WORKS 1
46#define MINIMUM_VERSION_FOR_PG_WAL 100000
48static void walkdir(
const char *path,
49 int (*action) (
const char *fname,
bool isdir),
75 pg_log_error(
"could not synchronize file system for file \"%s\": %m", path);
133 pg_log_error(
"this build does not support sync method \"%s\"",
199#ifdef PG_FLUSH_DATA_WORKS
243 pg_log_error(
"this build does not support sync method \"%s\"",
262#ifdef PG_FLUSH_DATA_WORKS
291 int (*action) (
const char *fname,
bool isdir),
304 pg_log_error(
"could not open directory \"%s\": %m", path);
338 pg_log_error(
"could not read directory \"%s\": %m", path);
348 (*action) (path,
true);
361#ifdef PG_FLUSH_DATA_WORKS
379#if defined(HAVE_SYNC_FILE_RANGE)
381#elif defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
384#error PG_FLUSH_DATA_WORKS should not have been defined
423 fd =
open(fname, flags, 0);
520 pg_log_error(
"could not rename file \"%s\" to \"%s\": %m",
560#if defined(DT_REG) && defined(DT_DIR) && defined(DT_LNK)
592 errmsg(
"could not stat file \"%s\": %m", path)));
679#ifdef SIMULATE_SHORT_WRITE
#define unconstify(underlying_type, expr)
#define Assert(condition)
struct dirent * readdir(DIR *)
DIR * opendir(const char *)
int errcode_for_file_access(void)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
int durable_rename(const char *oldfile, const char *newfile, int elevel)
void fsync_fname(const char *fname, bool isdir)
static int fsync_parent_path(const char *fname, int elevel)
static void walkdir(const char *path, void(*action)(const char *fname, bool isdir, int elevel), bool process_symlinks, int elevel)
int compute_remaining_iovec(struct iovec *destination, const struct iovec *source, int iovcnt, size_t transferred)
ssize_t pg_pwritev_with_retry(int fd, const struct iovec *iov, int iovcnt, pgoff_t offset)
ssize_t pg_pwrite_zeros(int fd, size_t size, pgoff_t offset)
PGFileType get_dirent_type(const char *path, const struct dirent *de, bool look_through_symlinks, int elevel)
@ DATA_DIR_SYNC_METHOD_SYNCFS
@ DATA_DIR_SYNC_METHOD_FSYNC
static bool sync_data_files
static DataDirSyncMethod sync_method
void pg_log_generic(enum pg_log_level level, enum pg_log_part part, const char *pg_restrict fmt,...)
#define pg_log_error(...)
Datum subpath(PG_FUNCTION_ARGS)
void pfree(void *pointer)
#define MINIMUM_VERSION_FOR_PG_WAL
static ssize_t pg_pwritev(int fd, const struct iovec *iov, int iovcnt, pgoff_t offset)
static rewind_source * source
void get_parent_directory(char *path)
size_t strlcpy(char *dst, const char *src, size_t siz)
static int fd(const char *x, int i)
char * psprintf(const char *fmt,...)