Skip to content

[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

Open
wants to merge 12 commits into
base: feature/automatic-failover
Choose a base branch
from

Conversation

atakavci
Copy link
Contributor

@atakavci atakavci commented Jul 11, 2025

This PR is based on changes in previous #4189.

Commits essential to this one are;

atakavci added 6 commits June 27, 2025 19:13
- 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
@atakavci atakavci self-assigned this Jul 11, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 to setActiveCluster/iterateActiveCluster using Endpoint keys.
  • Introduce add() and remove() on MultiClusterPooledConnectionProvider 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 {

- 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
@atakavci atakavci force-pushed the ali/aa-failover-addEndpoints branch from 93732b8 to 55adf47 Compare July 16, 2025 05:48
atakavci and others added 4 commits July 16, 2025 12:06
- replace failback enabled with failbacksupported in client
- fix formatting
- set defaults
- fix failing tests
@atakavci atakavci force-pushed the ali/aa-failover-addEndpoints branch from 55adf47 to ddcec73 Compare July 16, 2025 09:09
- fix failing tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant