diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-02-15 16:40:06 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-02-15 16:40:06 -0500 |
commit | d0e9c0e3199cefb36dc787293f577cd57b984bfe (patch) | |
tree | ed1d7c91d6788843b74e910857630955a75db214 /src/backend/executor/nodeHash.c | |
parent | 804aad8ff46cbef9f520507bb8b4522a011cd1b2 (diff) | |
download | postgresql-d0e9c0e3199cefb36dc787293f577cd57b984bfe.tar.gz postgresql-d0e9c0e3199cefb36dc787293f577cd57b984bfe.zip |
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
Diffstat (limited to 'src/backend/executor/nodeHash.c')
-rw-r--r-- | src/backend/executor/nodeHash.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index ea9e88423e0..d1d1716c101 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -667,6 +667,9 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable) } tuple = nexttuple; + + /* allow this loop to be cancellable */ + CHECK_FOR_INTERRUPTS(); } } @@ -1438,6 +1441,9 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable) } hashTuple = nextHashTuple; + + /* allow this loop to be cancellable */ + CHECK_FOR_INTERRUPTS(); } /* |