Re: [HACKERS] pg_ctl -t N register ?? - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [HACKERS] pg_ctl -t N register ??
Date
Msg-id 200711201924.lAKJODi19619@momjian.us
Whole thread Raw
List pgsql-patches
Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > Alvaro Herrera wrote:
> > > Hi,
> > >
> > > I just noticed that the "pg_ctl register" synopsis was updated to have a
> > > -t parameter.  This does not seem to make sense to me.  Is it correct?
> > > Does it do anything?
> > >
> > > My thinking is that we should just remove the -t from that synopsis.
> >
> > Well, Peter added it, but register already had the -w parameter, so
> > either register needs both -t and -w, or it needs neither of them.  I
> > don't know which is true.
>
> Humm, in pgwin32_CommandLine I don't see any reference to -t but -w is
> there.  So either
>
> a) the bug is that somebody forgot to add -t to pgwin32_CommandLine
> b) the bug is that -t was added to the synopsis, or
> c) I'm full of it because of an untold reason.

Yes, the bug was "a" and I am responsible.  I didn't realize pg_ctl
register stores all its arguments.  Patch attached and applied.  The
SGML documentation is now accurate.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.89
diff -c -c -r1.89 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c    15 Nov 2007 21:14:41 -0000    1.89
--- src/bin/pg_ctl/pg_ctl.c    20 Nov 2007 19:21:09 -0000
***************
*** 77,86 ****
      RUN_AS_SERVICE_COMMAND
  } CtlCommand;


  static bool do_wait = false;
  static bool wait_set = false;
! static int    wait_seconds = 60;
  static bool silent_mode = false;
  static ShutdownMode shutdown_mode = SMART_MODE;
  static int    sig = SIGTERM;        /* default */
--- 77,87 ----
      RUN_AS_SERVICE_COMMAND
  } CtlCommand;

+ #define DEFAULT_WAIT    60

  static bool do_wait = false;
  static bool wait_set = false;
! static int    wait_seconds = DEFAULT_WAIT;
  static bool silent_mode = false;
  static ShutdownMode shutdown_mode = SMART_MODE;
  static int    sig = SIGTERM;        /* default */
***************
*** 1031,1036 ****
--- 1032,1041 ----
      if (registration && do_wait)
          strcat(cmdLine, " -w");

+     if (registration && wait_seconds != DEFAULT_WAIT)
+         /* concatenate */
+         sprintf(cmdLine + strlen(cmdLine), " -t %d", wait_seconds);
+
      if (post_opts)
      {
          strcat(cmdLine, " ");
***************
*** 1472,1478 ****
      printf(_("Usage:\n"));
      printf(_("  %s start   [-w] [-t SECS] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]\n"), progname);
      printf(_("  %s stop    [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"), progname);
!     printf(_("  %s restart [-w] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n                   [-o
\"OPTIONS\"]\n"),progname); 
      printf(_("  %s reload  [-D DATADIR] [-s]\n"), progname);
      printf(_("  %s status  [-D DATADIR]\n"), progname);
      printf(_("  %s kill    SIGNALNAME PID\n"), progname);
--- 1477,1484 ----
      printf(_("Usage:\n"));
      printf(_("  %s start   [-w] [-t SECS] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]\n"), progname);
      printf(_("  %s stop    [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"), progname);
!     printf(_("  %s restart [-w] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"
!          "                 [-o \"OPTIONS\"]\n"), progname);
      printf(_("  %s reload  [-D DATADIR] [-s]\n"), progname);
      printf(_("  %s status  [-D DATADIR]\n"), progname);
      printf(_("  %s kill    SIGNALNAME PID\n"), progname);

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] fulltext parser strange behave
Next
From: Bruce Momjian
Date:
Subject: Re: Fix pg_dump dependency on postgres.h