[ 
https://issues.apache.org/jira/browse/LUCENE-10472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17508984#comment-17508984
 ] 

ASF subversion and git services commented on LUCENE-10472:
----------------------------------------------------------

Commit 9b4003236f2b9e9f35ba484a08611952794cf6ad in lucene's branch 
refs/heads/branch_9_1 from Luca Cavanna
[ https://gitbox.apache.org/repos/asf?p=lucene.git;h=9b40032 ]

LUCENE-10472: Fix TestMatchAllDocsQuery#testEarlyTermination (#753)

As part of #716 I moved the test to use a collector manager, but I forgot to 
update one of the assertions.
We can't rely on totalHits being accurate when the search is executed my 
multiple threads and early terminated.

> TestMatchAllDocsQuery#testEarlyTermination fails total hits assertion
> ---------------------------------------------------------------------
>
>                 Key: LUCENE-10472
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10472
>             Project: Lucene - Core
>          Issue Type: Task
>            Reporter: Julie Tibshirani
>            Priority: Minor
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Very rarely TestMatchAllDocsQuery can fail with an assertion error:
> {code}
>    >     java.lang.AssertionError: expected:<201> but was:<241>
>    >         at 
> __randomizedtesting.SeedInfo.seed([B4F2350E137110E3:7B6574512B1D80E0]:0)
>    >         at org.junit.Assert.fail(Assert.java:89)
>    >         at org.junit.Assert.failNotEquals(Assert.java:835)
>    >         at org.junit.Assert.assertEquals(Assert.java:647)
>    >         at org.junit.Assert.assertEquals(Assert.java:633)
>    >         at 
> org.apache.lucene.search.TestMatchAllDocsQuery.testEarlyTermination(TestMatchAllDocsQuery.java:124)
> {code}
> We are expecting the totalHits.value to be exactly totalHitsThreshold + 1, 
> but it is sometimes more:
> {code}
> assertEquals(totalHitsThreshold + 1, topDocs.totalHits.value);
> assertEquals(TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO, 
> topDocs.totalHits.relation);
> {code}
> The failures only seem to happen when we choose to use multiple threads in 
> IndexSearcher. I was able to reproduce this regularly by forcing 
> IndexSearcher to use multiple threads and running the test 100 times. This 
> started failing after https://github.com/apache/lucene/pull/716, where we 
> updated tests to use a collector manager instead of a collector, which 
> introduced the possibility of multiple threads.
> I am not sure this actually indicates a bug, or if the test just needs to be 
> tweaked. It seems okay to return more than totalHitsThreshold + 1 sometimes, 
> that doesn't seem to violate any contract?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to