Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-16587

Solr 9.1.0 last page retrieval error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • search
    • None
    • Solr 9.1.0

      Search with wildcard query *: (all match) and reading pages without cursor until last page*

    Description

      When searching with offset, last page fails by internal assert.

      For example there are 210 documents in index matching criteria and I am reading documents using page size =100; 3rd page with range 200 to 300 fails. Same unit test runs OK on Solr 8.11 and 9.0.0

      Debugging details:

      class  org.apache.solr.search.SolrIndexSearcher method 

      private void getDocListC(QueryResult qr, QueryCommand cmd)

      receives command

      cmd = {QueryCommand@12109} 
       query = {MatchAllDocsQuery@12121} ":"
       queryID = null
       isQueryCancellable = false
       filterList = null
       filter = null
       sort = null
       offset = 200
       len = 200
       supersetMaxDoc = 220
       flags = 0
       timeAllowed = -1
       minExactCount = 2147483647
       cursorMark = null

      On line 1650:

      out.docList = constantScoreDocList(cmd.getOffset(), cmd.getLen(), out.docSet);

      docList created with 10 documents (correct):

      out.docList = {DocSlice@12126} 
       offset = 0
       len = 10
       docs = {int[10]@12129} [200, 201, 202, 203, 204, 205, 206, 207, 208, 209]
       scores = null
       matches = 210
       matchesRelation = {TotalHits$Relation@12078} "EQUAL_TO"
       maxScore = 0.0
       ramBytesUsed = 112

      But on line 1687 it is converted to null because cmd offset (200) and lenght (200) applied to this 10 documents list (thru reassigning superset):
       / Kludge...
            // we can't use DocSlice.subset, even though it should be an identity op
            // because it gets confused by situations where there are lots of matches, but
            // less docs in the slice then were requested, (due to the cursor)
            // so we have to short circuit the call.
            // None of which is really a problem since we can't use caching with
            // cursors anyway, but it still looks weird to have to special case this
            // behavior based on this condition - hence the long explanation.
             superset = out.docList;
            out.docList = superset.subset(cmd.getOffset(), cmd.getLen());

      As result, null docList returned from method (instead of 10 documents list)

      and failed later in class  org.apache.solr.response.BasicResultContext on assert on line 39:

      assert docList != null;

      In my opition, there is an error on line 1688 in class SolrIndexSearcher:

      out.docList = superset.subset(cmd.getOffset(), cmd.getLen());

      this line shouldn't be called or called with different parameters.

      Honestly I don't understand logic of this line, what is the reason for recursive subset call?

      2 lines can be presented as:

      out.docList = out.docList.subset(cmd.getOffset(), cmd.getLen());

      Attachments

        1. Screenshot from 2022-12-13 15-10-11.png
          171 kB
          Andrei Minin
        2. Screenshot from 2022-12-13 15-09-00.png
          277 kB
          Andrei Minin

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aminin@intellective.com Andrei Minin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: