-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[automatic failover] Implement add/remove endpoints #4200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/automatic-failover
Are you sure you want to change the base?
[automatic failover] Implement add/remove endpoints #4200
Conversation
- Healtstatus manager with initial listener and registration logic - pluggable health checker strategy introduced, these are draft NoOpStrategy, EchoStrategy, LagAwareStrategy, - fix failing tests impacted from weighted clusters
- add echo ot CommandObjects and UnifiedJEdis - improve StrategySupplier by accepting jedisclientconfig - adapt EchoStrategy to StrategySupplier. Now it handles the creation of connection by accepting endpoint and JedisClientConfig - make healthchecks disabled by default - drop noOpStrategy - add unit&integration tests for health check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the multi-cluster failover provider to support dynamic addition and removal of endpoints, replaces the integer-based cluster index API with an Endpoint-based API, and wires in health‐check strategies with weighted failover.
- Switch from
activeMultiClusterIndex
tosetActiveCluster
/iterateActiveCluster
usingEndpoint
keys. - Introduce
add()
andremove()
onMultiClusterPooledConnectionProvider
with health checks and weighted selection. - Update existing tests to use the new API and add coverage for dynamic endpoint management.
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
src/main/java/redis/clients/jedis/providers/MultiClusterPooledConnectionProvider.java | Core provider: added add /remove , replaced index-based API, integrated health checks and weighted logic |
src/main/java/redis/clients/jedis/mcf/HealthCheck.java | New scheduled health‐check task and listener notification |
src/main/java/redis/clients/jedis/mcf/HealthStatusManager.java | Manages registration and notification of health‐status listeners |
src/main/java/redis/clients/jedis/mcf/FailoverOptions.java | Builder for retry, weight, failback, and health‐check strategy options |
src/main/java/redis/clients/jedis/mcf/EchoStrategy.java | Default HealthCheckStrategy using Redis ECHO |
src/main/java/redis/clients/jedis/mcf/LagAwareStrategy.java | New strategy querying a REST API for DB availability |
src/main/java/redis/clients/jedis/mcf/RedisRestAPIHelper.java | Helper for calling external REST endpoints |
src/main/java/redis/clients/jedis/mcf/Endpoint.java | Interface abstraction for host/port endpoints |
src/main/java/redis/clients/jedis/UnifiedJedis.java | Removed deprecated constructor, added echo command |
src/main/java/redis/clients/jedis/CommandObjects.java | Added command object for echo |
src/test/java/redis/clients/jedis/** | Updated tests to use iterateActiveCluster , setActiveCluster , and added dynamic endpoint tests |
Comments suppressed due to low confidence (1)
src/main/java/redis/clients/jedis/mcf/RedisRestAPIHelper.java:36
- [nitpick] Public method
getBdbs
is missing Javadoc describing its behavior, expected response format, and error conditions. Consider adding a brief comment.
public List<String> getBdbs() throws IOException {
src/main/java/redis/clients/jedis/providers/MultiClusterPooledConnectionProvider.java
Show resolved
Hide resolved
- clear redundant catch - replace failover options and drop failoveroptions class - remove forced_unhealthy from healthstatus - fix failback check - add disabled flag to cluster - update/fix related tests
93732b8
to
55adf47
Compare
Co-authored-by: Copilot <[email protected]>
- replace failback enabled with failbacksupported in client - fix formatting - set defaults
- fix failing tests
55adf47
to
ddcec73
Compare
- fix failing tests
This PR is based on changes in previous #4189.
Commits essential to this one are;
- add remove endpoints
- replace cluster disabled with failbackCandidate
- remove failback candidate
- fix remove logic