]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Use correct connection for cancellation in frontend's parallel slots
authorMichael Paquier <michael@paquier.xyz>
Sat, 27 Aug 2022 06:22:07 +0000 (15:22 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 27 Aug 2022 06:22:07 +0000 (15:22 +0900)
commit44817d97bca361f2be7fac64afa50715f959c11c
treeeaedaf32ffc59cb0fd89753fdbc6193f0a991c9c
parentd4e9bca40309fff78c1a585cdb3dabf6fabfb6f1
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
src/fe_utils/parallel_slot.c