diff options
author | Amit Kapila <akapila@postgresql.org> | 2020-09-17 15:16:46 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2020-09-17 15:38:47 +0530 |
commit | 4bc63462d9d8dd12a5564c3d4ca06c99449d2d07 (patch) | |
tree | f760d70ffab08fcca8a707453736c7cdaddf5f97 | |
parent | 511690ec5dccd7c93573367c2920e8f0919c901b (diff) | |
download | postgresql-4bc63462d9d8dd12a5564c3d4ca06c99449d2d07.tar.gz postgresql-4bc63462d9d8dd12a5564c3d4ca06c99449d2d07.zip |
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
-rw-r--r-- | src/backend/access/nbtree/nbtsearch.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c index c655dadb963..015057960df 100644 --- a/src/backend/access/nbtree/nbtsearch.c +++ b/src/backend/access/nbtree/nbtsearch.c @@ -778,7 +778,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 |