Re: archiver ps display - Mailing list pgsql-patches

From Tom Lane
Subject Re: archiver ps display
Date
Msg-id 29069.1197939266@sss.pgh.pa.us
Whole thread Raw
In response to archiver ps display  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: archiver ps display
List pgsql-patches
Simon Riggs <simon@2ndquadrant.com> writes:
> Patch to set ps display for archiver enclosed, intended for 8.3

I think this is a good idea.  However, experimentation here showed that
at least on some machines (like HPUX), there's a pretty tight limit
before ps cuts off the display, and the more verbose messages discussed
on -hackers cause the last few digits of the filename to be cut off.
Which makes the display just about entirely useless.  So I went with
these messages:

archiving %s
last was %s
failed on %s

We might need to make it even briefer, perhaps

at: %s
last: %s
failed: %s

depending on reports from the field.

Applied patch attached.

            regards, tom lane

Index: pgarch.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/postmaster/pgarch.c,v
retrieving revision 1.35
diff -c -r1.35 pgarch.c
*** pgarch.c    12 Dec 2007 16:53:14 -0000    1.35
--- pgarch.c    18 Dec 2007 00:47:42 -0000
***************
*** 414,419 ****
--- 414,420 ----
  {
      char        xlogarchcmd[MAXPGPATH];
      char        pathname[MAXPGPATH];
+     char        activitymsg[MAXFNAMELEN + 16];
      char       *dp;
      char       *endp;
      const char *sp;
***************
*** 471,476 ****
--- 472,482 ----
      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,537 ****
--- 533,549 ----
                                 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;
  }


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: patch to disallow zero length paths in binary (minor bug fix)
Next
From: Simon Riggs
Date:
Subject: Re: archiver ps display