-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 3.1.2
-
Component/s: Diagnostics, Sharding
-
None
-
Fully Compatible
-
ALL
-
Sharding 6 07/17/15
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Commit 4777fb8 from SERVER-18024 changed things so that when a collection is sharded, the entry created in config.collections doesn't have a dropped: false field.
Unfortunately, printShardingStatus explictly checks for dropped == false, which causes it to not show details for such sharded collections:
> db.version()
3.1.2
> sh.enableSharding("test")
{ "ok" : 1 }
> sh.shardCollection("test.test", {_id:1})
{ "collectionsharded" : "test.test", "ok" : 1 }
> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 6,
"currentVersion" : 7,
"clusterId" : ObjectId("556eda937eb9e867d4df9553")
}
shards:
{ "_id" : "shard01", "host" : "genique:31001" }
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "test", "primary" : "shard01", "partitioned" : true }
> db.getSiblingDB("config").collections.find()
{ "_id" : "test.test", "lastmodEpoch" : ObjectId("556edb397eb9e867d4df9578"), "lastmod" : ISODate("1970-02-19T17:02:47.296Z"), "key" : { "_id" : 1 }, "unique" : false }
The fix is simple:
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js
index f0fc76a..46b5877 100644
--- a/src/mongo/shell/shardingtest.js
+++ b/src/mongo/shell/shardingtest.js
@@ -788,7 +788,7 @@ printShardingStatus = function( configDB , verbose ){
configDB.collections.find( { _id : new RegExp( "^" +
RegExp.escape(db._id) + "\\." ) } ).
sort( { _id : 1 } ).forEach( function( coll ){
- if ( coll.dropped == false ){
+ if ( ! coll.dropped ){
output( "\t\t" + coll._id );
output( "\t\t\tshard key: " + tojson(coll.key) );
output( "\t\t\tchunks:" );
Grepping the shell subdirectory for "dropped" shows that this is the only occurrence in the shell JS.
- is related to
-
SERVER-19368 Move print.captureAllOutput from printShardingStatus jstest to utils.js
-
- Closed
-
-
SERVER-19369 Add String.includes() polyfill
-
- Closed
-
- related to
-
SERVER-18024 Move collection metadata manipulation under the catalog manager
-
- Closed
-