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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Bug with pg_ctl -w/wait and config-only directories
Дата
Msg-id 201110052320.p95NKG018205@momjian.us
обсуждение исходный текст
Ответ на Re: Bug with pg_ctl -w/wait and config-only directories  ("Mr. Aaron W. Swenson" <titanofold@gentoo.org>)
Ответы Re: Bug with pg_ctl -w/wait and config-only directories
Список pgsql-hackers
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?

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.

pg_upgrade could use this method if it had -o options for old and new
clusters.  Right now it has -p and -P and those could be removed and use
-o/-O instead, but it would require parsing the -o string, with is
problematic.  The right solution for the port number would be to use the
new postmaster -C option, pass the -o into that, and read the port
number with 'postmaster -C port'.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Marti Raudsepp
Дата:
Сообщение: Re: [PATCH] Log crashed backend's query v2
Следующее
От: "Mr. Aaron W. Swenson"
Дата:
Сообщение: Re: Bug with pg_ctl -w/wait and config-only directories