Skip to content

Backport #4692 to 8.0.x: refresh primaryNodesCache in JedisClusterInfoCache.discoverClusterSlots - #4694

Merged
ggivo merged 1 commit into
8.xfrom
backport/8.x/pr-4692
Aug 21, 2026
Merged

ggivo merged 1 commit into
8.xfrom
backport/8.x/pr-4692

Conversation

@ggivo

@ggivo ggivo commented Aug 21, 2026 •

Copy link
Copy Markdown
Collaborator

Clean cherry-pick of ecfed3d (#4692) onto 8.x.

primaryNodesCache was only written by discoverClusterNodesAndSlots at construction; every runtime refresh (MOVED handling, topology-refresh timer, refreshClusterTopology()) goes through discoverClusterSlots, leaving the primary map stale after failover or node replacement. This broke ALL_SHARDS broadcasts, keyless routing and getConnection() (READONLY errors, or No reachable node in cluster after rolling restarts). Regression from #4219, affects 6.2.0+.

Fixes #4691 for the 8.0.x line. JedisClusterInfoCacheTest green locally (5/5), including the new getPrimaryNodesAfterMasterReplicaFailoverOnRenew.


Note

Medium Risk
Touches Redis Cluster topology cache used for routing and broadcasts. The change is small and targeted, but incorrect primary tracking can cause READONLY errors or unreachable-node failures after failover.

Overview
Rebuilds primaryNodesCache during runtime slot rediscovery (discoverClusterSlots), not only on initial discoverClusterNodesAndSlots. After failover or node replacement, MOVED handling, topology refresh, and refreshClusterTopology() now update the primary map instead of leaving it stale.

That keeps getPrimaryNodes() / getShuffledPrimaryNodesPool() aligned with current masters, which is used for ALL_SHARDS broadcasts, keyless routing, and getConnection(). Adds a unit test that simulates master/replica failover via renewClusterSlots.

Reviewed by Cursor Bugbot for commit 4fbcf0b. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Test Results

  206 files  ±0    206 suites  ±0   7m 38s ⏱️ -27s
8 096 tests ±0  7 791 ✅  - 237  305 💤 +237  0 ❌ ±0 
8 116 runs  ±0  7 811 ✅  - 237  305 💤 +237  0 ❌ ±0 

Results for commit 4fbcf0b. ± Comparison against base commit 36135a0.

♻️ This comment has been updated with latest results.

@ggivo
ggivo merged commit 50ec1c8 into 8.x Aug 21, 2026
18 of 20 checks passed
@ggivo ggivo added the bug label Aug 28, 2026
@ggivo ggivo added this to the 8.0.1 milestone Aug 28, 2026
@ggivo
ggivo deleted the backport/8.x/pr-4692 branch September 30, 2026 08:00
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.

2 participants