summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Kapila2020-09-17 09:46:46 +0000
committerAmit Kapila2020-09-17 10:41:48 +0000
commitb7f2dd959a5082540adbeee1dea0c0b1c154374f (patch)
treed2fe9c9173715e0e31c4a83e1b4341c82fcb8f57
parent45b9805706fdc726906fc9187c9a7b38c559755c (diff)
Update parallel BTree scan state when the scan keys can't be satisfied.
For parallel btree scan to work for array of scan keys, it should reach BTPARALLEL_DONE state once for every distinct combination of array keys. This is required to ensure that the parallel workers don't try to seize blocks at the same time for different scan keys. We missed to update this state when we discovered that the scan keys can't be satisfied. Author: James Hunter Reviewed-by: Amit Kapila Tested-by: Justin Pryzby Backpatch-through: 10, where it was introduced Discussion: https://postgr.es/m/[email protected]
-rw-r--r--src/backend/access/nbtree/nbtsearch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index 1e628a33d7..8f6575fdf1 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -880,7 +880,11 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
* never be satisfied (eg, x == 1 AND x > 2).
*/
if (!so->qual_ok)
+ {
+ /* Notify any other workers that we're done with this scan key. */
+ _bt_parallel_done(scan);
return false;
+ }
/*
* For parallel scans, get the starting page from shared state. If the