Re: Shutting down server from a backend process, e.g. walrceiver

From: David Fetter <david(at)fetter(dot)org>
To: fazool mein <fazoolmein(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Shutting down server from a backend process, e.g. walrceiver
Date: 2010-09-21 15:32:19
Message-ID: 20100921153219.GA11009@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 20, 2010 at 05:48:40PM -0700, fazool mein wrote:
> Hi,
>
> I want to shut down the server under certain conditions that can be
> checked inside a backend process. For instance, while running
> symmetric

Synchronous?

> replication, if the primary dies, I want the the walreceiver to
> detect that and shutdown the standby. The reason for shutdown is
> that I want to execute some other stuff before I start the standby
> as a primary. Creating a trigger file doesn't help as it converts
> the standby into primary at run time.
>
> Using proc_exit() inside walreceiver only terminates the walreceiver
> process, which postgres starts again. The other way I see is using
> ereport(PANIC, ...). Is there some other way to shutdown the main
> server from within a backend process?

Perhaps I've misunderstood, but since there's already Something
Else(TM) which takes actions, why not send a message to it so it can
take appropriate action on the node, starting with shutting it down?

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2010-09-21 15:35:28 Re: .gitignore files, take two
Previous Message Markus Wanner 2010-09-21 15:31:25 Re: bg worker: general purpose requirements