[JAVA-401] "not master" MongoException when using GridFS with a direction connection to a secondary Created: 26/Jul/11 Updated: 17/Aug/13 Resolved: 18/Jun/13 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | GridFS |
| Affects Version/s: | 2.6.3 |
| Fix Version/s: | 2.11.2, 2.12.0 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | go | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
linux 64, replica set. |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
I got an Exception "not master" when i read from the secondary. |
| Comments |
| Comment by auto [ 18/Jun/13 ] |
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: |
| Comment by auto [ 18/Jun/13 ] |
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: |
| Comment by Scott Hernandez (Inactive) [ 10/Jan/13 ] |
|
Yes, or verify the connection is to a primary/master here: https://github.com/mongodb/mongo-java-driver/blob/master/src/main/com/mongodb/gridfs/GridFS.java#L93 |
| Comment by Jeffrey Yemin [ 28/Apr/12 ] |
|
The workaround for this is to provide a seed list instead of a single server, so that a replica set connection is established. Then call DB.slaveOk() on the gridfs database to ensure reads from secondaries. To fix this, the most straightforward thing to do is to surround the calls to ensureIndex with a try-catch of MongoException, since a failure to create the index is not a failure condition. |
| Comment by Daniel Pasette (Inactive) [ 08/Aug/11 ] |
|
This comes from thread in mongo-user: http://groups.google.com/group/mongodb-user/browse_thread/thread/ec4df92c7c4d1857 |