Re: Bug with pg_ctl -w/wait and config-only directories

From: "Mr(dot) Aaron W(dot) Swenson" <titanofold(at)gentoo(dot)org>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug with pg_ctl -w/wait and config-only directories
Date: 2011-10-05 23:53:05
Message-ID: 20111005235304.GB19405@atrus.grandmasfridge.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 05, 2011 at 07:20:16PM -0400, Bruce Momjian wrote:
> Mr. Aaron W. Swenson wrote:
> -- Start of PGP signed section.
> > On Wed, Oct 05, 2011 at 10:44:38AM -0400, Bruce Momjian wrote:
> > > Peter Eisentraut wrote:
> > > > On m?n, 2011-10-03 at 15:09 -0400, Bruce Momjian wrote:
> > > > > Why were people not using pg_ctl?
> > > >
> > > > Actually, a slight correction/addition here: The Debian init script does
> > > > use pg_ctl to start the service. Seems to work fine.
> > >
> > > Yes. The script authors discovered a working behavior, which matches my
> > > research:
> > >
> > > pg_ctl start specify config directory
> > > pg_ctl -w start impossible
> > > ...
> >
> >
> > Maybe I'm misunderstanding what you've written, but for 'pg_ctl -w' it is
> > possible. The following command does work (I've replaced the variables
> > with their default values to make it easier to read):
> >
> > su -l postgres \
> > -c "env PGPORT=\"5432\" /usr/lib/postgresql-9.1/bin/pg_ctl start -w \
> > -t 60 -s -D /var/lib/postgresql/9.1/data/ \
> > -o '-D /etc/postgresql-9.1/ \
> > --data-directory=/var/lib/postgresql/9.1/data/ \
> > --silent-mode=true'"
>
> Wow. So you are telling pg_ctl to use the real data directory, but are
> passing flags to the postmaster to start with the config directory and
> also setting data-directory to the real data directory. I am impressed.
>
> I can see how that would work. Did you look at the C code to figure
> this out or did you just test until it worked, or did it just seem
> logical to you?

No, I didn't look into the C code. (Though, I have poked around in there a
bit.)

Being a Gentoo user has taught me a few things like one should always
'read the friendly manual.' It just seemed logical after reading the
pg_ctl documentation that passing options to the postmaster would do the
trick, which spurred my testing several variations until it worked. But, I
only knew that I could give 'postgres'/'postmaster' the configuration
directory and it would do the right thing.

> With the patch I am going to commit, you will not need to use one of the
> -D flags because pg_ctl will find the data directory location; you will
> just specify the config-only directory with one -D, and the
> --data-directory.

So, you're saying that my passing the config directory to pg_ctl through
'-D' will eliminate the need -- as far as config and data directories are
concerned -- to pass options directly to the postmaster?

--
Mr. Aaron W. Swenson
Gentoo Linux Developer
Email : titanofold(at)gentoo(dot)org
GnuPG FP : 2C00 7719 4F85 FB07 A49C 0E31 5713 AA03 D1BB FDA0
GnuPG ID : D1BBFDA0

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-10-05 23:59:07 Re: Bug with pg_ctl -w/wait and config-only directories
Previous Message Bruce Momjian 2011-10-05 23:20:16 Re: Bug with pg_ctl -w/wait and config-only directories