Skip to content

Commit a4ef032

Browse files
committed
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
1 parent 49407dc commit a4ef032

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/backend/access/transam/xlogarchive.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,12 @@ RestoreArchivedFile(char *path, const char *xlogfname,
220220
else
221221
{
222222
/* stat failed */
223-
if (errno != ENOENT)
224-
ereport(FATAL,
225-
(errcode_for_file_access(),
226-
errmsg("could not stat file \"%s\": %m",
227-
xlogpath)));
223+
int elevel = (errno == ENOENT) ? LOG : FATAL;
224+
225+
ereport(elevel,
226+
(errcode_for_file_access(),
227+
errmsg("could not stat file \"%s\": %m", xlogpath),
228+
errdetail("restore_command returned a zero exit status, but stat() failed.")));
228229
}
229230
}
230231

0 commit comments

Comments
 (0)