40 off_t expectedSize,
const char *restoreCommand)
57 rc = system(xlogRestoreCmd);
58 pfree(xlogRestoreCmd);
66 if (
stat(xlogpath, &stat_buf) == 0)
68 if (expectedSize > 0 && stat_buf.
st_size != expectedSize)
69 pg_fatal(
"unexpected file size for \"%s\": %lld instead of %lld",
70 xlogfname, (
long long int) stat_buf.
st_size,
71 (
long long int) expectedSize);
74 int xlogfd = open(xlogpath, O_RDONLY |
PG_BINARY, 0);
77 pg_fatal(
"could not open file \"%s\" restored from archive: %m",
86 pg_fatal(
"could not stat file \"%s\": %m",
98 pg_fatal(
"\"restore_command\" failed: %s",
105 pg_log_error(
"could not restore file \"%s\" from archive",
char * BuildRestoreCommand(const char *restoreCommand, const char *xlogpath, const char *xlogfname, const char *lastRestartPointFname)
int RestoreArchivedFile(const char *path, const char *xlogfname, off_t expectedSize, const char *restoreCommand)
static void const char fflush(stdout)
#define pg_log_error(...)
void pfree(void *pointer)
char * wait_result_to_str(int exitstatus)
bool wait_result_is_any_signal(int exit_status, bool include_command_not_found)