[JAVA-535] DB.getCollectionNames() fails when connected to a secondary server even if ReadPreference is SECONDARY Created: 08/Mar/12 Updated: 14/Aug/12 Resolved: 14/May/12 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.8.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Robert Miyashiro | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Description |
|
I want to get the list of collections in my database as reported by a secondary member of my replica set. If I have a Mongo connection to that member, and I set the ReadPreference to secondary, I'm able to successfully make queries and perform other operations, but I cannot call DB.getCollectionNames(). I get the same "not talking to master and retries used up" error that happens when ReadPreference isn't set correctly. The issue appears to be here, where the ReadPreference isn't being used when querying the system.namespaces collection: https://github.com/mongodb/mongo-java-driver/blob/master/src/main/com/mongodb/DB.java#L283 When using slaveOk() instead, this works as expected. My understanding is that setReadPreference(SECONDARY) is supposed to behave the same way. |
| Comments |
| Comment by Jeffrey Yemin [ 18/Jun/12 ] |
|
Closing for 2.8.0 release. |
| Comment by auto [ 14/May/12 ] |
|
Author: {u'login': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: |
| Comment by Jeffrey Yemin [ 14/May/12 ] |
|
This is actually a separate bug from the one it was resolved as a duplicate of, since getCollectionNames is not implemented as a command. |
| Comment by Jeffrey Yemin [ 12/Mar/12 ] |
|
This is the same issue as |
| Comment by Robert Miyashiro [ 08/Mar/12 ] |
|
Yes, a URI that looks like this: mongodb://secondary.foo.com:12345 |
| Comment by Scott Hernandez (Inactive) [ 08/Mar/12 ] |
|
How are you connecting? Just with the single address of a secondary? |
| Comment by Robert Miyashiro [ 08/Mar/12 ] |
|
We're using 2.7.3 |
| Comment by Scott Hernandez (Inactive) [ 08/Mar/12 ] |
|
What version are you using? If you aren't using the latest versoin please do, there was a bug in 2.7.0/1 I believe. |