[SERVER-19640] dataSize command parses namespace incorrectly when sharded Created: 28/Jul/15  Updated: 25/Jan/17  Resolved: 19/Aug/15

Status: Closed
Project: Core Server
Component/s: Internal Code, Sharding
Affects Version/s: 3.1.2
Fix Version/s: 3.1.7

Type: Bug Priority: Major - P3
Reporter: James Cohan Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-20029 Add test coverage for dataSize command Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 8 08/28/15
Participants:

 Description   

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")
	}
}



 Comments   
Comment by Githook User [ 19/Aug/15 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@mongodb.com'}

Message: SERVER-19640 Correctly parse namespace in sharded dataSize command
Branch: master
https://github.com/mongodb/mongo/commit/2d8d8c8cceb7af6f886e7f7dbdfbd38bb7cce85a

Comment by Spencer Brody (Inactive) [ 29/Jul/15 ]

Actually nevermind, looks like this was introduced in https://github.com/mongodb/mongo/commit/8e6804d268895c01678a1a3d2feb57a82cafec62

Comment by Spencer Brody (Inactive) [ 29/Jul/15 ]

As far as I can tell this has been broken forever, which makes me think that no one is actually using the dataSize command - perhaps we should just get rid of it?

Generated at Thu Feb 08 03:51:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.