pgsql: Refactor CHECK_FOR_INTERRUPTS() to add flexibility. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Refactor CHECK_FOR_INTERRUPTS() to add flexibility.
Date
Msg-id E1lhbdP-0008Jo-AF@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Refactor CHECK_FOR_INTERRUPTS() to add flexibility.

Split up CHECK_FOR_INTERRUPTS() to provide an additional macro
INTERRUPTS_PENDING_CONDITION(), which just tests whether an
interrupt is pending without attempting to service it.  This is
useful in situations where the caller knows that interrupts are
blocked, and would like to find out if it's worth the trouble
to unblock them.

Also add INTERRUPTS_CAN_BE_PROCESSED(), which indicates whether
CHECK_FOR_INTERRUPTS() can be relied on to clear the pending interrupt.

This commit doesn't actually add any uses of the new macros,
but a follow-on bug fix will do so.  Back-patch to all supported
branches to provide infrastructure for that fix.

Alvaro Herrera and Tom Lane

Discussion: https://postgr.es/m/20210513155351.GA7848@alvherre.pgsql

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/567328989c19d1f9f657f5c1b1eac61b29e89b3a

Modified Files
--------------
src/backend/tcop/postgres.c | 16 +++++++++++++---
src/include/miscadmin.h     | 34 +++++++++++++++++++++++-----------
2 files changed, 36 insertions(+), 14 deletions(-)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: Describe (auto-)analyze behavior for partitioned tables
Next
From: Tom Lane
Date:
Subject: pgsql: Prevent infinite insertion loops in spgdoinsert().