Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita3382de

Browse files
committed
Provide a more accurate, detailed log message when the archive command fails.
1 parent8db9ba1 commita3382de

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

‎src/backend/postmaster/pgarch.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*
2121
* IDENTIFICATION
22-
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.33 2007/11/24 21:37:04 tgl Exp $
22+
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.34 2007/12/12 09:39:54 petere Exp $
2323
*
2424
*-------------------------------------------------------------------------
2525
*/
@@ -484,11 +484,35 @@ pgarch_archiveXlog(char *xlog)
484484
* Per the Single Unix Spec, shells report exit status > 128 when a
485485
* called command died on a signal.
486486
*/
487-
boolsignaled=WIFSIGNALED(rc)||WEXITSTATUS(rc)>128;
487+
intlev=(WIFSIGNALED(rc)||WEXITSTATUS(rc)>128) ?FATAL :LOG;
488488

489-
ereport(signaled ?FATAL :LOG,
490-
(errmsg("archive command \"%s\" failed: return code %d",
491-
xlogarchcmd,rc)));
489+
if (WIFEXITED(rc))
490+
{
491+
ereport(lev,
492+
(errmsg("archive command failed with exit code %d",WEXITSTATUS(rc)),
493+
errdetail("The failed archive command was: %s",xlogarchcmd)));
494+
}
495+
elseif (WIFSIGNALED(rc))
496+
{
497+
ereport(lev, (
498+
#if defined(WIN32)
499+
errmsg("archive command was terminated by exception 0x%X",WTERMSIG(rc)),
500+
errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
501+
#elif defined(HAVE_DECL_SYS_SIGLIST)&&HAVE_DECL_SYS_SIGLIST
502+
errmsg("archive command was terminated by signal %d: %s",
503+
WTERMSIG(rc),
504+
WTERMSIG(rc)<NSIG ?sys_siglist[WTERMSIG(rc)] :"(unknown)"),
505+
#else
506+
errmsg("archive command was terminated by signal %d",WTERMSIG(exitstatus)),
507+
#endif
508+
errdetail("The failed archive command was: %s",xlogarchcmd)));
509+
}
510+
else
511+
{
512+
ereport(lev,
513+
(errmsg("archive command exited with unrecognized status %d",rc),
514+
errdetail("The failed archive command was: %s",xlogarchcmd)));
515+
}
492516

493517
return false;
494518
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp