Skip to content

Commit fef88b3

Browse files
committed
Report exit code from external recovery commands properly
When an external recovery command such as restore_command or archive_cleanup_command fails, report the exit code properly, distinguishing signals and normal exists, using the existing wait_result_to_str() facility, instead of just reporting the return value from system(). Reviewed-by: Peter Geoghegan <pg@heroku.com>
1 parent 7ab3214 commit fef88b3

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
@@ -300,8 +300,8 @@ RestoreArchivedFile(char *path, const char *xlogfname,
300300
signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 125;
301301

302302
ereport(signaled ? FATAL : DEBUG2,
303-
(errmsg("could not restore file \"%s\" from archive: return code %d",
304-
xlogfname, rc)));
303+
(errmsg("could not restore file \"%s\" from archive: %s",
304+
xlogfname, wait_result_to_str(rc))));
305305

306306
not_available:
307307

@@ -410,9 +410,10 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
410410
ereport((signaled && failOnSignal) ? FATAL : WARNING,
411411
/*------
412412
translator: First %s represents a recovery.conf parameter name like
413-
"recovery_end_command", and the 2nd is the value of that parameter. */
414-
(errmsg("%s \"%s\": return code %d", commandName,
415-
command, rc)));
413+
"recovery_end_command", the 2nd is the value of that parameter, the
414+
third an already translated error message. */
415+
(errmsg("%s \"%s\": %s", commandName,
416+
command, wait_result_to_str(rc))));
416417
}
417418
}
418419

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