postgres.git / summary / log / commit / refs

commit    fcc3665a03a644204d0a3fdf8ec138e3ec93e593
Author:   Amit Kapila <akapila@postgresql.org>
Date:     Thu Sep 17 09:46:46 2020 +0000
First released in: 14.0, 10.15, 11.10, 12.5, 13.0

    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


src/backend/access/nbtree/nbtsearch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c index ce33b3d73da..bbee2a0d42b 100644 --- a/src/backend/access/nbtree/nbtsearch.c +++ b/src/backend/access/nbtree/nbtsearch.c @@ -568,7 +568,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 [parent: d6d70f89a6f9]