Re: pg_ctl restart - behaviour based on wrong instance - Mailing list pgsql-hackers

From Robert Haas
Subject Re: pg_ctl restart - behaviour based on wrong instance
Date
Msg-id AANLkTikhjg8T6AVKWM6aOn6qM-Ze4dqrTEbTCibfG1OK@mail.gmail.com
Whole thread Raw
In response to Re: pg_ctl restart - behaviour based on wrong instance  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: pg_ctl restart - behaviour based on wrong instance
Re: pg_ctl restart - behaviour based on wrong instance
List pgsql-hackers
On Wed, Mar 23, 2011 at 1:48 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
> On Sat, Mar 19, 2011 at 10:20 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>> On Fri, Mar 18, 2011 at 1:19 PM, Erik Rijkers <er@xs4all.nl> wrote:
>>> This is OK and expected.  But then it continues (in the logfile) with:
>>>
>>> FATAL:  lock file "postmaster.pid" already exists
>>> HINT:  Is another postmaster (PID 20519) running in data directory
>>> "/var/data1/pg_stuff/pg_installations/pgsql.vanilla_1/data"?
>>>
>>> So, complaints about the *other* instance.  It doesn't happen once a successful start (with pg_ctl
>>> start) has happened.
>>
>> I'm guessing that leftover postmaster.pid contents might be
>> responsible for this?
>
> The cause is that "pg_ctl restart" uses the postmaster.opts which was
> created in the primary. Since its content was something like
> "pg_ctl -D vanilla_1/data", vanilla_1/data/postmaster.pid was checked
> wrongly.
>
> The simple workaround is to exclude postmaster.opts from the backup
> as well as postmaster.pid. But when postmaster.opts doesn't exist,
> "pg_ctl restart" cannot start up the server. We might also need to change
> the code of "pg_ctl restart" so that it does just "pg_ctl start" when
> postmaster.opts doesn't exist.

Sounds reasonable.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Efficient transaction-controlled synchronous replication.
Next
From: Robert Haas
Date:
Subject: Re: crash-safe visibility map, take four