Re: HS/SR and smart shutdown - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: HS/SR and smart shutdown
Date
Msg-id 4B5801FE.1010908@enterprisedb.com
Whole thread Raw
In response to Re: HS/SR and smart shutdown  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: HS/SR and smart shutdown
Re: HS/SR and smart shutdown
Re: HS/SR and smart shutdown
List pgsql-hackers
Fujii Masao wrote:
> On Thu, Jan 21, 2010 at 10:44 AM, Josh Berkus <josh@agliodbs.com> wrote:
>>> If it's "standby", it's a previously-existing behavior that a "smart"
>>> shutdown doesn't work immediately during recovery. After a recovery
>>> has been completed, it would work. Of course, I agree that such a
>>> behavior should be documented.
>> Well, as long as streaming rep is running, you can't do a smart shutdown
>> ... smart shutdown seems to treat the walreciever as a client
>> connection.
> 
> Even if SR is not running, as long as the startup process is running,
> we can't do a smart shutdown. It's not peculiar to SR.

Right, that's the way a standby server (= one still in recovery) has
always behaved. It has made sense in the past: it's not in the spirit of
smart shutdown to kill the WAL replay immediately. "smart" means wait
for recovery to finish, then shutdown.

It's a good question if that still makes sense with Hot Standby. Perhaps
we should redefine smart shutdown in standby mode to shut down as soon
as all read-only connections have died.

>>  At the very least, this should be in the documentation.
> 
> Agreed. Something like "smart shutdown is not allowed during recovery"
> should be in the following section.
> http://developer.postgresql.org/pgdocs/postgres/server-shutdown.html

It's allowed, it just doesn't do what you might expect.


In the master, smart shutdown shuts down as soon as all regular backends
are gone. It doesn't wait for the standby connections to die. In fact
they're not killed until after the shutdown checkpoint is written, so
that it gets sent to the standbys too. I think we're good there.

--  Heikki Linnakangas EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Alex Hunsaker
Date:
Subject: Re: attoptions
Next
From: Pavel Stehule
Date:
Subject: is any reason why we cannot cast from record (row) to typed row?