Repository navigation
Fix lost hits and scores in single-segment global ordinal joins with concurrent slices - #17028
uchiha-asha wants to merge 7 commits into
Conversation
Partitions of one segment shared unlocked match bits, scores and counts.
|
Hi @msokolov, could you please take a look when available. Thanks! |
| private void collectOrd(int globalOrd) throws IOException { | ||
| collectedOrds.set(globalOrd); | ||
| double existingScore = scores.getScore(globalOrd); | ||
| double newScore = scorer.score(); |
There was a problem hiding this comment.
I'm not sure it's worth movingscorer.score() outside the lock.
There was a problem hiding this comment.
Thanks @kkewwei for the review. Moved scorer.score() outside the lock. Looks safe.
| scoreMode, | ||
| min, | ||
| max, | ||
| // IndexSearcher creates one collector per slice and collects each slice on its own |
There was a problem hiding this comment.
I wonder if we need to bother about this single slice case. Can we make this change purely about fixing the bug, and then separately optimize the single slice case? I think we might want to specialize the collector for that case, but this change is already a lot to review, so i'd like to simplify it into the smallest change possible.
There was a problem hiding this comment.
Thanks @msokolov. I have removed the single slice case.
TestJoinUtil.testRandomOrdinalsJoinfailed on the Windows JDK 25 job of #16864 (seedD47984DB114B1684) with a hit scoredInfinityinstead of5.8557844.#16805 used
SegmentOrdinalCollectorfor a single segment, which updated the hits and scores without a lock. However,IndexSearchercan partition a segment into multiple slices which can lead to race conditions.This change uses the locked collector for both cases, with
LongValues.IDENTITYas the ordinal mapping when there is a single segment.