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

Explain does not respect maxTimeMS

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0, 3.6.23, 4.0.23, 4.2.13, 4.4.5
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v4.4, v4.2, v4.0, v3.6
    • Query 2020-05-04, Query 2020-05-18

      Per this comment in SERVER-41343, explain is expected to respect a maxTimeMS applied to it.  Testing appears to indicate that this is not the case:

      > db.range.find({z:123}).maxTimeMS(1).explain(1).executionStats
      {
      	"executionSuccess" : true,
      	"nReturned" : 0,
      	"executionTimeMillis" : 433,
      	"totalKeysExamined" : 0,
      	"totalDocsExamined" : 1000000,
      	"executionStages" : {
      		"stage" : "COLLSCAN",
      		"filter" : {
      			"z" : {
      				"$eq" : 123
      			}
      		},
      		"nReturned" : 0,
      		"executionTimeMillisEstimate" : 309,
      		"works" : 1000002,
      		"advanced" : 0,
      		"needTime" : 1000001,
      		"needYield" : 0,
      		"saveState" : 7822,
      		"restoreState" : 7822,
      		"isEOF" : 1,
      		"invalidates" : 0,
      		"direction" : "forward",
      		"docsExamined" : 1000000
      	},
      	"allPlansExecution" : [ ]
      } 

      The operation certainly appears to have yielded thousands of times, which is supposed to allow the interruption to happen based on my understanding.  

      The log file suggests that the parameter itself is getting successfully passed to the server:

      command: explain { explain: { find: "range", filter: { z: 123.0 }, maxTimeMS: 1.0 } 

       

            Assignee:
            andrew.paroski@mongodb.com Drew Paroski
            Reporter:
            christopher.harris@mongodb.com Chris Harris
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: