Skip to content

Commit 5335fab

Browse files
committed
Make archiver process report its progress in PS display. Per
proposal by Simon Riggs, though not exactly his patch.
1 parent dbc632e commit 5335fab

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/backend/postmaster/pgarch.c

Lines changed: 13 additions & 1 deletion
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.35 2007/12/12 16:53:14 tgl Exp $
22+
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.36 2007/12/18 00:49:34 tgl Exp $
2323
*
2424
*-------------------------------------------------------------------------
2525
*/
@@ -414,6 +414,7 @@ pgarch_archiveXlog(char *xlog)
414414
{
415415
char xlogarchcmd[MAXPGPATH];
416416
char pathname[MAXPGPATH];
417+
char activitymsg[MAXFNAMELEN + 16];
417418
char *dp;
418419
char *endp;
419420
const char *sp;
@@ -471,6 +472,11 @@ pgarch_archiveXlog(char *xlog)
471472
ereport(DEBUG3,
472473
(errmsg_internal("executing archive command \"%s\"",
473474
xlogarchcmd)));
475+
476+
/* Report archive activity in PS display */
477+
snprintf(activitymsg, sizeof(activitymsg), "archiving %s", xlog);
478+
set_ps_display(activitymsg, false);
479+
474480
rc = system(xlogarchcmd);
475481
if (rc != 0)
476482
{
@@ -527,11 +533,17 @@ pgarch_archiveXlog(char *xlog)
527533
xlogarchcmd)));
528534
}
529535

536+
snprintf(activitymsg, sizeof(activitymsg), "failed on %s", xlog);
537+
set_ps_display(activitymsg, false);
538+
530539
return false;
531540
}
532541
ereport(DEBUG1,
533542
(errmsg("archived transaction log file \"%s\"", xlog)));
534543

544+
snprintf(activitymsg, sizeof(activitymsg), "last was %s", xlog);
545+
set_ps_display(activitymsg, false);
546+
535547
return true;
536548
}
537549

0 commit comments

Comments
 (0)