Skip to content

Commit 956891f

Browse files
author
Amit Kapila
committed
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/4248CABC-25E3-4809-B4D0-128E1BAABC3C@amazon.com
1 parent 2c74f71 commit 956891f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/access/nbtree/nbtsearch.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,11 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
570570
* never be satisfied (eg, x == 1 AND x > 2).
571571
*/
572572
if (!so->qual_ok)
573+
{
574+
/* Notify any other workers that we're done with this scan key. */
575+
_bt_parallel_done(scan);
573576
return false;
577+
}
574578

575579
/*
576580
* For parallel scans, get the starting page from shared state. If the

0 commit comments

Comments
 (0)