47static bool compare_files(
const char *file1,
const char *file2);
141 "basic_archive.archive_directory");
160 (
errmsg(
"archiving \"%s\" via basic_archive", file)));
174 if (
stat(destination, &st) == 0)
179 (
errmsg(
"archive file \"%s\" already exists with identical contents",
189 (
errmsg(
"archive file \"%s\" already exists", destination)));
191 else if (errno != ENOENT)
194 errmsg(
"could not stat file \"%s\": %m", destination)));
205 elog(
ERROR,
"could not generate temporary file name for archiving");
224 (
errmsg(
"archived \"%s\" via basic_archive", file)));
237#define CMP_BUF_SIZE (4096)
248 errmsg(
"could not open file \"%s\": %m", file1)));
254 errmsg(
"could not open file \"%s\": %m", file2)));
268 errmsg(
"could not read file \"%s\": %m", file1)));
269 else if (nbytes == 0)
281 errmsg(
"could not read file \"%s\": %m", file2)));
282 else if (nbytes == 0)
288 if (buf1_len != buf2_len || memcmp(buf1, buf2, buf1_len) != 0)
293 else if (buf1_len == 0)
300 errmsg(
"could not close file \"%s\": %m", file1)));
305 errmsg(
"could not close file \"%s\": %m", file2)));
#define arch_module_check_errdetail
static char * archive_directory
static bool basic_archive_file(ArchiveModuleState *state, const char *file, const char *path)
static const ArchiveModuleCallbacks basic_archive_callbacks
static bool compare_files(const char *file1, const char *file2)
static bool basic_archive_configured(ArchiveModuleState *state)
static bool check_archive_directory(char **newval, void **extra, GucSource source)
const ArchiveModuleCallbacks * _PG_archive_module_init(void)
void copy_file(const char *fromfile, const char *tofile)
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)
int CloseTransientFile(int fd)
void fsync_fname(const char *fname, bool isdir)
int OpenTransientFile(const char *fileName, int fileFlags)
void DefineCustomStringVariable(const char *name, const char *short_desc, const char *long_desc, char **valueAddr, const char *bootValue, GucContext context, int flags, GucStringCheckHook check_hook, GucStringAssignHook assign_hook, GucShowHook show_hook)
void MarkGUCPrefixReserved(const char *className)
#define GUC_check_errdetail
static bool pg_add_u64_overflow(uint64 a, uint64 b, uint64 *result)
static bool pg_mul_u64_overflow(uint64 a, uint64 b, uint64 *result)
static rewind_source * source
ArchiveStartupCB startup_cb
static const unsigned __int64 epoch
int gettimeofday(struct timeval *tp, void *tzp)