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

Running aggregation query with $explain in mixed setup causes assertion error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.5.5
    • 2.6.0-rc0
    • Sharding
    • ALL
    • Hide

      Using: mongod 2.4, mongod 2.5.6-pre, mongoS 2.5.6-pre
      With a sharded collection (I used a hashed _id shard key)
      Run an aggregation command with $explain

      In the shell run:

      db.runCommand({ "aggregate" : "<sharded_collection>" , "pipeline" : [ { "$project" : { "a" : 1 }} ] , "explain" : true})
      {
          "splitPipeline" : {
              "shardsPart" : [
                  {
                      "$project" : {
                          "a" : true
                      }
                  }
              ],
              "mergerPart" : [ ]
          },
          "shards" : {
              "shard0000" : {
                  "host" : "precise64:27020",
                  "stages" : [
                      {
                          "$cursor" : {
                              "query" : {
       
                              },
                              "fields" : {
                                  "a" : 1,
                                  "_id" : 1
                              },
                              "plan" : {
                                  "cursor" : "BasicCursor",
                                  "isMultiKey" : false,
                                  "scanAndOrder" : false,
                                  "allPlans" : [
                                      {
                                          "cursor" : "BasicCursor",
                                          "isMultiKey" : false,
                                          "scanAndOrder" : false
                                      }
                                  ]
                              }
                          }
                      },
                      {
                          "$project" : {
                              "a" : true
                          }
                      }
                  ]
              }
          },
          "code" : 0,
          "ok" : 0,
          "errmsg" : "exception: assertion src/mongo/bson/bsonobjbuilder.h:93"
      }

      The mongos logs:

      014-02-18T12:59:46.835+0000 [conn1] pcursor finished on shard shard0001:precise64:27021, current connection state is { state: { conn: "(done)", vinfo: "mongo-java-driver-test.TEST @ 2|5||530354304b162de78a5666d2", cursor: { ok: 0.0, errmsg: "unrecognized field "cursor" }, count: 0, done: false }, retryNext: false, init: true, finish: true, errored: false }
      2014-02-18T12:59:46.836+0000 [conn1] Assertion failure !e.eoo() src/mongo/bson/bsonobjbuilder.h 93
      2014-02-18T12:59:46.839+0000 [conn1] 0xd61551 0xd0d089 0xcee7be 0x6d7811 0xb4fca9 0xc03fba 0xb4a18c 0xc28783 0xc01ccb 0x6dab41 0xd17fbb 0x7f2dedf31e9a 0x7f2ded244ccd
       ./bin/mongos(_ZN5mongo15printStackTraceERSo+0x21) [0xd61551]
       ./bin/mongos(_ZN5mongo10logContextEPKc+0x159) [0xd0d089]
       ./bin/mongos(_ZN5mongo12verifyFailedEPKcS1_j+0x17e) [0xcee7be]
       ./bin/mongos() [0x6d7811]
       ./bin/mongos(_ZN5mongo15dbgrid_pub_cmds15PipelineCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x1329) [0xb4fca9]
       ./bin/mongos(_ZN5mongo7Command22execCommandClientBasicEPS0_RNS_11ClientBasicEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0x2ba) [0xc03fba]
       ./bin/mongos(_ZN5mongo7Command20runAgainstRegisteredEPKcRNS_7BSONObjERNS_14BSONObjBuilderEi+0x32c) [0xb4a18c]
       ./bin/mongos(_ZN5mongo8Strategy15clientCommandOpERNS_7RequestE+0x303) [0xc28783]
       ./bin/mongos(_ZN5mongo7Request7processEi+0x6ab) [0xc01ccb]
       ./bin/mongos(_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x71) [0x6dab41]
       ./bin/mongos(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x4fb) [0xd17fbb]
       /lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a) [0x7f2dedf31e9a]
       /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2ded244ccd]

      Show
      Using: mongod 2.4, mongod 2.5.6-pre, mongoS 2.5.6-pre With a sharded collection (I used a hashed _id shard key) Run an aggregation command with $explain In the shell run: db.runCommand({ "aggregate" : "<sharded_collection>" , "pipeline" : [ { "$project" : { "a" : 1 }} ] , "explain" : true}) { "splitPipeline" : { "shardsPart" : [ { "$project" : { "a" : true } } ], "mergerPart" : [ ] }, "shards" : { "shard0000" : { "host" : "precise64:27020", "stages" : [ { "$cursor" : { "query" : {   }, "fields" : { "a" : 1, "_id" : 1 }, "plan" : { "cursor" : "BasicCursor", "isMultiKey" : false, "scanAndOrder" : false, "allPlans" : [ { "cursor" : "BasicCursor", "isMultiKey" : false, "scanAndOrder" : false } ] } } }, { "$project" : { "a" : true } } ] } }, "code" : 0, "ok" : 0, "errmsg" : "exception: assertion src/mongo/bson/bsonobjbuilder.h:93" } The mongos logs: 014-02-18T12:59:46.835+0000 [conn1] pcursor finished on shard shard0001:precise64:27021, current connection state is { state: { conn: "(done)", vinfo: "mongo-java-driver-test.TEST @ 2|5||530354304b162de78a5666d2", cursor: { ok: 0.0, errmsg: "unrecognized field "cursor" }, count: 0, done: false }, retryNext: false, init: true, finish: true, errored: false } 2014-02-18T12:59:46.836+0000 [conn1] Assertion failure !e.eoo() src/mongo/bson/bsonobjbuilder.h 93 2014-02-18T12:59:46.839+0000 [conn1] 0xd61551 0xd0d089 0xcee7be 0x6d7811 0xb4fca9 0xc03fba 0xb4a18c 0xc28783 0xc01ccb 0x6dab41 0xd17fbb 0x7f2dedf31e9a 0x7f2ded244ccd ./bin/mongos(_ZN5mongo15printStackTraceERSo+0x21) [0xd61551] ./bin/mongos(_ZN5mongo10logContextEPKc+0x159) [0xd0d089] ./bin/mongos(_ZN5mongo12verifyFailedEPKcS1_j+0x17e) [0xcee7be] ./bin/mongos() [0x6d7811] ./bin/mongos(_ZN5mongo15dbgrid_pub_cmds15PipelineCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x1329) [0xb4fca9] ./bin/mongos(_ZN5mongo7Command22execCommandClientBasicEPS0_RNS_11ClientBasicEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0x2ba) [0xc03fba] ./bin/mongos(_ZN5mongo7Command20runAgainstRegisteredEPKcRNS_7BSONObjERNS_14BSONObjBuilderEi+0x32c) [0xb4a18c] ./bin/mongos(_ZN5mongo8Strategy15clientCommandOpERNS_7RequestE+0x303) [0xc28783] ./bin/mongos(_ZN5mongo7Request7processEi+0x6ab) [0xc01ccb] ./bin/mongos(_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x71) [0x6dab41] ./bin/mongos(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x4fb) [0xd17fbb] /lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a) [0x7f2dedf31e9a] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2ded244ccd]

    Description

      When using $explain in a mixed cluster I get a exception: assertion src/mongo/bson/bsonobjbuilder.h:93 in the returned object and the logs don't look healthy.

      However, when running with cursor which also isn't supported in 2.4 I get a nice error message:

      db.runCommand({ "aggregate" : "<sharded_collection>" , "pipeline" : [ { "$project" : { "a" : 1 }} ] , "cursor" : { }})
      {
          "code" : 17020,
          "ok" : 0,
          "errmsg" : "exception: All shards must support cursors to get a cursor back from aggregation"
      }

      Attachments

        Issue Links

          Activity

            People

              mathias@mongodb.com Mathias Stearn
              ross@mongodb.com Ross Lawley
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: