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

Fix invariant failure in IndexScanStage::doRestoreState()

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: Backlog
    • Component/s: Querying
    • Labels:
    • ALL
    • Hide

       

      # Launch mongod:
      ~/mongo/build/install/bin/mongod
      
      # Download the dataset and load it into mongo:
      mkdir ~/bestbuy-dataset
      cd ~/bestbuy-dataset
      wget https://s3-us-west-2.amazonaws.com/dsi-donot-remove/AggPerformance/bestbuyproducts.bson.gz
      mongorestore --gzip --archive=bestbuyproducts.bson.gz
      
      # Run the following commands in the mongo shell:
      > db.adminCommand({setParameter:1, internalQueryEnableSlotBasedExecutionEngine:true});
      > use bestbuy;
      > db.products.find({type: "Music"}).skip(1000).limit(1)
      

       

       

      Show
        # Launch mongod: ~/mongo/build/install/bin/mongod # Download the dataset and load it into mongo: mkdir ~/bestbuy-dataset cd ~/bestbuy-dataset wget https://s3-us-west-2.amazonaws.com/dsi-donot-remove/AggPerformance/bestbuyproducts.bson.gz mongorestore --gzip --archive=bestbuyproducts.bson.gz # Run the following commands in the mongo shell: > db.adminCommand({setParameter:1, internalQueryEnableSlotBasedExecutionEngine:true}); > use bestbuy; > db.products.find({type: "Music"}).skip(1000).limit(1)    
    • Query 2020-11-30

      When I tried to run the "bestbuy_agg_query_comparison.js" benchmark with useAgg=false and with SBE mode enabled, the benchmark failed with mongod crashing due to an invariant failure in IndexScanStage::doRestoreState().

      I've developed a simplified repro - see the "Steps To Reproduce" section.

      The invariant failure is happening on line 133 of "src/mongo/db/exec/sbe/stages/ix_scan.cpp":

      invariant(_opCtx);

      Here is what the call stack looks like when the invariant fails:

       mongo::sbe::IndexScanStage::doRestoreState()
       mongo::sbe::CanChangeState<mongo::sbe::PlanStage>::restoreState()
       mongo::sbe::CanChangeState<mongo::sbe::PlanStage>::restoreState()
       mongo::sbe::CanChangeState<mongo::sbe::PlanStage>::restoreState()
       mongo::PlanYieldPolicySBE::yield(mongo::OperationContext*, std::function<void ()>)
       mongo::PlanYieldPolicy::yieldOrInterrupt(mongo::OperationContext*, std::function<void ()>)
       mongo::sbe::IndexScanStage::getNext()
       mongo::sbe::LoopJoinStage::getNext()
       mongo::sbe::LimitSkipStage::open(bool)
       mongo::sbe::LoopJoinStage::open(bool)
       mongo::sbe::LimitSkipStage::open(bool)
       mongo::sbe::BaseRuntimePlanner::prepareExecutionPlan(mongo::sbe::PlanStage*, mongo::stage_builder::PlanStageData*) const

       

       

      The goal of this task is to investigate why the invariant is failing and fix the underlying issue.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            andrew.paroski@mongodb.com Drew Paroski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: