[CSHARP-118] DropCollection fails with "not master" when SlaveOK is specified in connection string Created: 01/Dec/10 Updated: 02/Apr/15 Resolved: 01/Dec/10 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 0.7 |
| Fix Version/s: | 0.9 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | J W Lee | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
N/A |
||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
When SlaveOk is specified in the connection string, the DropCollection command fails as the driver uses the generic FindOneAs() function to send the command to mongodb. FindOneAs() will pick a slave as it thinks it is a read operation and SlaveOk has been set. Steps to reproduce: 1) Create a mongodb replica set with at least one master and one slave 2) Use a connection string that specifies SlaveOk 3) Execute DropCollection on a database 4) "Not master" exception is thrown Callstack (line numbers may be incorrect): Root cause: |
| Comments |
| Comment by Robert Stam [ 01/Dec/10 ] |
|
Fixed. For now all commands will be routed to the primary (in the future we might figure out which commands must be routed to the primary and which are OK to route to the secondaries). |
| Comment by Robert Stam [ 01/Dec/10 ] |
|
You are right. Even though commands are technically queries many of them involve writes and should be routed to the primary. |