Re: How to know killed by pg_terminate_backend

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: heikki(dot)linnakangas(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: How to know killed by pg_terminate_backend
Date: 2010-05-14 12:06:33
Message-ID: AANLkTil5fOjAV14F68OV78d5VOrzawMvTkIrlgsiwUy5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 13, 2010 at 8:20 PM, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
>> > Maybe we could make PostgreSQL a little bit smarter so that it returns
>> > a different code than 57P01 when killed by pg_terminate_backend().
>>
>> Seems reasonable. Does the victim backend currently know why it has been
>> killed?
>
> I don't think so.
>
> One idea is postmaster sets a flag in the shared memory area
> indicating it rceived SIGTERM before forwarding the signal to
> backends.
>
> Backend check the flag and if it's not set, it knows that the signal
> has been sent by pg_terminate_backend(), not postmaster.

Or it could also be sent by some other user process, like the user
running "kill" from the shell.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2010-05-14 12:26:26 Re: Row-level Locks & SERIALIZABLE transactions, postgres vs. Oracle
Previous Message Fujii Masao 2010-05-14 11:56:11 Re: Synchronous replication patch built on SR