]> 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:11 +0000 (15:22 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 27 Aug 2022 06:22:11 +0000 (15:22 +0900)
commitaeec3534ccf3fa4a207694955b4078a9a9dafc8f
tree976b817e2dd4b8805b044853e1e558bfdd0fcd10
parent28d351c9ff2afe5cc18ef64779c02c49c76896fb
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