Am Montag, 10. Dezember 2007 schrieb Alvaro Herrera:
> Peter Eisentraut wrote:
> > I figured it would make sense if pgarch.c used the same mechanism that
> > postmaster.c uses to report the various variants of regular and signal
> > exits.
>
> Hmm.  Getting rid of the "(PID 0)" is going to be a mess enough for
> translations that I think it is worth pgarch.c having its own routine
> for this.  Furthermore I think the detailed archive command should be
> reported in an errdetail() field, which makes it even farther off.

Better patch.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/
diff -cr ../cvs-pgsql/src/backend/postmaster/pgarch.c ./src/backend/postmaster/pgarch.c
*** ../cvs-pgsql/src/backend/postmaster/pgarch.c	2007-11-26 13:29:36.000000000 +0100
--- ./src/backend/postmaster/pgarch.c	2007-12-11 17:10:50.000000000 +0100
***************
*** 474,494 ****
  	rc = system(xlogarchcmd);
  	if (rc != 0)
  	{
! 		/*
! 		 * If either the shell itself, or a called command, died on a signal,
! 		 * abort the archiver.	We do this because system() ignores SIGINT and
! 		 * SIGQUIT while waiting; so a signal is very likely something that
! 		 * should have interrupted us too.	If we overreact it's no big deal,
! 		 * the postmaster will just start the archiver again.
! 		 *
! 		 * Per the Single Unix Spec, shells report exit status > 128 when a
! 		 * called command died on a signal.
! 		 */
! 		bool		signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128;
! 
! 		ereport(signaled ? FATAL : LOG,
! 				(errmsg("archive command \"%s\" failed: return code %d",
! 						xlogarchcmd, rc)));
  
  		return false;
  	}
--- 474,514 ----
  	rc = system(xlogarchcmd);
  	if (rc != 0)
  	{
! 		if (WIFEXITED(rc))
! 		{
! 			ereport(LOG,
! 					(errmsg("archive command failed with exit code %d", WEXITSTATUS(rc)),
! 					 errdetail("The archive command was \"%s\".", xlogarchcmd)));
! 		}
! 		else if (WIFSIGNALED(rc))
! 		{
! 			/*
! 			 * If either the shell itself, or a called command, died
! 			 * on a signal, abort the archiver. We do this because
! 			 * system() ignores SIGINT and SIGQUIT while waiting; so a
! 			 * signal is very likely something that should have
! 			 * interrupted us too. If we overreact it's no big deal,
! 			 * the postmaster will just start the archiver again.
! 			 */
! 			ereport(FATAL, (
! #if defined(WIN32)
! 						errmsg("archive command was terminated by exception 0x%X", WTERMSIG(rc)),
! 						errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
! #elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST
! 						errmsg("archive command was terminated by signal %d: %s",
! 							   WTERMSIG(rc),
! 							   WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"),
! #else
! 						errmsg("archive command was terminated by signal %d", WTERMSIG(exitstatus)),
! #endif
! 						errdetail("The archive command was \"%s\".", xlogarchcmd)));
! 		}
! 		else
! 		{
! 			ereport(LOG,
! 					(errmsg("archive command exited with unrecognized status %d", rc),
! 					 errdetail("The archive command was \"%s\".", xlogarchcmd)));
! 		}
  
  		return false;
  	}
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to