pgsql: Use standard SIGTERM signal handler die() in test_shm_mq worker.

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use standard SIGTERM signal handler die() in test_shm_mq worker.
Date: 2020-11-27 06:46:28
Message-ID: E1kiXWW-0008Le-Lj@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use standard SIGTERM signal handler die() in test_shm_mq worker.

Previously test_shm_mq worker used the stripped-down version of die()
as the SIGTERM signal handler. This commit makes it use die(), instead,
to simplify the code.

In terms of the code, the difference between die() and the stripped-down
version previously used is whether the signal handler directly may call
ProcessInterrupts() or not. But this difference doesn't exist in
a background worker because, in bgworker, DoingCommandRead flag will
never be true and die() will never call ProcessInterrupts() directly.
Therefore test_shm_mq worker can safely use die(), like other bgworker
proceses (e.g., logical replication apply launcher or autoprewarm worker)
currently do.

Thanks to Craig Ringer for the report and investigation of the issue.

Author: Bharath Rupireddy
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/CAGRY4nxsAe_1k_9g5b47orA0S011iBoHsXHFMH7cg7HV0O1bwQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ef848f4ac5a4bd072c65867186268775acfb4298

Modified Files
--------------
src/test/modules/test_shm_mq/worker.c | 28 +++-------------------------
1 file changed, 3 insertions(+), 25 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2020-11-27 11:19:12 pgsql: Fix CLUSTER progress reporting of number of blocks scanned.
Previous Message Fujii Masao 2020-11-27 06:12:35 pgsql: Use standard SIGHUP and SIGTERM signal handlers in worker_spi.