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

dataSize command parses namespace incorrectly when sharded

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.7
    • Affects Version/s: 3.1.2
    • Component/s: Internal Code, Sharding
    • None
    • Fully Compatible
    • ALL
    • Sharding 8 08/28/15

      On mongod the dateSize command takes as its first argument the fully qualified namespace. To do this it overrides the parseNs method to use parseNsFullyQualified: https://github.com/mongodb/mongo/blob/master/src/mongo/db/dbcommands.cpp#L680.

      Mongos does not do that, so it expects its first argument to be just the collection name part, not including the database name as the mongod side expects.

      This makes this command effectively broken and unusable through mongos:

      > use test
      switched to db test
      > db.runCommand({dataSize:'test.foo'})
      {
      	"code": 13408,
      	"ok": 0,
      	"errmsg": "exception: keyPattern must equal shard key"
      }
      > db.runCommand({dataSize:'foo'})
      {
      	"errmsg": "exception: need a non-empty collection name",
      	"code": 28538,
      	"ok": 0,
      	"$gleStats": {
      		"lastOpTime": Timestamp(0, 0),
      		"electionId": ObjectId("55b904a69035d5fa8adaf55e")
      	}
      }
      

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            james.cohan James Cohan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: