]> granicus.if.org Git - postgresql/commit
Make sure that hash join's bulk-tuple-transfer loops are interruptible.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 15 Feb 2017 21:40:06 +0000 (16:40 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 15 Feb 2017 21:40:06 +0000 (16:40 -0500)
commit030705e4fe27b4d3e9c9bfd38fda19e6d3be4248
tree853480f76eeeb5055310b2670c8f45af1a9dbae1
parent27a8c8033a67853878335816b486a71477fd833d
Make sure that hash join's bulk-tuple-transfer loops are interruptible.

The loops in ExecHashJoinNewBatch(), ExecHashIncreaseNumBatches(), and
ExecHashRemoveNextSkewBucket() are all capable of iterating over many
tuples without ever doing a CHECK_FOR_INTERRUPTS, so that the backend
might fail to respond to SIGINT or SIGTERM for an unreasonably long time.
Fix that.  In the case of ExecHashJoinNewBatch(), it seems useful to put
the added CHECK_FOR_INTERRUPTS into ExecHashJoinGetSavedTuple() rather
than directly in the loop, because that will also ensure that both
principal code paths through ExecHashJoinOuterGetTuple() will do a
CHECK_FOR_INTERRUPTS, which seems like a good idea to avoid surprises.

Back-patch to all supported branches.

Tom Lane and Thomas Munro

Discussion: https://postgr.es/m/6044.1487121720@sss.pgh.pa.us
src/backend/executor/nodeHash.c
src/backend/executor/nodeHashjoin.c