pgsql: Use correct connection for cancellation in frontend's parallel s

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use correct connection for cancellation in frontend's parallel s
Date: 2022-08-27 06:23:36
Message-ID: E1oRpEG-0006EL-Aa@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use correct connection for cancellation in frontend's parallel slots

While waiting for slots to become available in wait_on_slots() in
parallel_slot.c, the cancellation always relied on the first connection
in the set to do the job. This could cause problems when this slot's
socket is gone as PQgetCancel() would return NULL in this case. Rather
than always using the first connection, this changes the logic to use
the first valid connection for the cancellation.

Author: Ranier Vilela
Reviewed-by: Justin Pryzby
Discussion: https://postgr.es/m/CAEudQAokk1h_pUwGXsYS4oVOuf35s1O2o3TXGHpV8=AWikvgHA@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/44817d97bca361f2be7fac64afa50715f959c11c

Modified Files
--------------
src/fe_utils/parallel_slot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message John Naylor 2022-08-27 07:46:07 pgsql: Be more careful to avoid including system headers after perl.h
Previous Message Peter Eisentraut 2022-08-26 18:54:30 pgsql: Remove unneeded null pointer checks before PQfreemem()