Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf2ec57d

Browse files
committed
Make sure that hash join's bulk-tuple-transfer loops are interruptible.
The loops in ExecHashJoinNewBatch(), ExecHashIncreaseNumBatches(), andExecHashRemoveNextSkewBucket() are all capable of iterating over manytuples without ever doing a CHECK_FOR_INTERRUPTS, so that the backendmight fail to respond to SIGINT or SIGTERM for an unreasonably long time.Fix that. In the case of ExecHashJoinNewBatch(), it seems useful to putthe added CHECK_FOR_INTERRUPTS into ExecHashJoinGetSavedTuple() ratherthan directly in the loop, because that will also ensure that bothprincipal code paths through ExecHashJoinOuterGetTuple() will do aCHECK_FOR_INTERRUPTS, which seems like a good idea to avoid surprises.Back-patch to all supported branches.Tom Lane and Thomas MunroDiscussion:https://postgr.es/m/6044.1487121720@sss.pgh.pa.us
1 parent2b18743 commitf2ec57d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

‎src/backend/executor/nodeHash.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,9 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable)
720720

721721
/* next tuple in this chunk */
722722
idx+=MAXALIGN(hashTupleSize);
723+
724+
/* allow this loop to be cancellable */
725+
CHECK_FOR_INTERRUPTS();
723726
}
724727

725728
/* we're done with this chunk - free it and proceed to the next one */
@@ -1599,6 +1602,9 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
15991602
}
16001603

16011604
hashTuple=nextHashTuple;
1605+
1606+
/* allow this loop to be cancellable */
1607+
CHECK_FOR_INTERRUPTS();
16021608
}
16031609

16041610
/*

‎src/backend/executor/nodeHashjoin.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,13 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
856856
size_tnread;
857857
MinimalTupletuple;
858858

859+
/*
860+
* We check for interrupts here because this is typically taken as an
861+
* alternative code path to an ExecProcNode() call, which would include
862+
* such a check.
863+
*/
864+
CHECK_FOR_INTERRUPTS();
865+
859866
/*
860867
* Since both the hash value and the MinimalTuple length word are uint32,
861868
* we can read them both in one BufFileRead() call without any type

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp