-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
None
-
Affects Version/s: legacy-1.1.0, legacy-1.1.1
-
Component/s: None
Hi! I am using DBClientReplicaSet to querying a mongodb replicaset, and I found a bug in this class. In my project, I use client connection as a long keep alive connection. And everytime I reuse this client again, I must check this client whether it is ok. So I use func DBClientReplicaSet::isFailed() to check the client whether it is ok or not. But I found it always return true. I check the code below in dbclient_rs.h
virtual bool isFailed() const { return !_master || _master->isFailed(); }
In my project, I always query mongodb with the secondary node using the method DBClientReplicaSet::slaveConn(), so the client did not have the chance to init the _master member.
I think in method isFailed(), not only must we check the _master member, but also the _lastSlaveOkConn member. If one of the two member's status is OK, the method should return true.
If you think it indeed a bug, I will commit a bug fix later.
thanks.