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

From: fazool mein <fazoolmein(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Shutting down server from a backend process, e.g. walrceiver
Date: 2010-09-21 00:48:40
Message-ID: AANLkTi=NCSN0WfXwK0r-V7w82tBJY_OVdoW+1a0_yBOO@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I want to shut down the server under certain conditions that can be checked
inside a backend process. For instance, while running symmetric 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?

Thanks.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-09-21 00:49:44 Re: bg worker: general purpose requirements
Previous Message Robert Haas 2010-09-20 22:24:35 Re: Configuring synchronous replication