Re: How to know killed by pg_terminate_backend

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org, robertmhaas(at)gmail(dot)com, heikki(dot)linnakangas(at)enterprisedb(dot)com
Subject: Re: How to know killed by pg_terminate_backend
Date: 2011-01-21 10:13:32
Message-ID: AANLkTimQKz57UWmJE=s=_M9w3E3YGb_i_h0KwSu-BMJV@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 21, 2011 at 13:56, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
>> Here is the patch to implement the feature.
>>
>> 1) pg_terminate_backend() sends SIGUSR1 signal rather than SIGTERM to
>>    the target backend.
>> 2) The infrastructure used for message passing is
>>    storage/ipc/procsignal.c The new message type for ProcSignalReason
>>    is "PROCSIG_TERMNINATE_BACKEND_INTERRUPT"
>>  3) I assign new error code 57P04 which is returned from the backend
>>       killed by pg_terminate_backend().
>>
>> #define ERRCODE_TERMINATE_BACKEND                     MAKE_SQLSTATE('5','7', 'P','0','4')
>
> Anyone has better idea? Tom dislikes my patch but I don't know how to
> deal with it.

There was another design in the past discussion:
>> One idea is postmaster sets a flag in the shared memory area
>> indicating it rceived SIGTERM before forwarding the signal to
>> backends.

Is it enough for your purpose and do we think it is more robust way?

--
Itagaki Takahiro

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2011-01-21 10:24:02 Re: Is there a way to build PostgreSQL client libraries with MinGW
Previous Message Simon Riggs 2011-01-21 10:00:54 Re: SSI and Hot Standby