Go to the source code of this file.
|
int | RestoreArchivedFile (const char *path, const char *xlogfname, off_t expectedSize, const char *restoreCommand) |
|
◆ RestoreArchivedFile()
int RestoreArchivedFile |
( |
const char * |
path, |
|
|
const char * |
xlogfname, |
|
|
off_t |
expectedSize, |
|
|
const char * |
restoreCommand |
|
) |
| |
Definition at line 39 of file archive.c.
51 if (xlogRestoreCmd == NULL)
52 pg_fatal(
"cannot use restore_command with %%r placeholder");
58 rc = system(xlogRestoreCmd);
59 pfree(xlogRestoreCmd);
67 if (
stat(xlogpath, &stat_buf) == 0)
69 if (expectedSize > 0 && stat_buf.st_size != expectedSize)
70 pg_fatal(
"unexpected file size for \"%s\": %lld instead of %lld",
71 xlogfname, (
long long int) stat_buf.st_size,
72 (
long long int) expectedSize);
75 int xlogfd = open(xlogpath, O_RDONLY |
PG_BINARY, 0);
78 pg_fatal(
"could not open file \"%s\" restored from archive: %m",
87 pg_fatal(
"could not stat file \"%s\": %m",
99 pg_fatal(
"restore_command failed: %s",
106 pg_log_error(
"could not restore file \"%s\" from archive",
char * BuildRestoreCommand(const char *restoreCommand, const char *xlogpath, const char *xlogfname, const char *lastRestartPointFname)
#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)
References BuildRestoreCommand(), MAXPGPATH, pfree(), PG_BINARY, pg_fatal, pg_log_error, snprintf, stat::st_size, stat, wait_result_is_any_signal(), wait_result_to_str(), and XLOGDIR.