Re: archiver ps display

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: archiver ps display
Дата
Msg-id 29069.1197939266@sss.pgh.pa.us
обсуждение исходный текст
Ответ на archiver ps display  (Simon Riggs <simon@2ndquadrant.com>)
Ответы Re: archiver ps display  (Simon Riggs <simon@2ndquadrant.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: patch to disallow zero length paths in binary (minor bug fix)
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: archiver ps display