-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.3, 2.4, 2.4.1
-
Component/s: None
-
None
Starting in version 2.3, replica set members that are no longer primary or secondary are not removed from the list of available readers. This was accidentally broken by the read preference changes in this commit:
https://github.com/mongodb/mongo-python-driver/commit/f275b2291ab080c111ee99f962cff5f89986bbd5
Specifically this line:
self.__readers is ignored by the current selection code.
Members in state STARTUP2/RECOVERING/etc. are removed from self.__readers in self.__update_pools, but since we no longer use self.__readers these members still receive queries, even after the replica set monitor has run.
Another issue is that the Members class ignores the 'secondary' field of the ismaster response:
One solution would be to keep track of the actual state of the member (primary/secondary/other) in the Member object and remove self.__readers completely since it is only currently used in a property.
- is depended on by
-
PYTHON-454 MongoReplicaSetClient should refresh immediately if we detect a secondary is recovering.
- Closed
- is related to
-
SERVER-7977 query being routed to recovering node when read_preference is secondary
- Closed