aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2022-08-27 15:22:07 +0900
committerMichael Paquier <michael@paquier.xyz>2022-08-27 15:22:07 +0900
commit44817d97bca361f2be7fac64afa50715f959c11c (patch)
treeeaedaf32ffc59cb0fd89753fdbc6193f0a991c9c
parentd4e9bca40309fff78c1a585cdb3dabf6fabfb6f1 (diff)
downloadpostgresql-44817d97bca361f2be7fac64afa50715f959c11c.tar.gz
postgresql-44817d97bca361f2be7fac64afa50715f959c11c.zip
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
-rw-r--r--src/fe_utils/parallel_slot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fe_utils/parallel_slot.c b/src/fe_utils/parallel_slot.c
index 684327885d3..4bf053697a3 100644
--- a/src/fe_utils/parallel_slot.c
+++ b/src/fe_utils/parallel_slot.c
@@ -237,7 +237,7 @@ wait_on_slots(ParallelSlotArray *sa)
if (cancelconn == NULL)
return false;
- SetCancelConn(sa->slots->connection);
+ SetCancelConn(cancelconn);
i = select_loop(maxFd, &slotset);
ResetCancelConn();