mirror of
https://github.com/postgres/postgres.git
synced 2025-05-20 00:03:14 -04:00
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>
This commit is contained in:
parent
7ab321404c
commit
fef88b3fda
@ -300,8 +300,8 @@ RestoreArchivedFile(char *path, const char *xlogfname,
|
|||||||
signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 125;
|
signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 125;
|
||||||
|
|
||||||
ereport(signaled ? FATAL : DEBUG2,
|
ereport(signaled ? FATAL : DEBUG2,
|
||||||
(errmsg("could not restore file \"%s\" from archive: return code %d",
|
(errmsg("could not restore file \"%s\" from archive: %s",
|
||||||
xlogfname, rc)));
|
xlogfname, wait_result_to_str(rc))));
|
||||||
|
|
||||||
not_available:
|
not_available:
|
||||||
|
|
||||||
@ -410,9 +410,10 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
|
|||||||
ereport((signaled && failOnSignal) ? FATAL : WARNING,
|
ereport((signaled && failOnSignal) ? FATAL : WARNING,
|
||||||
/*------
|
/*------
|
||||||
translator: First %s represents a recovery.conf parameter name like
|
translator: First %s represents a recovery.conf parameter name like
|
||||||
"recovery_end_command", and the 2nd is the value of that parameter. */
|
"recovery_end_command", the 2nd is the value of that parameter, the
|
||||||
(errmsg("%s \"%s\": return code %d", commandName,
|
third an already translated error message. */
|
||||||
command, rc)));
|
(errmsg("%s \"%s\": %s", commandName,
|
||||||
|
command, wait_result_to_str(rc))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user