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

From Bruce Momjian
Subject Re: pg_ctl restart - behaviour based on wrong instance
Date
Msg-id 201104261953.p3QJrWQ15431@momjian.us
Whole thread Raw
In response to Re: pg_ctl restart - behaviour based on wrong instance  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
Fujii Masao 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.

FYI, my The Magic of Hot Streaming Replication talk shows this exact
issue on slide 16:
http://momjian.us/main/presentations/features.html#hot_streaming
Remove /data2/postmaster.pid so the standby server does not see theprimary servers pid as its own:
rm /u/pg/data2/postmaster.pid

This is because my demo creates the standby on the same machine as the
master so the pid is still valid and owned by 'postgres', which is what
the user is reporting.

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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: 2nd Level Buffer Cache
Next
From: Andrew Dunstan
Date:
Subject: Re: SR standby hangs