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

"explainVersion" field is not provided for explain of find command against a sharded cluster

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization
    • Minor Change
    • QO 2024-02-05

      As part of the work for SERVER-53270, we added a top-level field to explain output called explainVersion. The explain format is a bit different when the slot-based execution engine (SBE) is enabled. Therefore, explains using the classic execution engine report an explainVersion of "1" whereas explains using SBE report an explainVersion of "2". The explainVersion field replaces the queryPlanner.plannerVersion field that was reported in 4.4 and older versions.

      It appears that these changes were never implemented for sharded explain output. Here is the beginning of an explain of a find command run against a sharded cluster:

      [js_test:explain_reformat_sharding] {
      [js_test:explain_reformat_sharding]     "queryPlanner" : {
      [js_test:explain_reformat_sharding]             "mongosPlannerVersion" : 1,
      [js_test:explain_reformat_sharding]             "winningPlan" : {
      [js_test:explain_reformat_sharding]                     "stage" : "SHARD_MERGE",
      [js_test:explain_reformat_sharding]                     "shards" : [
      [js_test:explain_reformat_sharding]                             {
      [js_test:explain_reformat_sharding]                                     "shardName" : "explain_reformat_sharding-rs1",
      [js_test:explain_reformat_sharding]                                     "connectionString" : "explain_reformat_sharding-rs1/storchbox:20021",
      [js_test:explain_reformat_sharding]                                     "serverInfo" : {
      [js_test:explain_reformat_sharding]                                             "host" : "storchbox",
      [js_test:explain_reformat_sharding]                                             "port" : 20021,
      [js_test:explain_reformat_sharding]                                             "version" : "5.0.0-alpha",
      [js_test:explain_reformat_sharding]                                             "gitVersion" : "unknown"
      [js_test:explain_reformat_sharding]                                     },
      [js_test:explain_reformat_sharding]                                     "namespace" : "test.my_coll",
      [js_test:explain_reformat_sharding]                                     "indexFilterSet" : false,
      [js_test:explain_reformat_sharding]                                     "parsedQuery" : {
      [js_test:explain_reformat_sharding]                                             "$and" : [
      [js_test:explain_reformat_sharding]                                                     {
      [js_test:explain_reformat_sharding]                                                             "a" : {
      [js_test:explain_reformat_sharding]                                                                     "$eq" : 1
      [js_test:explain_reformat_sharding]                                                             }
      [js_test:explain_reformat_sharding]                                                     },
      [js_test:explain_reformat_sharding]                                                     {
      [js_test:explain_reformat_sharding]                                                             "b" : {
      [js_test:explain_reformat_sharding]                                                                     "$eq" : 1
      [js_test:explain_reformat_sharding]                                                             }
      [js_test:explain_reformat_sharding]                                                     }
      [js_test:explain_reformat_sharding]                                             ]
      [js_test:explain_reformat_sharding]                                     },
      [js_test:explain_reformat_sharding]                                     "maxIndexedOrSolutionsReached" : false,
      [js_test:explain_reformat_sharding]                                     "maxIndexedAndSolutionsReached" : false,
      [js_test:explain_reformat_sharding]                                     "maxScansToExplodeReached" : false,
      [js_test:explain_reformat_sharding]                                     "winningPlan" : {
      [js_test:explain_reformat_sharding]                                             "queryPlan" : {
      [js_test:explain_reformat_sharding]                                                     "stage" : "SHARDING_FILTER",
      [js_test:explain_reformat_sharding]                                                     "planNodeId" : 3,
      ...
      

      The explainVersion field does not appear anywhere in this output, although there is a queryPlanner.mongosPlannerVersion field which is reported as 1 regardless of whether SBE is being used.

      The work for this ticket is to report explainVersion, and to get rid of the queryPlanner.mongosPlannerVersion field. Since the decision to use SBE vs. classic is made independently by each shard, we might want the explainVersion number to be reported for each shard.

            Assignee:
            matt.olma@mongodb.com Matt Olma
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: