On Tue, Sep 8, 2020 at 11:55 PM Jameson, Hunter 'James' <hunj...@amazon.com> wrote: > > Hi, I ran across a small (but annoying) bug in initializing parallel BTree > scans, which causes the parallel-scan state machine to get confused. The fix > is one line; the description is a bit longer— > > > > Before, function _bt_first() would exit immediately if the specified scan > keys could never be satisfied--without notifying other parallel workers, if > any, that the scan key was done. >
The first question that comes to mind is how is it possible that for one of the workers specified scan keys is not satisfied while for others it is satisfied? I think it is possible when other workers are still working on the previous scan key and this worker has moved to the next scan key. If not, then what is the other case? > This moved that particular worker to a scan key beyond what was in the shared > parallel-query state, so that it would later try to read in > "InvalidBlockNumber", without recognizing it as a special sentinel value. > Now, if it happens as I mentioned then the other workers should not try to advance their scan because their local scan key will be lesser than shared key. Basically, they should return from the below condition: _bt_parallel_seize() { .. if (so->arrayKeyCount < btscan->btps_arrayKeyCount) { /* Parallel scan has already advanced to a new set of scankeys. */ status = false; } .. } After this, those workers will also update their scan key and move forward from there. So, I am not seeing how this could create a problem. -- With Regards, Amit Kapila.