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 <= (off_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
1130 "PG_O_DIRECT value collides with standard flag");
1133 fd = open(fileName, fileFlags, fileMode);
1138#ifdef PG_O_DIRECT_USE_F_NOCACHE
1141 if (fcntl(
fd, F_NOCACHE, 1) < 0)
1143 int save_errno = errno;
1155 if (errno == EMFILE || errno == ENFILE)
1157 int save_errno = errno;
1160 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1161 errmsg(
"out of file descriptors: %m; release and retry")));
1305 "could not close file \"%s\": %m", vfdP->
fileName);
1434 if (newCacheSize < 32)
1441 if (newVfdCache == NULL)
1443 (
errcode(ERRCODE_OUT_OF_MEMORY),
1444 errmsg(
"out of memory")));
1508 if (returnValue != 0)
1511 else if (
VfdCache[0].lruLessRecently != file)
1537 (
errmsg(
"temporary file: path \"%s\", size %lu",
1538 path, (
unsigned long) size)));
1563FileInvalidate(
File file)
1596 fileName, fileFlags, fileMode));
1601 fnamecopy = strdup(fileName);
1602 if (fnamecopy == NULL)
1604 (
errcode(ERRCODE_OUT_OF_MEMORY),
1605 errmsg(
"out of memory")));
1625 int save_errno = errno;
1638 vfdP->
fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
1665 if (errno == EEXIST)
1676 errmsg(
"cannot create temporary directory \"%s\": %m",
1683 errmsg(
"cannot create temporary subdirectory \"%s\": %m",
1694 struct stat statbuf;
1697 if (
stat(dirname, &statbuf) != 0 && errno == ENOENT)
1729 Assert(temporary_files_allowed);
1763 DEFAULTTABLESPACE_OID,
1817 snprintf(tempfilepath,
sizeof(tempfilepath),
"%s/%s%d.%ld",
1825 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1839 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1840 if (file <= 0 && rejectError)
1841 elog(
ERROR,
"could not create temporary file \"%s\": %m",
1866 Assert(temporary_files_allowed);
1877 if (error_on_failure)
1880 errmsg(
"could not create temporary file \"%s\": %m",
1906 Assert(temporary_files_allowed);
1913 if (file <= 0 && errno != ENOENT)
1916 errmsg(
"could not open temporary file \"%s\": %m",
1935 struct stat filestats;
1939 if (
stat(path, &filestats) != 0)
1949 if (stat_errno == ENOENT)
1952 if (unlink(path) < 0)
1954 if (errno != ENOENT)
1957 errmsg(
"could not unlink temporary file \"%s\": %m",
1962 if (stat_errno == 0)
1969 errmsg(
"could not stat file \"%s\": %m", path)));
2002 "could not close file \"%s\": %m", vfdP->
fileName);
2024 struct stat filestats;
2034 vfdP->
fdstate &= ~FD_DELETE_AT_CLOSE;
2050 if (stat_errno == 0)
2088#if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
2098 returnCode = posix_fadvise(
VfdCache[file].
fd, offset, amount,
2099 POSIX_FADV_WILLNEED);
2102 if (returnCode ==
EINTR)
2107#elif defined(__darwin__)
2120 ra.ra_offset = offset;
2121 ra.ra_count = amount;
2123 returnCode = fcntl(
VfdCache[file].
fd, F_RDADVISE, &ra);
2125 if (returnCode != -1)
2183 returnCode =
pg_preadv(vfdP->
fd, iov, iovcnt, offset);
2196 DWORD
error = GetLastError();
2200 case ERROR_NO_SYSTEM_RESOURCES:
2219 int iovcnt, off_t offset,
2273 off_t past_write = offset;
2275 for (
int i = 0;
i < iovcnt; ++
i)
2276 past_write += iov[
i].iov_len;
2282 newTotal += past_write - vfdP->
fileSize;
2285 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
2286 errmsg(
"temporary file size exceeds \"temp_file_limit\" (%dkB)",
2293 returnCode =
pg_pwritev(vfdP->
fd, iov, iovcnt, offset);
2296 if (returnCode >= 0)
2312 off_t past_write = offset + returnCode;
2327 DWORD
error = GetLastError();
2331 case ERROR_NO_SYSTEM_RESOURCES:
2397 else if (written != amount)
2423#ifdef HAVE_POSIX_FALLOCATE
2438 returnCode = posix_fallocate(
VfdCache[file].
fd, offset, amount);
2441 if (returnCode == 0)
2443 else if (returnCode ==
EINTR)
2453 if (returnCode != EINVAL && returnCode !=
EOPNOTSUPP)
2457 return FileZero(file, offset, amount, wait_event_info);
2474 return lseek(
VfdCache[file].
fd, 0, SEEK_END);
2495 if (returnCode == 0 &&
VfdCache[file].fileSize > offset)
2586 if (newDescs == NULL)
2588 (
errcode(ERRCODE_OUT_OF_MEMORY),
2589 errmsg(
"out of memory")));
2612 if (newDescs == NULL)
2651 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2652 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2659 if ((file = fopen(
name,
mode)) != NULL)
2670 if (errno == EMFILE || errno == ENFILE)
2672 int save_errno = errno;
2675 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2676 errmsg(
"out of file descriptors: %m; release and retry")));
2704 DO_DB(
elog(
LOG,
"OpenTransientFile: Allocated %d (%s)",
2710 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2711 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2755 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2756 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to execute command \"%s\"",
2766 file = popen(command,
mode);
2781 if (errno == EMFILE || errno == ENFILE)
2784 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2785 errmsg(
"out of file descriptors: %m; release and retry")));
2821 elog(
ERROR,
"AllocateDesc kind not recognized");
2856 elog(
WARNING,
"file passed to FreeFile was not obtained from AllocateFile");
2858 return fclose(file);
2884 elog(
WARNING,
"fd passed to CloseTransientFile was not obtained from OpenTransientFile");
2914 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2915 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open directory \"%s\"",
2922 if ((dir =
opendir(dirname)) != NULL)
2933 if (errno == EMFILE || errno == ENFILE)
2935 int save_errno = errno;
2938 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2939 errmsg(
"out of file descriptors: %m; release and retry")));
2994 errmsg(
"could not open directory \"%s\": %m",
3000 if ((dent =
readdir(dir)) != NULL)
3006 errmsg(
"could not read directory \"%s\": %m",
3042 elog(
WARNING,
"dir passed to FreeDir was not obtained from AllocateDir");
3068 elog(
WARNING,
"file passed to ClosePipeStream was not obtained from OpenPipeStream");
3070 return pclose(file);
3245#ifdef USE_ASSERT_CHECKING
3246 temporary_files_allowed =
false;
3293 "temporary file %s not closed at end-of-transaction",
3305 elog(
WARNING,
"%d temporary files and directories not closed at end-of-transaction",
3355 if (strcmp(spc_de->
d_name,
".") == 0 ||
3356 strcmp(spc_de->
d_name,
"..") == 0)
3359 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s/%s",
3364 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s",
3403 if (temp_dir == NULL && errno == ENOENT && missing_ok)
3408 if (strcmp(temp_de->
d_name,
".") == 0 ||
3409 strcmp(temp_de->
d_name,
"..") == 0)
3412 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3413 tmpdirname, temp_de->
d_name);
3429 if (rmdir(rm_path) < 0)
3432 errmsg(
"could not remove directory \"%s\": %m",
3437 if (unlink(rm_path) < 0)
3440 errmsg(
"could not remove file \"%s\": %m",
3446 (
errmsg(
"unexpected file found in temporary-files directory: \"%s\"",
3470 if (strspn(de->
d_name,
"0123456789") != strlen(de->
d_name))
3473 snprintf(dbspace_path,
sizeof(dbspace_path),
"%s/%s",
3496 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3497 dbspacedirname, de->
d_name);
3499 if (unlink(rm_path) < 0)
3502 errmsg(
"could not remove file \"%s\": %m",
3521 for (pos = 1; isdigit((
unsigned char)
name[pos]); ++pos)
3523 if (pos == 1 ||
name[pos] !=
'_')
3527 for (savepos = ++pos; isdigit((
unsigned char)
name[pos]); ++pos)
3533 if (
name[pos] ==
'_')
3539 pos += forkchar + 1;
3541 if (
name[pos] ==
'.')
3545 for (segchar = 1; isdigit((
unsigned char)
name[pos + segchar]); ++segchar)
3553 if (
name[pos] !=
'\0')
3560do_syncfs(
const char *path)
3572 errmsg(
"could not open file \"%s\": %m", path)));
3578 errmsg(
"could not synchronize file system for file \"%s\": %m", path)));
3608 bool xlog_is_symlink;
3618 xlog_is_symlink =
false;
3623 if (
lstat(
"pg_wal", &st) < 0)
3626 errmsg(
"could not stat file \"%s\": %m",
3629 xlog_is_symlink =
true;
3657 if (strcmp(de->
d_name,
".") == 0 || strcmp(de->
d_name,
"..") == 0)
3665 if (xlog_is_symlink)
3666 do_syncfs(
"pg_wal");
3671#ifdef PG_FLUSH_DATA_WORKS
3681 if (xlog_is_symlink)
3699 if (xlog_is_symlink)
3721 void (*
action) (
const char *fname,
bool isdir,
int elevel),
3722 bool process_symlinks,
3736 if (strcmp(de->
d_name,
".") == 0 ||
3737 strcmp(de->
d_name,
"..") == 0)
3745 (*action) (
subpath,
false, elevel);
3770 (*action) (path,
true, elevel);
3780#ifdef PG_FLUSH_DATA_WORKS
3783pre_sync_fname(
const char *fname,
bool isdir,
int elevel)
3798 if (errno == EACCES)
3802 errmsg(
"could not open file \"%s\": %m", fname)));
3815 errmsg(
"could not close file \"%s\": %m", fname)));
3838 if (rmdir(fname) != 0 && errno != ENOENT)
3841 errmsg(
"could not remove directory \"%s\": %m", fname)));
3884 if (
fd < 0 && isdir && (errno == EISDIR || errno == EACCES))
3886 else if (
fd < 0 && ignore_perm && errno == EACCES)
3892 errmsg(
"could not open file \"%s\": %m", fname)));
3902 if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
3913 errmsg(
"could not fsync file \"%s\": %m", fname)));
3921 errmsg(
"could not close file \"%s\": %m", fname)));
3947 if (strlen(parentpath) == 0)
4010 if (strcmp(*
newval,
"") != 0)
4035 foreach(l, elemlist)
4037 char *item = (
char *)
lfirst(l);
4057#if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
4061 "debug_io_direct",
"XLOG_BLCKSZ");
4065#if BLCKSZ < PG_IO_ALIGN_SIZE
4069 "debug_io_direct",
"BLCKSZ");
4085 *((
int *) *extra) = flags;
4093 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