Re: Function to kill backend

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: Function to kill backend
Дата
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE34B6C3@algol.sollentuna.se
обсуждение исходный текст
Ответ на Function to kill backend  ("Magnus Hagander" <mha@sollentuna.net>)
Ответы Re: Function to kill backend  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> >>> In this case, SIGINT (query cancel) will not help, because
> >>> all locks held by the transaction will still be held.
> >>
> >> Wrong.
>
> > Really?
>
> [ experiments... ]  My apologies --- you are correct about
> the present behavior.  If a SIGINT arrives while waiting for
> client input, it's just dropped on the floor.  The locks
> *will* be dropped if the SIGINT arrives during actual query
> processing.
>
> It strikes me that this is incorrect behavior, at least for
> the case where the client has a transaction block open.  It'd
> be better to define the interrupt as "transaction cancel".

That sounds reasonable. That would certainly solve this part.

That leaves justo ne part of the issue - ability to "kill off" idle
backends. Since they do use up backend "slots" (of which there is a
limited number), I still think this wuold be good. Dunno if it might be
possible to use the same signal for that, under the following scheme:
if (query_running)  cancel_query abort transaction
else if (idle in transaction) abort transaction
else if (idle not in transaction) graceful shutdown

or if that is too confusing? Fromt he "idle not in transaction", it
should be possibleo treat it the same way a "connection lost" would be,
no? (Instead of forcibly going down as SIGTERM does).

With that, I would definitly think limiting to SIGINT would be enough.


A question on using xids for identification instead of PIDs: is there a
xid assigned to a process thati s in the state "idle not in
transaction"? Otherwise, there still needs to be a way to send a signal
to those. I don't see why the PID is not a good idea (assuming
only-backends-restriction, but is even that necessary if you just send
SIGINT?)


//Magnus


В списке pgsql-hackers по дате отправления:

Предыдущее
От: jseymour@LinxNet.com (Jim Seymour)
Дата:
Сообщение: Re: Solaris initdb fails: shmmax tweak alternative?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Function to kill backend