Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-10500

StringValueFacetCounts relies on sequential collection

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.2
    • None
    • None
    • New

    Description

      We recently moved some of the facets tests to use IndexSearcher#search(Query, CollectorManager) providing a FacetsCollectorManager instead of a FacetsCollector. Whenever newIndexSearcher(IndexReader) is used in tests, concurrent search may now be exercised while it was not before.

      This caused some build failures on TestStringValueFacetCounts:

      java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
      	at __randomizedtesting.SeedInfo.seed([ED8BF8281FCE5C02:9FC7DD27AEAEEA71]:0)
      	at org.apache.lucene.core@10.0.0-SNAPSHOT/org.apache.lucene.util.packed.Packed64.get(Packed64.java:81)
      	at org.apache.lucene.core@10.0.0-SNAPSHOT/org.apache.lucene.index.OrdinalMap$2.get(OrdinalMap.java:346)
      	at org.apache.lucene.facet.StringValueFacetCounts.countOneSegment(StringValueFacetCounts.java:440)
      	at org.apache.lucene.facet.StringValueFacetCounts.count(StringValueFacetCounts.java:295)
      	at org.apache.lucene.facet.StringValueFacetCounts.<init>(StringValueFacetCounts.java:123)
      	at org.apache.lucene.facet.TestStringValueFacetCounts.checkFacetResult(TestStringValueFacetCounts.java:349)
      	at org.apache.lucene.facet.TestStringValueFacetCounts.testRandom(TestStringValueFacetCounts.java:325)
      

      This looks like a real bug, as StringValueFacetCounts#countOneSegment is called once providing the index of the current loop instead of the ordinal taken from the matching hits that we are analyzing. That works fine with single threaded collection as we will go sequentially and the two indices will always be the same. With multi-threaded search, the order of the returned matching hits (one per segment) is not deterministic.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              lucacavanna Luca Cavanna
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m