106#if defined(HAVE_SYNC_FILE_RANGE)
107#define PG_FLUSH_DATA_WORKS 1
108#elif !defined(WIN32) && defined(MS_ASYNC)
109#define PG_FLUSH_DATA_WORKS 1
110#elif defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
111#define PG_FLUSH_DATA_WORKS 1
129#define NUM_RESERVED_FDS 10
175 int _do_db_save_errno = errno; \
177 errno = _do_db_save_errno; \
184#define VFD_CLOSED (-1)
186#define FileIsValid(file) \
187 ((file) > 0 && (file) < (int) SizeVfdCache && VfdCache[file].fileName != NULL)
189#define FileIsNotOpen(file) (VfdCache[file].fd == VFD_CLOSED)
192#define FD_DELETE_AT_CLOSE (1 << 0)
193#define FD_CLOSE_AT_EOXACT (1 << 1)
194#define FD_TEMP_FILE_LIMIT (1 << 2)
239#ifdef USE_ASSERT_CHECKING
240static bool temporary_files_allowed =
false;
344static void walkdir(
const char *path,
345 void (*
action) (
const char *fname,
bool isdir,
int elevel),
346 bool process_symlinks,
348#ifdef PG_FLUSH_DATA_WORKS
349static void pre_sync_fname(
const char *fname,
bool isdir,
int elevel);
388#if !defined(WIN32) && defined(USE_ASSERT_CHECKING)
411 int desc_flags = fcntl(
fd, F_GETFL);
413 desc_flags &= O_ACCMODE;
416 Assert(desc_flags == O_RDONLY);
418 Assert(desc_flags != O_RDONLY);
424#if defined(HAVE_FSYNC_WRITETHROUGH)
448 if (rc == -1 && errno ==
EINTR)
462#if defined(F_FULLFSYNC)
463 return (fcntl(
fd, F_FULLFSYNC, 0) == -1) ? -1 : 0;
487 if (rc == -1 && errno ==
EINTR)
508 else if (!(errno == ENOENT || errno == ENOTDIR || errno == EACCES))
511 errmsg(
"could not access file \"%s\": %m",
name)));
537#if defined(HAVE_SYNC_FILE_RANGE)
540 static bool not_implemented_by_kernel =
false;
542 if (not_implemented_by_kernel)
556 rc = sync_file_range(
fd, offset, nbytes,
557 SYNC_FILE_RANGE_WRITE);
573 not_implemented_by_kernel =
true;
580 errmsg(
"could not flush dirty data: %m")));
586#if !defined(WIN32) && defined(MS_ASYNC)
589 static int pagesize = 0;
603 if (offset == 0 && nbytes == 0)
605 nbytes = lseek(
fd, 0, SEEK_END);
610 errmsg(
"could not determine dirty data size: %m")));
623 pagesize = sysconf(_SC_PAGESIZE);
627 nbytes = (nbytes / pagesize) * pagesize;
638 if (nbytes <= (
pgoff_t) SSIZE_MAX)
639 p = mmap(NULL, nbytes, PROT_READ, MAP_SHARED,
fd, offset);
647 rc = msync(p, (
size_t) nbytes, MS_ASYNC);
652 errmsg(
"could not flush dirty data: %m")));
656 rc = munmap(p, (
size_t) nbytes);
662 errmsg(
"could not munmap() while flushing data: %m")));
669#if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
681 rc = posix_fadvise(
fd, offset, nbytes, POSIX_FADV_DONTNEED);
688 errmsg(
"could not flush dirty data: %m")));
705 ret = ftruncate(
fd, length);
707 if (ret == -1 && errno ==
EINTR)
737 ret = truncate(path, length);
739 if (ret == -1 && errno ==
EINTR)
800 errmsg(
"could not open file \"%s\": %m", newfile)));
817 errmsg(
"could not fsync file \"%s\": %m", newfile)));
825 errmsg(
"could not close file \"%s\": %m", newfile)));
831 if (rename(oldfile, newfile) < 0)
835 errmsg(
"could not rename file \"%s\" to \"%s\": %m",
871 if (unlink(fname) < 0)
875 errmsg(
"could not remove file \"%s\": %m",
908 (
errcode(ERRCODE_OUT_OF_MEMORY),
909 errmsg(
"out of memory")));
933 Assert(!temporary_files_allowed);
941#ifdef USE_ASSERT_CHECKING
942 temporary_files_allowed =
true;
971 int getrlimit_status;
975 fd = (
int *)
palloc(size *
sizeof(
int));
978 getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
979 if (getrlimit_status != 0)
994 if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1)
1002 if (errno != EMFILE && errno != ENFILE)
1003 elog(
WARNING,
"duplicating stderr file descriptor failed after %d successes: %m", used);
1012 fd[used++] = thisfd;
1014 if (highestfd < thisfd)
1017 if (used >= max_to_probe)
1022 for (
j = 0;
j < used;
j++)
1033 *already_open = highestfd + 1 - used;
1056 &usable_fds, &already_open);
1070 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1071 errmsg(
"insufficient file descriptors available to start server process"),
1072 errdetail(
"System allows %d, server needs at least %d, %d files are already open.",
1077 elog(
DEBUG2,
"max_safe_fds = %d, usable_fds = %d, already_open = %d",
1113#ifdef PG_O_DIRECT_USE_F_NOCACHE
1116 fd = open(fileName, fileFlags, fileMode);
1121#ifdef PG_O_DIRECT_USE_F_NOCACHE
1124 if (fcntl(
fd, F_NOCACHE, 1) < 0)
1126 int save_errno = errno;
1138 if (errno == EMFILE || errno == ENFILE)
1140 int save_errno = errno;
1143 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1144 errmsg(
"out of file descriptors: %m; release and retry")));
1288 "could not close file \"%s\": %m", vfdP->
fileName);
1417 if (newCacheSize < 32)
1424 if (newVfdCache == NULL)
1426 (
errcode(ERRCODE_OUT_OF_MEMORY),
1427 errmsg(
"out of memory")));
1491 if (returnValue != 0)
1494 else if (
VfdCache[0].lruLessRecently != file)
1520 (
errmsg(
"temporary file: path \"%s\", size %lu",
1521 path, (
unsigned long) size)));
1546FileInvalidate(
File file)
1579 fileName, fileFlags, fileMode));
1584 fnamecopy = strdup(fileName);
1585 if (fnamecopy == NULL)
1587 (
errcode(ERRCODE_OUT_OF_MEMORY),
1588 errmsg(
"out of memory")));
1608 int save_errno = errno;
1621 vfdP->
fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
1648 if (errno == EEXIST)
1659 errmsg(
"cannot create temporary directory \"%s\": %m",
1666 errmsg(
"cannot create temporary subdirectory \"%s\": %m",
1677 struct stat statbuf;
1680 if (
stat(dirname, &statbuf) != 0 && errno == ENOENT)
1712 Assert(temporary_files_allowed);
1746 DEFAULTTABLESPACE_OID,
1800 snprintf(tempfilepath,
sizeof(tempfilepath),
"%s/%s%d.%ld",
1808 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1822 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1823 if (file <= 0 && rejectError)
1824 elog(
ERROR,
"could not create temporary file \"%s\": %m",
1849 Assert(temporary_files_allowed);
1860 if (error_on_failure)
1863 errmsg(
"could not create temporary file \"%s\": %m",
1889 Assert(temporary_files_allowed);
1896 if (file <= 0 && errno != ENOENT)
1899 errmsg(
"could not open temporary file \"%s\": %m",
1918 struct stat filestats;
1922 if (
stat(path, &filestats) != 0)
1932 if (stat_errno == ENOENT)
1935 if (unlink(path) < 0)
1937 if (errno != ENOENT)
1940 errmsg(
"could not unlink temporary file \"%s\": %m",
1945 if (stat_errno == 0)
1952 errmsg(
"could not stat file \"%s\": %m", path)));
1985 "could not close file \"%s\": %m", vfdP->
fileName);
2007 struct stat filestats;
2017 vfdP->
fdstate &= ~FD_DELETE_AT_CLOSE;
2033 if (stat_errno == 0)
2071#if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
2081 returnCode = posix_fadvise(
VfdCache[file].
fd, offset, amount,
2082 POSIX_FADV_WILLNEED);
2085 if (returnCode ==
EINTR)
2090#elif defined(__darwin__)
2103 ra.ra_offset = offset;
2104 ra.ra_count = amount;
2106 returnCode = fcntl(
VfdCache[file].
fd, F_RDADVISE, &ra);
2108 if (returnCode != -1)
2166 returnCode =
pg_preadv(vfdP->
fd, iov, iovcnt, offset);
2179 DWORD
error = GetLastError();
2183 case ERROR_NO_SYSTEM_RESOURCES:
2258 for (
int i = 0;
i < iovcnt; ++
i)
2259 past_write += iov[
i].iov_len;
2265 newTotal += past_write - vfdP->
fileSize;
2268 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
2269 errmsg(
"temporary file size exceeds \"temp_file_limit\" (%dkB)",
2276 returnCode =
pg_pwritev(vfdP->
fd, iov, iovcnt, offset);
2279 if (returnCode >= 0)
2295 pgoff_t past_write = offset + returnCode;
2310 DWORD
error = GetLastError();
2314 case ERROR_NO_SYSTEM_RESOURCES:
2380 else if (written != amount)
2406#ifdef HAVE_POSIX_FALLOCATE
2421 returnCode = posix_fallocate(
VfdCache[file].
fd, offset, amount);
2424 if (returnCode == 0)
2426 else if (returnCode ==
EINTR)
2436 if (returnCode != EINVAL && returnCode !=
EOPNOTSUPP)
2440 return FileZero(file, offset, amount, wait_event_info);
2457 return lseek(
VfdCache[file].
fd, 0, SEEK_END);
2478 if (returnCode == 0 &&
VfdCache[file].fileSize > offset)
2569 if (newDescs == NULL)
2571 (
errcode(ERRCODE_OUT_OF_MEMORY),
2572 errmsg(
"out of memory")));
2595 if (newDescs == NULL)
2634 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2635 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2642 if ((file = fopen(
name,
mode)) != NULL)
2653 if (errno == EMFILE || errno == ENFILE)
2655 int save_errno = errno;
2658 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2659 errmsg(
"out of file descriptors: %m; release and retry")));
2687 DO_DB(
elog(
LOG,
"OpenTransientFile: Allocated %d (%s)",
2693 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2694 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2738 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2739 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to execute command \"%s\"",
2749 file = popen(command,
mode);
2764 if (errno == EMFILE || errno == ENFILE)
2767 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2768 errmsg(
"out of file descriptors: %m; release and retry")));
2804 elog(
ERROR,
"AllocateDesc kind not recognized");
2839 elog(
WARNING,
"file passed to FreeFile was not obtained from AllocateFile");
2841 return fclose(file);
2867 elog(
WARNING,
"fd passed to CloseTransientFile was not obtained from OpenTransientFile");
2897 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2898 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open directory \"%s\"",
2905 if ((dir =
opendir(dirname)) != NULL)
2916 if (errno == EMFILE || errno == ENFILE)
2918 int save_errno = errno;
2921 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2922 errmsg(
"out of file descriptors: %m; release and retry")));
2977 errmsg(
"could not open directory \"%s\": %m",
2983 if ((dent =
readdir(dir)) != NULL)
2989 errmsg(
"could not read directory \"%s\": %m",
3025 elog(
WARNING,
"dir passed to FreeDir was not obtained from AllocateDir");
3051 elog(
WARNING,
"file passed to ClosePipeStream was not obtained from OpenPipeStream");
3053 return pclose(file);
3229#ifdef USE_ASSERT_CHECKING
3230 temporary_files_allowed =
false;
3277 "temporary file %s not closed at end-of-transaction",
3289 elog(
WARNING,
"%d temporary files and directories not closed at end-of-transaction",
3339 if (strcmp(spc_de->
d_name,
".") == 0 ||
3340 strcmp(spc_de->
d_name,
"..") == 0)
3343 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s/%s",
3348 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s",
3387 if (temp_dir == NULL && errno == ENOENT && missing_ok)
3392 if (strcmp(temp_de->
d_name,
".") == 0 ||
3393 strcmp(temp_de->
d_name,
"..") == 0)
3396 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3397 tmpdirname, temp_de->
d_name);
3413 if (rmdir(rm_path) < 0)
3416 errmsg(
"could not remove directory \"%s\": %m",
3421 if (unlink(rm_path) < 0)
3424 errmsg(
"could not remove file \"%s\": %m",
3430 (
errmsg(
"unexpected file found in temporary-files directory: \"%s\"",
3454 if (strspn(de->
d_name,
"0123456789") != strlen(de->
d_name))
3457 snprintf(dbspace_path,
sizeof(dbspace_path),
"%s/%s",
3480 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3481 dbspacedirname, de->
d_name);
3483 if (unlink(rm_path) < 0)
3486 errmsg(
"could not remove file \"%s\": %m",
3505 for (pos = 1; isdigit((
unsigned char)
name[pos]); ++pos)
3507 if (pos == 1 ||
name[pos] !=
'_')
3511 for (savepos = ++pos; isdigit((
unsigned char)
name[pos]); ++pos)
3517 if (
name[pos] ==
'_')
3523 pos += forkchar + 1;
3525 if (
name[pos] ==
'.')
3529 for (segchar = 1; isdigit((
unsigned char)
name[pos + segchar]); ++segchar)
3537 if (
name[pos] !=
'\0')
3544do_syncfs(
const char *path)
3556 errmsg(
"could not open file \"%s\": %m", path)));
3562 errmsg(
"could not synchronize file system for file \"%s\": %m", path)));
3592 bool xlog_is_symlink;
3602 xlog_is_symlink =
false;
3607 if (
lstat(
"pg_wal", &st) < 0)
3610 errmsg(
"could not stat file \"%s\": %m",
3613 xlog_is_symlink =
true;
3641 if (strcmp(de->
d_name,
".") == 0 || strcmp(de->
d_name,
"..") == 0)
3649 if (xlog_is_symlink)
3650 do_syncfs(
"pg_wal");
3655#ifdef PG_FLUSH_DATA_WORKS
3665 if (xlog_is_symlink)
3683 if (xlog_is_symlink)
3705 void (*
action) (
const char *fname,
bool isdir,
int elevel),
3706 bool process_symlinks,
3720 if (strcmp(de->
d_name,
".") == 0 ||
3721 strcmp(de->
d_name,
"..") == 0)
3729 (*action) (
subpath,
false, elevel);
3754 (*action) (path,
true, elevel);
3764#ifdef PG_FLUSH_DATA_WORKS
3767pre_sync_fname(
const char *fname,
bool isdir,
int elevel)
3782 if (errno == EACCES)
3786 errmsg(
"could not open file \"%s\": %m", fname)));
3799 errmsg(
"could not close file \"%s\": %m", fname)));
3822 if (rmdir(fname) != 0 && errno != ENOENT)
3825 errmsg(
"could not remove directory \"%s\": %m", fname)));
3868 if (
fd < 0 && isdir && (errno == EISDIR || errno == EACCES))
3870 else if (
fd < 0 && ignore_perm && errno == EACCES)
3876 errmsg(
"could not open file \"%s\": %m", fname)));
3886 if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
3897 errmsg(
"could not fsync file \"%s\": %m", fname)));
3905 errmsg(
"could not close file \"%s\": %m", fname)));
3931 if (strlen(parentpath) == 0)
3994 if (strcmp(*
newval,
"") != 0)
4019 foreach(l, elemlist)
4021 char *item = (
char *)
lfirst(l);
4041#if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
4045 "debug_io_direct",
"XLOG_BLCKSZ");
4049#if BLCKSZ < PG_IO_ALIGN_SIZE
4053 "debug_io_direct",
"BLCKSZ");
4069 *((
int *) *extra) = flags;
4077 int *flags = (
int *) extra;
void pgaio_closing_fd(int fd)
void pgaio_io_start_readv(PgAioHandle *ioh, int fd, int iovcnt, uint64 offset)
void begin_startup_progress_phase(void)
#define MemSet(start, val, len)
int fdatasync(int fildes)
#define OidIsValid(objectId)
struct dirent * readdir(DIR *)
DIR * opendir(const char *)
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
int pg_truncate(const char *path, pgoff_t length)
int max_files_per_process
int FileGetRawDesc(File file)
int MakePGDirectory(const char *directoryName)
int recovery_init_sync_method
static const ResourceOwnerDesc file_resowner_desc
int pg_fsync_no_writethrough(int fd)
FILE * OpenPipeStream(const char *command, const char *mode)
static int numTempTableSpaces
static bool ReleaseLruFile(void)
void FileWriteback(File file, pgoff_t offset, pgoff_t nbytes, uint32 wait_event_info)
#define FD_DELETE_AT_CLOSE
int BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
static int maxAllocatedDescs
static void Delete(File file)
static int FreeDesc(AllocateDesc *desc)
static long tempFileCounter
static char * ResOwnerPrintFile(Datum res)
int durable_rename(const char *oldfile, const char *newfile, int elevel)
char * FilePathName(File file)
static void ResourceOwnerForgetFile(ResourceOwner owner, File file)
static int pg_ftruncate(int fd, pgoff_t length)
int GetTempTablespaces(Oid *tableSpaces, int numSpaces)
static int numAllocatedDescs
File PathNameOpenTemporaryFile(const char *path, int mode)
static void LruDelete(File file)
#define FileIsValid(file)
void assign_debug_io_direct(const char *newval, void *extra)
int FileSync(File file, uint32 wait_event_info)
int FileStartReadV(PgAioHandle *ioh, File file, int iovcnt, pgoff_t offset, uint32 wait_event_info)
int CloseTransientFile(int fd)
int BasicOpenFile(const char *fileName, int fileFlags)
static File AllocateVfd(void)
File PathNameCreateTemporaryFile(const char *path, bool error_on_failure)
void PathNameDeleteTemporaryDir(const char *dirname)
int ClosePipeStream(FILE *file)
void AtEOXact_Files(bool isCommit)
int FileGetRawFlags(File file)
static int nextTempTableSpace
#define FD_CLOSE_AT_EOXACT
int fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel)
static void unlink_if_exists_fname(const char *fname, bool isdir, int elevel)
static void ResOwnerReleaseFile(Datum res)
static void RemovePgTempRelationFiles(const char *tsdirname)
ssize_t FileReadV(File file, const struct iovec *iov, int iovcnt, pgoff_t offset, uint32 wait_event_info)
mode_t FileGetRawMode(File file)
static AllocateDesc * allocatedDescs
struct dirent * ReadDirExtended(DIR *dir, const char *dirname, int elevel)
static void count_usable_fds(int max_to_probe, int *usable_fds, int *already_open)
int FileFallocate(File file, pgoff_t offset, pgoff_t amount, uint32 wait_event_info)
static int FileAccess(File file)
pgoff_t FileSize(File file)
static void FreeVfd(File file)
int pg_fsync_writethrough(int fd)
void FileClose(File file)
void ReleaseExternalFD(void)
#define FD_TEMP_FILE_LIMIT
void RemovePgTempFilesInDir(const char *tmpdirname, bool missing_ok, bool unlink_all)
bool pg_file_exists(const char *name)
void RemovePgTempFiles(void)
#define FileIsNotOpen(file)
bool TempTablespacesAreSet(void)
void fsync_fname(const char *fname, bool isdir)
int data_sync_elevel(int elevel)
File PathNameOpenFile(const char *fileName, int fileFlags)
static void Insert(File file)
Oid GetNextTempTableSpace(void)
File PathNameOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
static void datadir_fsync_fname(const char *fname, bool isdir, int elevel)
static void ReportTemporaryFileUsage(const char *path, pgoff_t size)
static File OpenTemporaryFileInTablespace(Oid tblspcOid, bool rejectError)
void pg_flush_data(int fd, pgoff_t offset, pgoff_t nbytes)
bool AcquireExternalFD(void)
static void RegisterTemporaryFile(File file)
DIR * AllocateDir(const char *dirname)
static Oid * tempTableSpaces
int FileTruncate(File file, pgoff_t offset, uint32 wait_event_info)
static bool reserveAllocatedDesc(void)
void InitFileAccess(void)
static void RemovePgTempRelationFilesInDbspace(const char *dbspacedirname)
File OpenTemporaryFile(bool interXact)
int durable_unlink(const char *fname, int elevel)
static uint64 temporary_files_size
void ReserveExternalFD(void)
int FileZero(File file, pgoff_t offset, pgoff_t amount, uint32 wait_event_info)
struct dirent * ReadDir(DIR *dir, const char *dirname)
bool looks_like_temp_rel_name(const char *name)
bool PathNameDeleteTemporaryFile(const char *path, bool error_on_failure)
void set_max_safe_fds(void)
static void CleanupTempFiles(bool isCommit, bool isProcExit)
static bool have_xact_temporary_files
static int LruInsert(File file)
static int numExternalFDs
static int fsync_parent_path(const char *fname, int elevel)
void PathNameCreateTemporaryDir(const char *basedir, const char *directory)
FILE * AllocateFile(const char *name, const char *mode)
void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
int OpenTransientFile(const char *fileName, int fileFlags)
void InitTemporaryFileAccess(void)
int OpenTransientFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
int FilePrefetch(File file, pgoff_t offset, pgoff_t amount, uint32 wait_event_info)
ssize_t FileWriteV(File file, const struct iovec *iov, int iovcnt, pgoff_t offset, uint32 wait_event_info)
static void ReleaseLruFiles(void)
void SyncDataDirectory(void)
bool check_debug_io_direct(char **newval, void **extra, GucSource source)
static void ResourceOwnerRememberFile(ResourceOwner owner, File file)
static void BeforeShmemExit_Files(int code, Datum arg)
static void walkdir(const char *path, void(*action)(const char *fname, bool isdir, int elevel), bool process_symlinks, int elevel)
void SetTempTablespaces(Oid *tableSpaces, int numSpaces)
void TempTablespacePath(char *path, Oid tablespace)
#define IO_DIRECT_WAL_INIT
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)
#define PG_TEMP_FILES_DIR
#define PG_TEMP_FILE_PREFIX
@ DATA_DIR_SYNC_METHOD_SYNCFS
@ DATA_DIR_SYNC_METHOD_FSYNC
void * guc_malloc(int elevel, size_t size)
#define GUC_check_errdetail
Assert(PointerIsAligned(start, uint64))
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
void list_free(List *list)
Datum subpath(PG_FUNCTION_ARGS)
char * pstrdup(const char *in)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
#define CHECK_FOR_INTERRUPTS()
static PgChecksumMode mode
static ssize_t pg_preadv(int fd, const struct iovec *iov, int iovcnt, pgoff_t offset)
static ssize_t pg_pwritev(int fd, const struct iovec *iov, int iovcnt, pgoff_t offset)
uint64 pg_prng_uint64_range(pg_prng_state *state, uint64 rmin, uint64 rmax)
pg_prng_state pg_global_prng_state
static rewind_source * source
static char buf[DEFAULT_XLOG_SEG_SIZE]
void pgstat_report_tempfile(size_t filesize)
int pg_strcasecmp(const char *s1, const char *s2)
void get_parent_directory(char *path)
size_t strlcpy(char *dst, const char *src, size_t siz)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)
static int fd(const char *x, int i)
char * psprintf(const char *fmt,...)
int forkname_chars(const char *str, ForkNumber *fork)
#define TABLESPACE_VERSION_DIRECTORY
ResourceOwner CurrentResourceOwner
void ResourceOwnerForget(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind)
void ResourceOwnerRemember(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind)
void ResourceOwnerEnlarge(ResourceOwner owner)
@ RESOURCE_RELEASE_AFTER_LOCKS
#define RELEASE_PRIO_FILES
void pg_usleep(long microsec)
#define ereport_startup_progress(msg,...)
SubTransactionId create_subid
union AllocateDesc::@20 desc
bool SplitGUCList(char *rawstring, char separator, List **namelist)
static void pgstat_report_wait_start(uint32 wait_event_info)
static void pgstat_report_wait_end(void)
void _dosmaperr(unsigned long)
SubTransactionId GetCurrentSubTransactionId(void)
@ WAL_SYNC_METHOD_FSYNC_WRITETHROUGH
static const char * directory