StackExchange / StackExchange/StackExchange.Redis
Give chance of reconnecting to another server on failures like LOADING
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.2k
- Forks
- 1.6k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
In scenarios where we have a connection with multiple redis server addresses, or even one address that round-robin between Redis instances (some proxy or load balancer), we should have the chance to switch to a different instance immediately in case we get an exception with LOADING state.
We can safely retry on LOADING status, but not force reconnecting will likely keep returning same error for some time until replication is done.
An example of use case is when we have multiple masters and some of them may restart, causing replicas to return LOADING during the full resync, or while replica is starting.
This change doesn't need to be implicit, especially because it doesn't bring benefit in some setups (let's say you have a single master or replica). If we had a way to easily flag our intent to force reconnect, that could be solved by user code handling exceptions, which IMHO is very acceptable and explicit.
Otherwise, some simple flag "ReconnectOnLoadingResponse" where default is false.
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 locating the StackExchange.Redis code that handles Redis LOADING responses, connection failures, and server selection. Compare the proposed explicit reconnect behavior with the alternative opt-in flag, then identify how the chosen behavior could be verified for multiple addresses, round-robin endpoints, and single-server setups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, redis
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100