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

Commit6a4941f

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 parentb167d57 commit6a4941f

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
@@ -667,6 +667,9 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable)
667667
}
668668

669669
tuple=nexttuple;
670+
671+
/* allow this loop to be cancellable */
672+
CHECK_FOR_INTERRUPTS();
670673
}
671674
}
672675

@@ -1438,6 +1441,9 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
14381441
}
14391442

14401443
hashTuple=nextHashTuple;
1444+
1445+
/* allow this loop to be cancellable */
1446+
CHECK_FOR_INTERRUPTS();
14411447
}
14421448

14431449
/*

‎src/backend/executor/nodeHashjoin.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,13 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
911911
size_tnread;
912912
MinimalTupletuple;
913913

914+
/*
915+
* We check for interrupts here because this is typically taken as an
916+
* alternative code path to an ExecProcNode() call, which would include
917+
* such a check.
918+
*/
919+
CHECK_FOR_INTERRUPTS();
920+
914921
/*
915922
* Since both the hash value and the MinimalTuple length word are uint32,
916923
* we can read them both in one BufFileRead() call without any type

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp