[JAVA-1867] MongoDatabase.runCommand should never fail server selection with a direct connection Created: 19/Jun/15 Updated: 16/Jul/15 Resolved: 23/Jun/15 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Command Operations |
| Affects Version/s: | 3.0.2 |
| Fix Version/s: | 3.0.3, 3.1.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
Currently the MongoDatabase.runCommand variant that does not take a read preference attempts to select a server that can accept writes (standalone, replica set primary, mongos). But this rules out certain use cases: for example, it will not allow a client to sent a replSetInitiate command to an uninitiated replica set member. The correct behavior is to allow the command to be sent to a server that is directly connected to using the single ServerAddress MongoClient constructor. A workaround until this is fixed is to use the runCommand variant that accepts a read preference:
Thanks to Jeffrey Phillips Freeman for reporting this in https://groups.google.com/forum/#!topic/mongodb-user/Cy8o4iHG6CU. |
| Comments |
| Comment by Jeffrey Yemin [ 16/Jul/15 ] |
|
Fix is now available in the 3.0.3 release. |
| Comment by Githook User [ 23/Jun/15 ] |
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: Changed the runCommand methods in MongoDatabase that don't take a ReadPreference to use ReadPreference.primary() instead of treating the command as a write operation. |
| Comment by Githook User [ 23/Jun/15 ] |
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: Changed the runCommand methods in MongoDatabase that don't take a ReadPreference to use ReadPreference.primary() instead of treating the command as a write operation. |