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)
412 int desc_flags = fcntl(
fd, F_GETFL);
419 Assert((desc_flags & (O_RDWR | O_WRONLY)) == 0);
421 Assert((desc_flags & (O_RDWR | O_WRONLY)) != 0);
427#if defined(HAVE_FSYNC_WRITETHROUGH)
451 if (rc == -1 && errno ==
EINTR)
465#if defined(F_FULLFSYNC)
466 return (fcntl(
fd, F_FULLFSYNC, 0) == -1) ? -1 : 0;
490 if (rc == -1 && errno ==
EINTR)
511 else if (!(errno == ENOENT || errno == ENOTDIR || errno == EACCES))
514 errmsg(
"could not access file \"%s\": %m",
name)));
540#if defined(HAVE_SYNC_FILE_RANGE)
543 static bool not_implemented_by_kernel =
false;
545 if (not_implemented_by_kernel)
559 rc = sync_file_range(
fd, offset, nbytes,
560 SYNC_FILE_RANGE_WRITE);
576 not_implemented_by_kernel =
true;
583 errmsg(
"could not flush dirty data: %m")));
589#if !defined(WIN32) && defined(MS_ASYNC)
592 static int pagesize = 0;
606 if (offset == 0 && nbytes == 0)
608 nbytes = lseek(
fd, 0, SEEK_END);
613 errmsg(
"could not determine dirty data size: %m")));
626 pagesize = sysconf(_SC_PAGESIZE);
630 nbytes = (nbytes / pagesize) * pagesize;
641 if (nbytes <= (off_t) SSIZE_MAX)
642 p = mmap(NULL, nbytes, PROT_READ, MAP_SHARED,
fd, offset);
650 rc = msync(p, (
size_t) nbytes, MS_ASYNC);
655 errmsg(
"could not flush dirty data: %m")));
659 rc = munmap(p, (
size_t) nbytes);
665 errmsg(
"could not munmap() while flushing data: %m")));
672#if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
684 rc = posix_fadvise(
fd, offset, nbytes, POSIX_FADV_DONTNEED);
691 errmsg(
"could not flush dirty data: %m")));
708 ret = ftruncate(
fd, length);
710 if (ret == -1 && errno ==
EINTR)
740 ret = truncate(path, length);
742 if (ret == -1 && errno ==
EINTR)
803 errmsg(
"could not open file \"%s\": %m", newfile)));
820 errmsg(
"could not fsync file \"%s\": %m", newfile)));
828 errmsg(
"could not close file \"%s\": %m", newfile)));
834 if (rename(oldfile, newfile) < 0)
838 errmsg(
"could not rename file \"%s\" to \"%s\": %m",
874 if (unlink(fname) < 0)
878 errmsg(
"could not remove file \"%s\": %m",
911 (
errcode(ERRCODE_OUT_OF_MEMORY),
912 errmsg(
"out of memory")));
936 Assert(!temporary_files_allowed);
944#ifdef USE_ASSERT_CHECKING
945 temporary_files_allowed =
true;
974 int getrlimit_status;
978 fd = (
int *)
palloc(size *
sizeof(
int));
981 getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
982 if (getrlimit_status != 0)
997 if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1)
1005 if (errno != EMFILE && errno != ENFILE)
1006 elog(
WARNING,
"duplicating stderr file descriptor failed after %d successes: %m", used);
1015 fd[used++] = thisfd;
1017 if (highestfd < thisfd)
1020 if (used >= max_to_probe)
1025 for (
j = 0;
j < used;
j++)
1036 *already_open = highestfd + 1 - used;
1059 &usable_fds, &already_open);
1073 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1074 errmsg(
"insufficient file descriptors available to start server process"),
1075 errdetail(
"System allows %d, server needs at least %d, %d files are already open.",
1080 elog(
DEBUG2,
"max_safe_fds = %d, usable_fds = %d, already_open = %d",
1116#ifdef PG_O_DIRECT_USE_F_NOCACHE
1133 "PG_O_DIRECT value collides with standard flag");
1136 fd = open(fileName, fileFlags, fileMode);
1141#ifdef PG_O_DIRECT_USE_F_NOCACHE
1144 if (fcntl(
fd, F_NOCACHE, 1) < 0)
1146 int save_errno = errno;
1158 if (errno == EMFILE || errno == ENFILE)
1160 int save_errno = errno;
1163 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1164 errmsg(
"out of file descriptors: %m; release and retry")));
1308 "could not close file \"%s\": %m", vfdP->
fileName);
1437 if (newCacheSize < 32)
1444 if (newVfdCache == NULL)
1446 (
errcode(ERRCODE_OUT_OF_MEMORY),
1447 errmsg(
"out of memory")));
1511 if (returnValue != 0)
1514 else if (
VfdCache[0].lruLessRecently != file)
1540 (
errmsg(
"temporary file: path \"%s\", size %lu",
1541 path, (
unsigned long) size)));
1566FileInvalidate(
File file)
1599 fileName, fileFlags, fileMode));
1604 fnamecopy = strdup(fileName);
1605 if (fnamecopy == NULL)
1607 (
errcode(ERRCODE_OUT_OF_MEMORY),
1608 errmsg(
"out of memory")));
1628 int save_errno = errno;
1641 vfdP->
fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
1668 if (errno == EEXIST)
1679 errmsg(
"cannot create temporary directory \"%s\": %m",
1686 errmsg(
"cannot create temporary subdirectory \"%s\": %m",
1697 struct stat statbuf;
1700 if (
stat(dirname, &statbuf) != 0 && errno == ENOENT)
1732 Assert(temporary_files_allowed);
1766 DEFAULTTABLESPACE_OID,
1820 snprintf(tempfilepath,
sizeof(tempfilepath),
"%s/%s%d.%ld",
1828 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1842 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1843 if (file <= 0 && rejectError)
1844 elog(
ERROR,
"could not create temporary file \"%s\": %m",
1869 Assert(temporary_files_allowed);
1880 if (error_on_failure)
1883 errmsg(
"could not create temporary file \"%s\": %m",
1909 Assert(temporary_files_allowed);
1916 if (file <= 0 && errno != ENOENT)
1919 errmsg(
"could not open temporary file \"%s\": %m",
1938 struct stat filestats;
1942 if (
stat(path, &filestats) != 0)
1952 if (stat_errno == ENOENT)
1955 if (unlink(path) < 0)
1957 if (errno != ENOENT)
1960 errmsg(
"could not unlink temporary file \"%s\": %m",
1965 if (stat_errno == 0)
1972 errmsg(
"could not stat file \"%s\": %m", path)));
2005 "could not close file \"%s\": %m", vfdP->
fileName);
2027 struct stat filestats;
2037 vfdP->
fdstate &= ~FD_DELETE_AT_CLOSE;
2053 if (stat_errno == 0)
2091#if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
2101 returnCode = posix_fadvise(
VfdCache[file].
fd, offset, amount,
2102 POSIX_FADV_WILLNEED);
2105 if (returnCode ==
EINTR)
2110#elif defined(__darwin__)
2123 ra.ra_offset = offset;
2124 ra.ra_count = amount;
2126 returnCode = fcntl(
VfdCache[file].
fd, F_RDADVISE, &ra);
2128 if (returnCode != -1)
2186 returnCode =
pg_preadv(vfdP->
fd, iov, iovcnt, offset);
2199 DWORD
error = GetLastError();
2203 case ERROR_NO_SYSTEM_RESOURCES:
2222 int iovcnt, off_t offset,
2276 off_t past_write = offset;
2278 for (
int i = 0;
i < iovcnt; ++
i)
2279 past_write += iov[
i].iov_len;
2285 newTotal += past_write - vfdP->
fileSize;
2288 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
2289 errmsg(
"temporary file size exceeds \"temp_file_limit\" (%dkB)",
2296 returnCode =
pg_pwritev(vfdP->
fd, iov, iovcnt, offset);
2299 if (returnCode >= 0)
2315 off_t past_write = offset + returnCode;
2330 DWORD
error = GetLastError();
2334 case ERROR_NO_SYSTEM_RESOURCES:
2400 else if (written != amount)
2426#ifdef HAVE_POSIX_FALLOCATE
2441 returnCode = posix_fallocate(
VfdCache[file].
fd, offset, amount);
2444 if (returnCode == 0)
2446 else if (returnCode ==
EINTR)
2456 if (returnCode != EINVAL && returnCode !=
EOPNOTSUPP)
2460 return FileZero(file, offset, amount, wait_event_info);
2477 return lseek(
VfdCache[file].
fd, 0, SEEK_END);
2498 if (returnCode == 0 &&
VfdCache[file].fileSize > offset)
2589 if (newDescs == NULL)
2591 (
errcode(ERRCODE_OUT_OF_MEMORY),
2592 errmsg(
"out of memory")));
2615 if (newDescs == NULL)
2654 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2655 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2662 if ((file = fopen(
name,
mode)) != NULL)
2673 if (errno == EMFILE || errno == ENFILE)
2675 int save_errno = errno;
2678 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2679 errmsg(
"out of file descriptors: %m; release and retry")));
2707 DO_DB(
elog(
LOG,
"OpenTransientFile: Allocated %d (%s)",
2713 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2714 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2758 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2759 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to execute command \"%s\"",
2769 file = popen(command,
mode);
2784 if (errno == EMFILE || errno == ENFILE)
2787 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2788 errmsg(
"out of file descriptors: %m; release and retry")));
2824 elog(
ERROR,
"AllocateDesc kind not recognized");
2859 elog(
WARNING,
"file passed to FreeFile was not obtained from AllocateFile");
2861 return fclose(file);
2887 elog(
WARNING,
"fd passed to CloseTransientFile was not obtained from OpenTransientFile");
2917 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2918 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open directory \"%s\"",
2925 if ((dir =
opendir(dirname)) != NULL)
2936 if (errno == EMFILE || errno == ENFILE)
2938 int save_errno = errno;
2941 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2942 errmsg(
"out of file descriptors: %m; release and retry")));
2997 errmsg(
"could not open directory \"%s\": %m",
3003 if ((dent =
readdir(dir)) != NULL)
3009 errmsg(
"could not read directory \"%s\": %m",
3045 elog(
WARNING,
"dir passed to FreeDir was not obtained from AllocateDir");
3071 elog(
WARNING,
"file passed to ClosePipeStream was not obtained from OpenPipeStream");
3073 return pclose(file);
3248#ifdef USE_ASSERT_CHECKING
3249 temporary_files_allowed =
false;
3296 "temporary file %s not closed at end-of-transaction",
3308 elog(
WARNING,
"%d temporary files and directories not closed at end-of-transaction",
3358 if (strcmp(spc_de->
d_name,
".") == 0 ||
3359 strcmp(spc_de->
d_name,
"..") == 0)
3362 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s/%s",
3367 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s",
3406 if (temp_dir == NULL && errno == ENOENT && missing_ok)
3411 if (strcmp(temp_de->
d_name,
".") == 0 ||
3412 strcmp(temp_de->
d_name,
"..") == 0)
3415 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3416 tmpdirname, temp_de->
d_name);
3432 if (rmdir(rm_path) < 0)
3435 errmsg(
"could not remove directory \"%s\": %m",
3440 if (unlink(rm_path) < 0)
3443 errmsg(
"could not remove file \"%s\": %m",
3449 (
errmsg(
"unexpected file found in temporary-files directory: \"%s\"",
3473 if (strspn(de->
d_name,
"0123456789") != strlen(de->
d_name))
3476 snprintf(dbspace_path,
sizeof(dbspace_path),
"%s/%s",
3499 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3500 dbspacedirname, de->
d_name);
3502 if (unlink(rm_path) < 0)
3505 errmsg(
"could not remove file \"%s\": %m",
3524 for (pos = 1; isdigit((
unsigned char)
name[pos]); ++pos)
3526 if (pos == 1 ||
name[pos] !=
'_')
3530 for (savepos = ++pos; isdigit((
unsigned char)
name[pos]); ++pos)
3536 if (
name[pos] ==
'_')
3542 pos += forkchar + 1;
3544 if (
name[pos] ==
'.')
3548 for (segchar = 1; isdigit((
unsigned char)
name[pos + segchar]); ++segchar)
3556 if (
name[pos] !=
'\0')
3563do_syncfs(
const char *path)
3575 errmsg(
"could not open file \"%s\": %m", path)));
3581 errmsg(
"could not synchronize file system for file \"%s\": %m", path)));
3611 bool xlog_is_symlink;
3621 xlog_is_symlink =
false;
3626 if (
lstat(
"pg_wal", &st) < 0)
3629 errmsg(
"could not stat file \"%s\": %m",
3632 xlog_is_symlink =
true;
3660 if (strcmp(de->
d_name,
".") == 0 || strcmp(de->
d_name,
"..") == 0)
3668 if (xlog_is_symlink)
3669 do_syncfs(
"pg_wal");
3674#ifdef PG_FLUSH_DATA_WORKS
3684 if (xlog_is_symlink)
3702 if (xlog_is_symlink)
3724 void (*
action) (
const char *fname,
bool isdir,
int elevel),
3725 bool process_symlinks,
3739 if (strcmp(de->
d_name,
".") == 0 ||
3740 strcmp(de->
d_name,
"..") == 0)
3748 (*action) (
subpath,
false, elevel);
3773 (*action) (path,
true, elevel);
3783#ifdef PG_FLUSH_DATA_WORKS
3786pre_sync_fname(
const char *fname,
bool isdir,
int elevel)
3801 if (errno == EACCES)
3805 errmsg(
"could not open file \"%s\": %m", fname)));
3818 errmsg(
"could not close file \"%s\": %m", fname)));
3841 if (rmdir(fname) != 0 && errno != ENOENT)
3844 errmsg(
"could not remove directory \"%s\": %m", fname)));
3887 if (
fd < 0 && isdir && (errno == EISDIR || errno == EACCES))
3889 else if (
fd < 0 && ignore_perm && errno == EACCES)
3895 errmsg(
"could not open file \"%s\": %m", fname)));
3905 if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
3916 errmsg(
"could not fsync file \"%s\": %m", fname)));
3924 errmsg(
"could not close file \"%s\": %m", fname)));
3950 if (strlen(parentpath) == 0)
4013 if (strcmp(*
newval,
"") != 0)
4038 foreach(l, elemlist)
4040 char *item = (
char *)
lfirst(l);
4060#if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
4064 "debug_io_direct",
"XLOG_BLCKSZ");
4068#if BLCKSZ < PG_IO_ALIGN_SIZE
4072 "debug_io_direct",
"BLCKSZ");
4088 *((
int *) *extra) = flags;
4096 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)
#define StaticAssertStmt(condition, errmessage)
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,...)
static int pg_ftruncate(int fd, off_t length)
int max_files_per_process
void pg_flush_data(int fd, off_t offset, off_t nbytes)
int FileGetRawDesc(File file)
int MakePGDirectory(const char *directoryName)
int recovery_init_sync_method
static const ResourceOwnerDesc file_resowner_desc
void FileWriteback(File file, off_t offset, off_t nbytes, uint32 wait_event_info)
int pg_fsync_no_writethrough(int fd)
FILE * OpenPipeStream(const char *command, const char *mode)
static int numTempTableSpaces
static bool ReleaseLruFile(void)
#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)
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 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)
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)
static int FileAccess(File file)
static void FreeVfd(File file)
int pg_fsync_writethrough(int fd)
void FileClose(File file)
int FileStartReadV(PgAioHandle *ioh, File file, int iovcnt, off_t offset, uint32 wait_event_info)
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 FileFallocate(File file, off_t offset, off_t amount, uint32 wait_event_info)
int FilePrefetch(File file, off_t offset, off_t amount, uint32 wait_event_info)
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, off_t size)
static File OpenTemporaryFileInTablespace(Oid tblspcOid, bool rejectError)
bool AcquireExternalFD(void)
static void RegisterTemporaryFile(File file)
DIR * AllocateDir(const char *dirname)
static Oid * tempTableSpaces
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)
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)
static void ReleaseLruFiles(void)
ssize_t FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info)
void SyncDataDirectory(void)
int FileZero(File file, off_t offset, off_t amount, uint32 wait_event_info)
off_t FileSize(File file)
ssize_t FileReadV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info)
int FileTruncate(File file, off_t offset, uint32 wait_event_info)
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)
int pg_truncate(const char *path, off_t length)
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, off_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_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
static ssize_t pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_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
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