Hello,

I just noticed that if the archiver aborts (for instance if the
archive_command exited with a return code > 127), pg_stat_archiver won't
report those failed attempts. This happens with both 9.4 and 9.5 branches.

Please find attached a patch that fix this issue, based on current head.        

Regards.
-- 
Julien Rouhaud
http://dalibo.com - http://dalibo.org

*** a/src/backend/postmaster/pgarch.c
--- b/src/backend/postmaster/pgarch.c
***************
*** 578,585 **** pgarch_archiveXlog(char *xlog)
  		 *
  		 * Per the Single Unix Spec, shells report exit status > 128 when a
  		 * called command died on a signal.
  		 */
! 		int			lev = (WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128) ? FATAL : LOG;
  
  		if (WIFEXITED(rc))
  		{
--- 578,595 ----
  		 *
  		 * Per the Single Unix Spec, shells report exit status > 128 when a
  		 * called command died on a signal.
+ 		 *
+ 		 * If the archiver abort, we still need to tell the collector about
+ 		 * the WAL file that we failed to archive.
  		 */
! 		int		lev;
! 		if (WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128)
! 		{
! 			lev = FATAL;
! 			pgstat_send_archiver(xlog, true);
! 		}
! 		else
! 			lev = LOG;
  
  		if (WIFEXITED(rc))
  		{

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to