yesodweb / yesodweb/persistent
Resilient ReplicaSet for MongoDB
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I can see that currently we have to provide ReplicaSet Primary instance information to withMongoPool with createRsPool and ReplicaSetConfig. In case of MongoDB cloud installations, time to time, Primary instance can fail, hence secondaries re-elect new leader, in which case current connections will fail because our previous Primary, in best case scenario became a Secondary at best.
What I would like to do is, MongoDB driver already provides Primary function, which, when we provide a ReplicaHost list, it gives back current Primary... use this functionality to dynamically pick Primary, at least if connection error happens through out the pool usage.
If this is the case(I might be missing a functionality to cover this scenario already) and this approach is reasonable, then I can create a pull request with the enhanced functionality.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the withMongoPool, createRsPool, and ReplicaSetConfig entry points, then check how the MongoDB driver's Primary function is currently exposed or used. Trace how connection errors propagate through pool usage and determine the expected behavior after replica-set re-election. Done means the project has a decided, tested approach for selecting the current primary.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, mongodb
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100