[SERVER-4874] unrecognized command: setShardVersion Created: 04/Feb/12 Updated: 15/Aug/12 Resolved: 25/May/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 2.0.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Zac Witte | Assignee: | Randolph Tan |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubunutu 11.10 and 11.4, mongodb version 2.0.2 (all of mongod, mongos, and mongo client). Sharded 3 nodes, no replica sets, 3 config servers |
||
| Issue Links: |
|
||||||||
| Operating System: | Linux | ||||||||
| Participants: | |||||||||
| Description |
|
I just set up a brand new shard cluster and received the following error when trying to create an index on a non-sharded collection. I tried the command multiple times and got the same error, but after I restart the mongo client the command worked. ubuntu@mongo1:~/mongodb-linux-x86_64-2.0.2$ bin/mongo ) { "ok" : 0, "errmsg" : "can't add a mongos process as a shard" }mongos> db.adminCommand( {addShard:"mongo1.foobar.com:27018"}) { "shardAdded" : "shard0000", "ok" : 1 }mongos> db.adminCommand( {addShard:"mongo2.foobar.com:27018"}) { "shardAdded" : "shard0001", "ok" : 1 }mongos> db.adminCommand( {addShard:"mongo3.foobar.com:27018"}) { "shardAdded" : "shard0002", "ok" : 1 }mongos> db.adminCommand( {enablesharding:'pb2'}) { "ok" : 1 }mongos> db.adminCommand( {shardcollection:"pb2.hourly_stats"}) { "ok" : 0, "errmsg" : "no shard key" }mongos> db.adminCommand({shardcollection:"pb2.hourly_stats", key:{_id:1}}) { "collectionsharded" : "pb2.hourly_stats", "ok" : 1 }mongos> db.adminCommand({shardcollection:"pb2.aggregated_stats", key:{_id:1}}) { "collectionsharded" : "pb2.aggregated_stats", "ok" : 1 }mongos> show collections ) ", |
| Comments |
| Comment by Randolph Tan [ 25/May/12 ] |
|
The setShardVersion command is triggered when the getLastError command was called. And since the ScopedDBConnection was used to the mongos host when processing addShard, the callback for onCreate gets triggered, which results in the mongos host being added to the getLastError host. This is already fixed in As for the segfault, it was caused by an error in the test script, calling { shardCollection: 'test', ... }instead of { shardCollection: 'test.user', ... }. A separate ticket ( |
| Comment by Randolph Tan [ 24/May/12 ] |
|
Confirmed to be reproducible. The setShardVersion failure happens when trying to register a writebackListener on the other mongos shard (that was passed to the failed addShard command). Needs to investigate further. In 2.1.2, the mongod shard would get a segmentation fault every time even before the procedure is completed. |
| Comment by Eliot Horowitz (Inactive) [ 04/Feb/12 ] |
|
The initial addShard with a mongos is probably being cached somewhere. |