-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.11.2
-
Component/s: API, Cluster Management
-
None
-
(copied to CRM)
When a replica set primary is failing and primary reads and writes are performed, a MongoException is thrown. For example:
Caused by: com.mongodb.MongoException: ReplicaSetMonitor no master found for set: XXXX
at com.mongodb.MongoException.parse(MongoException.java:82) ~[mongo-java-driver-2.11.2.jar:na]
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:292) ~[mongo-java-driver-2.11.2.jar:na]
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:273) ~[mongo-java-driver-2.11.2.jar:na]
at com.mongodb.DBCursor._check(DBCursor.java:368) ~[mongo-java-driver-2.11.2.jar:na]
at com.mongodb.DBCursor._hasNext(DBCursor.java:459) ~[mongo-java-driver-2.11.2.jar:na]
at com.mongodb.DBCursor.hasNext(DBCursor.java:484) ~[mongo-java-driver-2.11.2.jar:na]
at com.google.code.morphia.query.MorphiaIterator.hasNext(MorphiaIterator.java:43) ~[morphia-0.103.jar:na]
at com.google.code.morphia.query.QueryImpl.get(QueryImpl.java:416) ~[morphia-0.103.jar:na]
The only way to determine the true cause is to inspect the Exeption's message field. Ideally, we should be able to recognize this exception from its type without having to inspect/pattern match against the Exception's message field.
For example, there could be a new Exception
PrimaryNotFound extends MongoException
that is only thrown in this situation.
- related to
-
SERVER-13660 Better Error Response from Shard with No Primary
- Closed