Make archiver process report its progress in PS display. Per
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 18 Dec 2007 00:49:34 +0000 (00:49 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 18 Dec 2007 00:49:34 +0000 (00:49 +0000)
proposal by Simon Riggs, though not exactly his patch.

src/backend/postmaster/pgarch.c

index c5ee1475aa5d5a8a25548982ce8a787f68a5612f..1af4df197903f47c806dcfc0507df65d10d3781d 100644 (file)
@@ -414,6 +414,7 @@ pgarch_archiveXlog(char *xlog)
 {
        char            xlogarchcmd[MAXPGPATH];
        char            pathname[MAXPGPATH];
+       char            activitymsg[MAXFNAMELEN + 16];
        char       *dp;
        char       *endp;
        const char *sp;
@@ -471,6 +472,11 @@ pgarch_archiveXlog(char *xlog)
        ereport(DEBUG3,
                        (errmsg_internal("executing archive command \"%s\"",
                                                         xlogarchcmd)));
+
+       /* Report archive activity in PS display */
+       snprintf(activitymsg, sizeof(activitymsg), "archiving %s", xlog);
+       set_ps_display(activitymsg, false);
+
        rc = system(xlogarchcmd);
        if (rc != 0)
        {
@@ -527,11 +533,17 @@ pgarch_archiveXlog(char *xlog)
                                                           xlogarchcmd)));
                }
 
+               snprintf(activitymsg, sizeof(activitymsg), "failed on %s", xlog);
+               set_ps_display(activitymsg, false);
+
                return false;
        }
        ereport(DEBUG1,
                        (errmsg("archived transaction log file \"%s\"", xlog)));
 
+       snprintf(activitymsg, sizeof(activitymsg), "last was %s", xlog);
+       set_ps_display(activitymsg, false);
+
        return true;
 }