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

CBR asserts on plans with Fetch nested under Fetch

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL

       

      > db.adminCommand({setParameter:1, planRankerMode: "heuristicCE"})
      > db.c.insert({_id: 1})
      > db.c.createIndex({a: 1, 'b.c': 1})
      > db.c.find({
           a: 1,
           $or: [
             {a: 2},
             {b: {$elemMatch: {$or: [{c: 4}, {c: 5}]}}}
           ]
      })
      MongoServerError: There cannot be other sub-plans parallel to a FetchNode

      The plan that this query generates is 

         winningPlan: {
            isCached: false,
            stage: 'FETCH',
            inputStage: {
              stage: 'OR',
              inputStages: [
                {
                  stage: 'IXSCAN',
                  keyPattern: { a: 1, 'b.c': 1 },
                  indexName: 'a_1_b.c_1',
                  isMultiKey: false,
                  multiKeyPaths: { a: [], 'b.c': [] },
                  isUnique: false,
                  isSparse: false,
                  isPartial: false,
                  indexVersion: 2,
                  direction: 'forward',
                  indexBounds: { a: [], 'b.c': [ '[MinKey, MaxKey]' ] }
                },
                {
                  stage: 'FETCH',
                  filter: {
                    b: {
                      '$elemMatch': { c: { '$in': [ 4, 5 ] } }
                    }
                  },
                  inputStage: {
                    stage: 'IXSCAN',
                    keyPattern: { a: 1, 'b.c': 1 },
                    indexName: 'a_1_b.c_1',
                    isMultiKey: false,
                    multiKeyPaths: { a: [], 'b.c': [] },
                    isUnique: false,
                    isSparse: false,
                    isPartial: false,
                    indexVersion: 2,
                    direction: 'forward',
                    indexBounds: { a: [ '[1, 1]' ], 'b.c': [ '[4, 4]', '[5, 5]' ] }
                  }
                }
              ]
            }
          }, 

      CBR currently does not support this plan shape which has two Fetches nested under each other.

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: