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

Lines changed: 6 additions & 5 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy