Commit a4ef0329 authored by Fujii Masao's avatar Fujii Masao

Emit log when restore_command succeeds but archived file faills to be restored.

Previously, when restore_command claimed to succeed but failed to restore
the file with the right name, for example, due to mis-configuration of
restore_command, no log message was reported. Then the recovery failed
later with an error message not directly related to the issue.

This commit changes the recovery so that a log message is emitted in
this error case. This would enable us to investigate what happened in
this case more easily.

Author: Jeff Janes, Fujii Masao
Reviewed-by: Pavel Borisov, Kyotaro Horiguchi
Discussion: https://postgr.es/m/CAMkU=1xkFs3Omp4JR4wMYWdam_KLuj6LXnTYfU8u3T0h=PLLMQ@mail.gmail.com
parent 49407dc3
...@@ -220,11 +220,12 @@ RestoreArchivedFile(char *path, const char *xlogfname, ...@@ -220,11 +220,12 @@ RestoreArchivedFile(char *path, const char *xlogfname,
else else
{ {
/* stat failed */ /* stat failed */
if (errno != ENOENT) int elevel = (errno == ENOENT) ? LOG : FATAL;
ereport(FATAL,
(errcode_for_file_access(), ereport(elevel,
errmsg("could not stat file \"%s\": %m", (errcode_for_file_access(),
xlogpath))); errmsg("could not stat file \"%s\": %m", xlogpath),
errdetail("restore_command returned a zero exit status, but stat() failed.")));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment