Re: Should we improve "PID XXXX is not a PostgreSQL server process" warning for pg_terminate_backend(<<postmaster_pid>>)?
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Euler Taveira <euler@eulerto.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-11-19T04:24:39Z
Lists: pgsql-hackers
Attachments
- v4-0001-Improve-PID-XXXX-is-not-a-PostgreSQL-server-proce.patch (application/x-patch) patch v4-0001
On Thu, Nov 18, 2021 at 5:01 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
> The following is what I made up in my mind after looking at other
> existing messages, like [1] and the review comments:
> errmsg("cannot send signal to postmaster %d", pid, --> the process
> is postmaster but the caller isn't allowed to signal.
> errmsg("cannot send signal to PostgreSQL server process %d", pid,
> --> the process is a postgresql process but the caller isn't allowed
> to signal.
> errmsg("PID %d is not a PostgreSQL backend process", pid, ---> it may
> be another postgres processes like syslogger or stats collector or
> non-postgres process but not a backend process.
>
> Thoughts?
>
> [1]
> (errmsg("could not send signal to process %d: %m", pid)));
> (errmsg("failed to send signal to postmaster: %m")));
Here's the v4 patch with the above changes, the output looks like [1].
Please review it further.
[1]
postgres=# select pg_terminate_backend(2407245);
WARNING: cannot send signal to postmaster 2407245
pg_terminate_backend
----------------------
f
(1 row)
postgres=# select pg_terminate_backend(2407246);
WARNING: cannot send signal to PostgreSQL server process 2407246
pg_terminate_backend
----------------------
f
(1 row)
postgres=# select pg_terminate_backend(2407286);
WARNING: PID 2407286 is not a PostgreSQL backend process
pg_terminate_backend
----------------------
f
(1 row)
Regards,
Bharath Rupireddy.
Commits
-
Improve warning message in pg_signal_backend()
- 7fa945b857cc 15.0 landed