80 #include <sys/types.h>
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
138 #define FD_MINFREE 48
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
240 static bool temporary_files_allowed =
false;
344 static 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
349 static 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")));
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;
972 #ifdef HAVE_GETRLIMIT
974 int getrlimit_status;
980 #ifdef HAVE_GETRLIMIT
981 getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
982 if (getrlimit_status != 0)
991 #ifdef HAVE_GETRLIMIT
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;
1058 &usable_fds, &already_open);
1072 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1073 errmsg(
"insufficient file descriptors available to start server process"),
1074 errdetail(
"System allows %d, server needs at least %d.",
1078 elog(
DEBUG2,
"max_safe_fds = %d, usable_fds = %d, already_open = %d",
1114 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1131 "PG_O_DIRECT value collides with standard flag");
1134 fd = open(fileName, fileFlags, fileMode);
1139 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1142 if (fcntl(
fd, F_NOCACHE, 1) < 0)
1144 int save_errno = errno;
1156 if (errno == EMFILE || errno == ENFILE)
1158 int save_errno = errno;
1161 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1162 errmsg(
"out of file descriptors: %m; release and retry")));
1246 #if defined(FDDEBUG)
1304 "could not close file \"%s\": %m", vfdP->
fileName);
1433 if (newCacheSize < 32)
1440 if (newVfdCache == NULL)
1442 (
errcode(ERRCODE_OUT_OF_MEMORY),
1443 errmsg(
"out of memory")));
1507 if (returnValue != 0)
1510 else if (
VfdCache[0].lruLessRecently != file)
1536 (
errmsg(
"temporary file: path \"%s\", size %lu",
1537 path, (
unsigned long)
size)));
1562 FileInvalidate(
File file)
1595 fileName, fileFlags, fileMode));
1600 fnamecopy = strdup(fileName);
1601 if (fnamecopy == NULL)
1603 (
errcode(ERRCODE_OUT_OF_MEMORY),
1604 errmsg(
"out of memory")));
1624 int save_errno = errno;
1637 vfdP->
fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
1664 if (errno == EEXIST)
1675 errmsg(
"cannot create temporary directory \"%s\": %m",
1682 errmsg(
"cannot create temporary subdirectory \"%s\": %m",
1693 struct stat statbuf;
1696 if (
stat(dirname, &statbuf) != 0 && errno == ENOENT)
1728 Assert(temporary_files_allowed);
1762 DEFAULTTABLESPACE_OID,
1816 snprintf(tempfilepath,
sizeof(tempfilepath),
"%s/%s%d.%ld",
1824 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1838 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1839 if (file <= 0 && rejectError)
1840 elog(
ERROR,
"could not create temporary file \"%s\": %m",
1865 Assert(temporary_files_allowed);
1876 if (error_on_failure)
1879 errmsg(
"could not create temporary file \"%s\": %m",
1905 Assert(temporary_files_allowed);
1912 if (file <= 0 && errno != ENOENT)
1915 errmsg(
"could not open temporary file \"%s\": %m",
1934 struct stat filestats;
1938 if (
stat(path, &filestats) != 0)
1948 if (stat_errno == ENOENT)
1951 if (unlink(path) < 0)
1953 if (errno != ENOENT)
1956 errmsg(
"could not unlink temporary file \"%s\": %m",
1961 if (stat_errno == 0)
1968 errmsg(
"could not stat file \"%s\": %m", path)));
1999 "could not close file \"%s\": %m", vfdP->
fileName);
2021 struct stat filestats;
2047 if (stat_errno == 0)
2080 #if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
2087 (int64) offset, (int64) amount));
2095 returnCode = posix_fadvise(
VfdCache[file].
fd, offset, amount,
2096 POSIX_FADV_WILLNEED);
2099 if (returnCode ==
EINTR)
2118 (int64) offset, (int64) nbytes));
2157 returnCode =
pg_preadv(vfdP->
fd, iov, iovcnt, offset);
2170 DWORD
error = GetLastError();
2174 case ERROR_NO_SYSTEM_RESOURCES:
2221 off_t past_write = offset;
2223 for (
int i = 0;
i < iovcnt; ++
i)
2224 past_write += iov[
i].iov_len;
2230 newTotal += past_write - vfdP->
fileSize;
2233 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
2234 errmsg(
"temporary file size exceeds temp_file_limit (%dkB)",
2241 returnCode =
pg_pwritev(vfdP->
fd, iov, iovcnt, offset);
2244 if (returnCode >= 0)
2260 off_t past_write = offset + returnCode;
2275 DWORD
error = GetLastError();
2279 case ERROR_NO_SYSTEM_RESOURCES:
2333 (int64) offset, (int64) amount));
2345 else if (written != amount)
2371 #ifdef HAVE_POSIX_FALLOCATE
2378 (int64) offset, (int64) amount));
2386 returnCode = posix_fallocate(
VfdCache[file].
fd, offset, amount);
2389 if (returnCode == 0)
2391 else if (returnCode ==
EINTR)
2401 if (returnCode != EINVAL && returnCode !=
EOPNOTSUPP)
2405 return FileZero(file, offset, amount, wait_event_info);
2422 return lseek(
VfdCache[file].
fd, 0, SEEK_END);
2443 if (returnCode == 0 &&
VfdCache[file].fileSize > offset)
2528 if (newDescs == NULL)
2530 (
errcode(ERRCODE_OUT_OF_MEMORY),
2531 errmsg(
"out of memory")));
2554 if (newDescs == NULL)
2593 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2594 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2601 if ((file = fopen(
name,
mode)) != NULL)
2612 if (errno == EMFILE || errno == ENFILE)
2614 int save_errno = errno;
2617 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2618 errmsg(
"out of file descriptors: %m; release and retry")));
2646 DO_DB(
elog(
LOG,
"OpenTransientFile: Allocated %d (%s)",
2652 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2653 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2697 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2698 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to execute command \"%s\"",
2708 file = popen(command,
mode);
2723 if (errno == EMFILE || errno == ENFILE)
2726 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2727 errmsg(
"out of file descriptors: %m; release and retry")));
2762 elog(
ERROR,
"AllocateDesc kind not recognized");
2797 elog(
WARNING,
"file passed to FreeFile was not obtained from AllocateFile");
2799 return fclose(file);
2825 elog(
WARNING,
"fd passed to CloseTransientFile was not obtained from OpenTransientFile");
2853 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2854 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open directory \"%s\"",
2861 if ((dir =
opendir(dirname)) != NULL)
2872 if (errno == EMFILE || errno == ENFILE)
2874 int save_errno = errno;
2877 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2878 errmsg(
"out of file descriptors: %m; release and retry")));
2933 errmsg(
"could not open directory \"%s\": %m",
2939 if ((dent =
readdir(dir)) != NULL)
2945 errmsg(
"could not read directory \"%s\": %m",
2981 elog(
WARNING,
"dir passed to FreeDir was not obtained from AllocateDir");
3007 elog(
WARNING,
"file passed to ClosePipeStream was not obtained from OpenPipeStream");
3009 return pclose(file);
3184 #ifdef USE_ASSERT_CHECKING
3185 temporary_files_allowed =
false;
3232 "temporary file %s not closed at end-of-transaction",
3244 elog(
WARNING,
"%d temporary files and directories not closed at end-of-transaction",
3294 if (strcmp(spc_de->
d_name,
".") == 0 ||
3295 strcmp(spc_de->
d_name,
"..") == 0)
3298 snprintf(temp_path,
sizeof(temp_path),
"pg_tblspc/%s/%s/%s",
3302 snprintf(temp_path,
sizeof(temp_path),
"pg_tblspc/%s/%s",
3341 if (temp_dir == NULL && errno == ENOENT && missing_ok)
3346 if (strcmp(temp_de->
d_name,
".") == 0 ||
3347 strcmp(temp_de->
d_name,
"..") == 0)
3350 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3351 tmpdirname, temp_de->
d_name);
3367 if (rmdir(rm_path) < 0)
3370 errmsg(
"could not remove directory \"%s\": %m",
3375 if (unlink(rm_path) < 0)
3378 errmsg(
"could not remove file \"%s\": %m",
3384 (
errmsg(
"unexpected file found in temporary-files directory: \"%s\"",
3408 if (strspn(de->
d_name,
"0123456789") != strlen(de->
d_name))
3411 snprintf(dbspace_path,
sizeof(dbspace_path),
"%s/%s",
3434 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3435 dbspacedirname, de->
d_name);
3437 if (unlink(rm_path) < 0)
3440 errmsg(
"could not remove file \"%s\": %m",
3459 for (pos = 1; isdigit((
unsigned char)
name[pos]); ++pos)
3461 if (pos == 1 ||
name[pos] !=
'_')
3465 for (savepos = ++pos; isdigit((
unsigned char)
name[pos]); ++pos)
3471 if (
name[pos] ==
'_')
3477 pos += forkchar + 1;
3479 if (
name[pos] ==
'.')
3483 for (segchar = 1; isdigit((
unsigned char)
name[pos + segchar]); ++segchar)
3491 if (
name[pos] !=
'\0')
3498 do_syncfs(
const char *path)
3510 errmsg(
"could not open file \"%s\": %m", path)));
3516 errmsg(
"could not synchronize file system for file \"%s\": %m", path)));
3546 bool xlog_is_symlink;
3556 xlog_is_symlink =
false;
3561 if (
lstat(
"pg_wal", &st) < 0)
3564 errmsg(
"could not stat file \"%s\": %m",
3567 xlog_is_symlink =
true;
3595 if (strcmp(de->
d_name,
".") == 0 || strcmp(de->
d_name,
"..") == 0)
3603 if (xlog_is_symlink)
3604 do_syncfs(
"pg_wal");
3609 #ifdef PG_FLUSH_DATA_WORKS
3619 if (xlog_is_symlink)
3637 if (xlog_is_symlink)
3659 void (*
action) (
const char *fname,
bool isdir,
int elevel),
3660 bool process_symlinks,
3674 if (strcmp(de->
d_name,
".") == 0 ||
3675 strcmp(de->
d_name,
"..") == 0)
3683 (*action) (
subpath,
false, elevel);
3708 (*action) (path,
true, elevel);
3718 #ifdef PG_FLUSH_DATA_WORKS
3721 pre_sync_fname(
const char *fname,
bool isdir,
int elevel)
3736 if (errno == EACCES)
3740 errmsg(
"could not open file \"%s\": %m", fname)));
3753 errmsg(
"could not close file \"%s\": %m", fname)));
3776 if (rmdir(fname) != 0 && errno != ENOENT)
3779 errmsg(
"could not remove directory \"%s\": %m", fname)));
3822 if (
fd < 0 && isdir && (errno == EISDIR || errno == EACCES))
3824 else if (
fd < 0 && ignore_perm && errno == EACCES)
3830 errmsg(
"could not open file \"%s\": %m", fname)));
3840 if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
3851 errmsg(
"could not fsync file \"%s\": %m", fname)));
3859 errmsg(
"could not close file \"%s\": %m", fname)));
3885 if (strlen(parentpath) == 0)
3947 #if PG_O_DIRECT == 0
3948 if (strcmp(*
newval,
"") != 0)
3972 foreach(l, elemlist)
3974 char *item = (
char *)
lfirst(l);
3994 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
3997 GUC_check_errdetail(
"debug_io_direct is not supported for WAL because XLOG_BLCKSZ is too small");
4001 #if BLCKSZ < PG_IO_ALIGN_SIZE
4004 GUC_check_errdetail(
"debug_io_direct is not supported for data because BLCKSZ is too small");
4018 *((
int *) *extra) = flags;
4026 int *flags = (
int *) extra;
void begin_startup_progress_phase(void)
#define Assert(condition)
#define MemSet(start, val, len)
#define StaticAssertStmt(condition, errmessage)
int fdatasync(int fildes)
#define OidIsValid(objectId)
static void PGresult * res
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,...)
struct dirent * ReadDir(DIR *dir, const char *dirname)
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)
static int numTempTableSpaces
static bool ReleaseLruFile(void)
FILE * AllocateFile(const char *name, const char *mode)
#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)
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
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)
FILE * OpenPipeStream(const char *command, const char *mode)
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)
struct dirent * ReadDirExtended(DIR *dir, const char *dirname, int elevel)
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)
char * FilePathName(File file)
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)
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)
DIR * AllocateDir(const char *dirname)
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
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
static void const char fflush(stdout)
void list_free(List *list)
Datum subpath(PG_FUNCTION_ARGS)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * repalloc(void *pointer, Size size)
#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)
pqsigfunc pqsignal(int signo, pqsigfunc func)
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)
static pg_noinline void Size size
#define ereport_startup_progress(msg,...)
SubTransactionId create_subid
union AllocateDesc::@22 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