atris commented on issue #823: LUCENE-8939: Introduce Shared Count Early 
Termination In Parallel Search
URL: https://github.com/apache/lucene-solr/pull/823#issuecomment-524382441
 
 
   
   > I don't see what the modification is. The early termination logic is the 
same, the only diff is that the counter to check totalHitsThreshold is global 
in one case and local in the current impl. What I propose is to decorrelate the 
local totalHits that is needed to count the number of documents visited by the 
collector and the counter to check the `totalHitsThreshold`. A simple 
`BooleanSupplier` that checks if updateMinScore can be called won't change any 
existing functionality and you can hide this implementation detail by keeping 
the TopFieldCollector#create as they are today. Did I miss something ?
   
   No, you did not. As I mentioned earlier (sorry if I was not being clear), 
the reason I did not do it the way you proposed was an excessive paranoid to 
not touch a widely used family of collectors when adding this functionality, 
until I demonstrate it to the community and get feedback. Based on our 
discussion above, I implicitly understand that you are fine with the approached 
proposed in the PR and believe it is safe enough to be added to the core 
`TopFieldCollector`? If that is the case, I will raise another iteration, 
integrating the same into the parent class.
   
   
   > Yes, why do you need to decrement the counter, any visited document should 
increment ?
   
   The reason for that is since `AtomicInteger.get()` is not guaranteed to be 
thread safe, so that was a hack way to read the value safely. If you notice, we 
do increment the counter when a hit is collected. However, the specific 
location you are mentioning is just for reading without a lock -- do an 
`incrementAndGet`, then decrement the phantom increment that we just did

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to