Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-82717

QueryPlannerIXSelect::stripInvalidAssignments tries to strip non-existent index assignment from $_internalSchemaAllElemMatchFromIndex

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0, 6.0.15, 5.0.27, 7.0.9
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v7.2, v7.0, v6.0, v5.0, v4.4, v4.2
    • 105

      See BF-30665 for full reproducible bug. Consider this parsed query:

      { $or: [ { a: { $not: { $exists: true } } }, { a: { $not: { $_internalSchemaType: [ 4 ] } } }, { a: { $_internalSchemaAllElemMatchFromIndex: [ 0, { $or: [ { i: { $regex: "a+b" } }, { i: { $not: { $_internalSchemaType: [ 2 ] } } } ] } ] } } ] } 

      The call to QueryPlannerIXSelect::rateIndices does not set any "RelevantTag"s on any parts of the query other than "{ a: { $not: { $exists: true }} }". When _rateIndices reaches the node that represents the sub-query 

       { a: { $_internalSchemaAllElemMatchFromIndex: [ 0, { $or: [ { i: { $regex: "a+b" } }, { i: { $not: { $_internalSchemaType: [ 2 ] } } } ] } ] } } 

      it does not recurse any farther since the call to "Indexability::isBoundsGenerating" returns false and the node is not a logical node.

       

      However, once we reach "stripInvalidAssignmentsTo2dsphereIndices", it does recurse into the above sub-query. When it reaches the leaf node for

      { i: { $regex: "a+b" } 

      it tries to strip the RelevantTag, but that tag was never set.  That causes a server crash here.

       

       

            Assignee:
            david.percy@mongodb.com David Percy
            Reporter:
            will.buerger@mongodb.com Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: