[SERVER-3718] Trying to shard a collection succeeds even without a unique index Created: 29/Aug/11 Updated: 11/Jul/16 Resolved: 04/Oct/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 2.1.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Spencer Brody (Inactive) | Assignee: | Greg Studer |
| Resolution: | Done | Votes: | 0 |
| Labels: | indexing, sharding | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Operating System: | ALL | ||||
| Participants: | |||||
| Description |
|
> use sharded > db.system.indexes.find() , "v" : 0 } , "ns" : "sharded.unique", "name" : "id" } , "ns" : "sharded.unique", "name" : "a_1" } Sharding the collection succeeds and creates two non-unique indexes, one on _id and one on the shard key. It should fail, saying that a unique index is necessary. |
| Comments |
| Comment by auto [ 29/Sep/11 ] |
|
Author: {u'login': u'gregstuder', u'name': u'gregs', u'email': u'greg@10gen.com'}Message: better msging / tests when sharding collection with diff types of indexes |
| Comment by Spencer Brody (Inactive) [ 02/Sep/11 ] |
|
After further discussion with Greg, we realized that this is the correct behavior when not using "unique:true" to the shardCollection command. If you use "unique:true" to try to enforce that the shard key be unique, however, then the command should fail if there isn't a usable unique index for the shard key. |
| Comment by auto [ 02/Sep/11 ] |
|
Author: {u'login': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}Message: Update test to reflect desired behavior. |
| Comment by auto [ 30/Aug/11 ] |
|
Author: {u'login': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}Message: Add more tests for |
| Comment by auto [ 29/Aug/11 ] |
|
Author: {u'login': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}Message: Fix sharding index creation tests. Now can catch |