diff options
author | Fujii Masao <fujii@postgresql.org> | 2020-11-20 15:42:47 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2020-11-20 15:42:47 +0900 |
commit | a4ef0329c27156dca81714854599e7d82becb17f (patch) | |
tree | 4832b70893f7a1993e5288d29f831259b2d4ce02 | |
parent | 49407dc32a2931550e4ff1dea314b6a25afdfc35 (diff) | |
download | postgresql-a4ef0329c27156dca81714854599e7d82becb17f.tar.gz postgresql-a4ef0329c27156dca81714854599e7d82becb17f.zip |
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
-rw-r--r-- | src/backend/access/transam/xlogarchive.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c index cae93ab69dd..f39dc4ddf1a 100644 --- a/src/backend/access/transam/xlogarchive.c +++ b/src/backend/access/transam/xlogarchive.c @@ -220,11 +220,12 @@ RestoreArchivedFile(char *path, const char *xlogfname, else { /* stat failed */ - if (errno != ENOENT) - ereport(FATAL, - (errcode_for_file_access(), - errmsg("could not stat file \"%s\": %m", - xlogpath))); + int elevel = (errno == ENOENT) ? LOG : FATAL; + + ereport(elevel, + (errcode_for_file_access(), + errmsg("could not stat file \"%s\": %m", xlogpath), + errdetail("restore_command returned a zero exit status, but stat() failed."))); } } |