[SERVER-18820] printShardingStatus/sh.status should indicate if optional config.collections fields are enabled Created: 04/Jun/15  Updated: 03/Apr/19  Resolved: 20/Sep/15

Status: Closed
Project: Core Server
Component/s: Diagnostics, Sharding
Affects Version/s: None
Fix Version/s: 3.1.9

Type: Improvement Priority: Major - P3
Reporter: Kevin Pulo Assignee: Kevin Pulo
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-6243 Update sh.status output to include un... Closed
Backwards Compatibility: Minor Change
Sprint: Sharding 6 07/17/15, Sharding 7 08/10/15, Sharding 8 08/28/15, Sharding 9 (09/18/15), Sharding A (10/09/15)
Participants:

 Description   

Specifically, unique: true/false and noBalance: true/false.

Setup:

> sh.enableSharding("test")
{ "ok" : 1 }
> sh.shardCollection("test.test1", {_id:1})
{ "collectionsharded" : "test.test1", "ok" : 1 }
> sh.shardCollection("test.test2", {_id:1})
{ "collectionsharded" : "test.test2", "ok" : 1 }
> sh.shardCollection("test.test3", {_id:1}, {unique: true})
{ "collectionsharded" : "test.test3", "ok" : 1 }
> sh.shardCollection("test.test4", {_id:1}, {unique: true})
{ "collectionsharded" : "test.test4", "ok" : 1 }
> sh.disableBalancing("test.test2")
> sh.disableBalancing("test.test4")

Creates collections with quite different properties:

> db.getSiblingDB("config").collections.find()
{ "_id" : "test.test1", "lastmod" : ISODate("2015-06-04T00:10:08.577Z"), "dropped" : false, "key" : { "_id" : 1 }, "unique" : false, "lastmodEpoch" : ObjectId("556f97605efa42f9f4eaede6") }
{ "_id" : "test.test3", "lastmod" : ISODate("2015-06-04T00:10:23.618Z"), "dropped" : false, "key" : { "_id" : 1 }, "unique" : true, "lastmodEpoch" : ObjectId("556f976f5efa42f9f4eaedf0") }
{ "_id" : "test.test2", "lastmod" : ISODate("2015-06-04T00:10:13.891Z"), "dropped" : false, "key" : { "_id" : 1 }, "unique" : false, "lastmodEpoch" : ObjectId("556f97655efa42f9f4eaedeb"), "noBalance" : true }
{ "_id" : "test.test4", "lastmod" : ISODate("2015-06-04T00:10:26.685Z"), "dropped" : false, "key" : { "_id" : 1 }, "unique" : true, "lastmodEpoch" : ObjectId("556f97725efa42f9f4eaedf3"), "noBalance" : true }

Yet sh.status() shows collections that look basically the same:

> sh.status()
--- Sharding Status ---
  sharding version: {
        "_id" : 1,
        "minCompatibleVersion" : 6,
        "currentVersion" : 7,
        "clusterId" : ObjectId("556f97135efa42f9f4eaedd1")
}
  shards:
        {  "_id" : "shard01",  "host" : "genique:11112" }
  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" : "admin",  "primary" : "config",  "partitioned" : false }
        {  "_id" : "config",  "primary" : "config",  "partitioned" : false }
        {  "_id" : "test",  "primary" : "shard01",  "partitioned" : true }
                test.test1
                        shard key: { "_id" : 1 }
                        chunks:
                                shard01 1
                        { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)
                test.test2
                        shard key: { "_id" : 1 }
                        chunks:
                                shard01 1
                        { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)
                test.test3
                        shard key: { "_id" : 1 }
                        chunks:
                                shard01 1
                        { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)
                test.test4
                        shard key: { "_id" : 1 }
                        chunks:
                                shard01 1
                        { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)

Desired output is something like:

   databases:
         {  "_id" : "admin",  "primary" : "config",  "partitioned" : false }
         {  "_id" : "config",  "primary" : "config",  "partitioned" : false }
         {  "_id" : "test",  "primary" : "shard01",  "partitioned" : true }
                 test.test1
                         shard key: { "_id" : 1 }
                         chunks:
                                 shard01 1
                         { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)
                 test.test2
                         shard key: { "_id" : 1 }
+                        unique: true
                         chunks:
                                 shard01 1
                         { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)
                 test.test3
                         shard key: { "_id" : 1 }
+                        balancing: false
                         chunks:
                                 shard01 1
                         { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)
                 test.test4
                         shard key: { "_id" : 1 }
+                        unique: true
+                        balancing: false
                         chunks:
                                 shard01 1
                         { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)



 Comments   
Comment by Kevin Pulo [ 20/Sep/15 ]

Author:

{u'username': u'devkev', u'name': u'Kevin Pulo', u'email': u'kevin.pulo@mongodb.com'}

Message: SERVER-18820: make printShardingStatus/sh.status show optional collection fields
Branch: master
https://github.com/mongodb/mongo/commit/0706f11c0370a67935dfa9acec0f8a4740dbf2cb

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