Replanning a query that requires subplanning can tassert

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • v8.3
    • Hide
      const coll = db.coll;
      coll.drop();
      coll.insert({a: 2, b: 3});
      
      coll.createIndex({a: 1});
      coll.createIndex({b: 1});
      
      function query(){
          coll
          .find({$or: [{a: 2}, {b: 3}]})
          .sort({_id: 1})
          .toArray()
      }
      
      query()
      query()
      query()
      query()
      
      for(let i = 0; i < 10000; i++){
          coll.insert({a: 2, b: 3});
      }
      
      query()
      // tassert 8746609 Replanning should not have resulted in a SubPlanner, but it did
      
      Show
      const coll = db.coll; coll.drop(); coll.insert({a: 2, b: 3}); coll.createIndex({a: 1}); coll.createIndex({b: 1}); function query(){ coll .find({$or: [{a: 2}, {b: 3}]}) .sort({_id: 1}) .toArray() } query() query() query() query() for (let i = 0; i < 10000; i++){ coll.insert({a: 2, b: 3}); } query() // tassert 8746609 Replanning should not have resulted in a SubPlanner, but it did
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In SERVER-87466, a refactor to replanning was made to reuse top-level planning logic in case a cached plan was inefficient. Since the old replanning path would never create a subplanner, logic was added to the new path to match this behavior. This keeps behavior consistent and is less risky for 8.3

      As part of SERVER-120958, the logic to prevent a subplanner from being created during replanning may have accidentally been removed. In the repro below, we see that a plan is cached, then replanned when many more documents are inserted, and we reach a tassert because the replanning path created a subplanner

            Assignee:
            Militsa Sotirova
            Reporter:
            Matt Boros
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: