yesodweb / yesodweb/persistent

Resilient ReplicaSet for MongoDB

Open
#836 3 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.