Обсуждение: pg_ctl restart just appends to command line instead of regenerating original cmd

Поиск
Список
Период
Сортировка

pg_ctl restart just appends to command line instead of regenerating original cmd

От
pgsql-bugs@postgresql.org
Дата:
Patricia Holben (pholben@greatbridge.com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
pg_ctl restart just appends to command line instead of regenerating original cmd

Long Description
I see in the mailing lists that there was activity around the pg_ctl restart function in April. I wondered if there had
beenor was going to be some action taken, and if so, if those involved were aware that subsequent restarts keep adding
tothe command line (rather than re-executing it exactly). For example, if the command at start is: 
/usr/bin/postmaster '-D' '/var/lib/pgsql/data'

Then when "pg_ctl restart" is executed, the "pg_ctl status" will display:
    pg_ctl: postmaster is running (pid: 14635)
    Command line was:
    /usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

A subsequent "pg_ctl restart" causes the next "pg_ctl status" to display:
    pg_ctl: postmaster is running (pid: 14635)
    Command line was:
    /usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

And so it continues with each subsequent restart.

Sample Code


No file was uploaded with this report

Re: pg_ctl restart just appends to command line instead of regenerating original cmd

От
Bruce Momjian
Дата:
I can confirm that problem exists in the current CVS sources.

> Patricia Holben (pholben@greatbridge.com) reports a bug with a severity of 3
> The lower the number the more severe it is.
>
> Short Description
> pg_ctl restart just appends to command line instead of regenerating original cmd
>
> Long Description
> I see in the mailing lists that there was activity around the pg_ctl restart function in April. I wondered if there
hadbeen or was going to be some action taken, and if so, if those involved were aware that subsequent restarts keep
addingto the command line (rather than re-executing it exactly). For example, if the command at start is: 
> /usr/bin/postmaster '-D' '/var/lib/pgsql/data'
>
> Then when "pg_ctl restart" is executed, the "pg_ctl status" will display:
>     pg_ctl: postmaster is running (pid: 14635)
>     Command line was:
>     /usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'
>
> A subsequent "pg_ctl restart" causes the next "pg_ctl status" to display:
>     pg_ctl: postmaster is running (pid: 14635)
>     Command line was:
>     /usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'
>
> And so it continues with each subsequent restart.
>
> Sample Code
>
>
> No file was uploaded with this report
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: pg_ctl restart just appends to command line instead of regenerating original cmd

От
Peter Eisentraut
Дата:
> Patricia Holben (pholben@greatbridge.com) reports a bug with a severity of 3

> Then when "pg_ctl restart" is executed, the "pg_ctl status" will display:
>     pg_ctl: postmaster is running (pid: 14635)
>     Command line was:
>     /usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'
>
> A subsequent "pg_ctl restart" causes the next "pg_ctl status" to display:
>     pg_ctl: postmaster is running (pid: 14635)
>     Command line was:
>     /usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

Actually, only the -D option is repeated.  The patch below might fix it,
but please check all the other start and restart modes, too (with/without
-o, especially).

--- pg_ctl.sh   Sat Apr 21 13:23:58 2001
+++ pg_ctl.sh.new       Wed Jun 20 17:03:07 2001
@@ -316,7 +316,7 @@
         eval set X "$POSTOPTS"; shift
     fi

-    set X -D "$PGDATA" ${1+"$@"}; shift
+    export PGDATA

     if [ -n "$logfile" ]; then
         "$po_path" "$@" </dev/null >>$logfile 2>&1 &

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

Re: pg_ctl restart just appends to command line instead of regenerating original cmd

От
Bruce Momjian
Дата:
I have applied the following patch based on Peter's fix.  The forced -D
in the old code clearly was error-prone.  This should fix the reported
problem.


> > Patricia Holben (pholben@greatbridge.com) reports a bug with a severity of 3
>
> > Then when "pg_ctl restart" is executed, the "pg_ctl status" will display:
> >     pg_ctl: postmaster is running (pid: 14635)
> >     Command line was:
> >     /usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'
> >
> > A subsequent "pg_ctl restart" causes the next "pg_ctl status" to display:
> >     pg_ctl: postmaster is running (pid: 14635)
> >     Command line was:
> >     /usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'
>
> Actually, only the -D option is repeated.  The patch below might fix it,
> but please check all the other start and restart modes, too (with/without
> -o, especially).
>
> --- pg_ctl.sh   Sat Apr 21 13:23:58 2001
> +++ pg_ctl.sh.new       Wed Jun 20 17:03:07 2001
> @@ -316,7 +316,7 @@
>          eval set X "$POSTOPTS"; shift
>      fi
>
> -    set X -D "$PGDATA" ${1+"$@"}; shift
> +    export PGDATA
>
>      if [ -n "$logfile" ]; then
>          "$po_path" "$@" </dev/null >>$logfile 2>&1 &
>
> --
> Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/bin/pg_ctl/pg_ctl.sh
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.sh,v
retrieving revision 1.20
diff -c -r1.20 pg_ctl.sh
*** src/bin/pg_ctl/pg_ctl.sh    2001/04/21 11:23:58    1.20
--- src/bin/pg_ctl/pg_ctl.sh    2001/07/11 04:54:31
***************
*** 316,322 ****
          eval set X "$POSTOPTS"; shift
      fi

!     set X -D "$PGDATA" ${1+"$@"}; shift

      if [ -n "$logfile" ]; then
          "$po_path" "$@" </dev/null >>$logfile 2>&1 &
--- 316,323 ----
          eval set X "$POSTOPTS"; shift
      fi

!     # pass environment into new postmaster
!     export PGDATA

      if [ -n "$logfile" ]; then
          "$po_path" "$@" </dev/null >>$logfile 2>&1 &