Re: [HACKERS] Optional message to user when terminating/cancelling backend

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Eren Başak <eren(at)citusdata(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Optional message to user when terminating/cancelling backend
Date: 2018-03-29 14:54:42
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> On 27 Mar 2018, at 13:50, Eren Başak <eren(at)citusdata(dot)com> wrote:

> > pg_cancel_backend() is defined proisstrict, while pg_cancel_backend_msg() is
> > not. I think we must be able to perform the cancellation if the message is
> > NULL, so made it two functions.
> I agree that we should preserve the old usage as well. What I don't understand is that, can't we remove proisstrict from pg_cancel_backend and copy the body of pg_cancel_backend_msg into pg_cancel_backend. This way, I think we can accomplish the same thing without introducing two new functions.

If we do that, wouldn’t SELECT pg_cancel_backend(NULL) fail unless NULL is
explicitly casted to integer? Also, I think that would cause make check to
fail the opr_sanity suite on the “multiple uses of the same internal function”
test. Maybe I’m misunderstanding your point here?

> pg_terminate_backend_msg errors out if the pid is null but pg_cancel_backend_msg returns null and I think we should have consistency between these two in this regard.

Absolutely, that was an oversight in the v8 patch, they should both handle NULL
in the same way.

Whitespace and null handling fixed, as well as rebased over HEAD.

cheers ./daniel

Attachment Content-Type Size
0001-Refactor-backend-signalling-code-v9.patch application/octet-stream 13.1 KB
0002-Support-optional-message-in-backend-cancel-terminate-v9.patch application/octet-stream 20.8 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2018-03-29 14:59:59 Re: PATCH: Configurable file mode mask
Previous Message Tomas Vondra 2018-03-29 14:39:09 Re: Allow workers to override datallowconn