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

Explain does not produce a plan for mongoS-only aggregation pipelines

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7.4
    • Affects Version/s: 3.6.0, 3.7.1
    • Component/s: Aggregation Framework
    • None
    • Fully Compatible
    • ALL
    • v3.6
    • Query 2018-03-12, Query 2018-03-26, Query 2018-04-09

      When an explain is run on a pipeline that must execute entirely on mongoS, the result is an empty cursor batch rather than an explain plan:

      mongos> db.adminCommand({explain: {aggregate: 1, pipeline: [{$listLocalSessions:
      {}}], cursor: {}}})
      {
      	"cursor" : {
      		"firstBatch" : [ ],
      		"id" : NumberLong(0),
      		"ns" : "admin.$cmd.aggregate"
      	},
      	"ok" : 1,
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1519932263, 2),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1519932263, 2)
      }
      

      Instead, the output should be an explain plan indicating that this is a mongoS-only pipeline:

      mongos> db.adminCommand({explain: {aggregate: 1, pipeline: [{$listLocalSessions: {}}], cursor: {}}})
      {
      	"splitPipeline" : null,
      	"mongos" : {
      		"host" : "Bernards-MacBook-Pro-2.local:27017",
      		"stages" : [
      			{
      				"$listLocalSessions" : {
      					"allUsers" : false,
      					"users" : [
      						{
      							"user" : "",
      							"db" : ""
      						}
      					]
      				}
      			}
      		]
      	},
      	"ok" : 1,
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1520430504, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1520430504, 1)
      }
      

            Assignee:
            bernard.gorman@mongodb.com Bernard Gorman
            Reporter:
            bernard.gorman@mongodb.com Bernard Gorman
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: