Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
None
-
Minor Change
-
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)
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) |
Attachments
Issue Links
- is documented by
-
DOCS-6243 Update sh.status output to include unique, balancing and active mongoses
-
- Closed
-