41 .
name =
"basic_archive",
50static bool compare_files(
const char *file1,
const char *file2);
144 "basic_archive.archive_directory");
163 (
errmsg(
"archiving \"%s\" via basic_archive", file)));
177 if (
stat(destination, &st) == 0)
182 (
errmsg(
"archive file \"%s\" already exists with identical contents",
192 (
errmsg(
"archive file \"%s\" already exists", destination)));
194 else if (errno != ENOENT)
197 errmsg(
"could not stat file \"%s\": %m", destination)));
208 elog(
ERROR,
"could not generate temporary file name for archiving");
227 (
errmsg(
"archived \"%s\" via basic_archive", file)));
240#define CMP_BUF_SIZE (4096)
251 errmsg(
"could not open file \"%s\": %m", file1)));
257 errmsg(
"could not open file \"%s\": %m", file2)));
271 errmsg(
"could not read file \"%s\": %m", file1)));
272 else if (nbytes == 0)
284 errmsg(
"could not read file \"%s\": %m", file2)));
285 else if (nbytes == 0)
291 if (buf1_len != buf2_len || memcmp(buf1, buf2, buf1_len) != 0)
296 else if (buf1_len == 0)
303 errmsg(
"could not close file \"%s\": %m", file1)));
308 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)
PG_MODULE_MAGIC_EXT(.name="basic_archive",.version=PG_VERSION)
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)