Repository navigation
Backport #4692 to 8.0.x: refresh primaryNodesCache in JedisClusterInfoCache.discoverClusterSlots - #4694
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean cherry-pick of ecfed3d (#4692) onto
8.x.primaryNodesCachewas only written bydiscoverClusterNodesAndSlotsat construction; every runtime refresh (MOVEDhandling, topology-refresh timer,refreshClusterTopology()) goes throughdiscoverClusterSlots, leaving the primary map stale after failover or node replacement. This brokeALL_SHARDSbroadcasts, keyless routing andgetConnection()(READONLY errors, orNo reachable node in clusterafter rolling restarts). Regression from #4219, affects 6.2.0+.Fixes #4691 for the 8.0.x line.
JedisClusterInfoCacheTestgreen locally (5/5), including the newgetPrimaryNodesAfterMasterReplicaFailoverOnRenew.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
primaryNodesCacheduring runtime slot rediscovery (discoverClusterSlots), not only on initialdiscoverClusterNodesAndSlots. After failover or node replacement,MOVEDhandling, topology refresh, andrefreshClusterTopology()now update the primary map instead of leaving it stale.That keeps
getPrimaryNodes()/getShuffledPrimaryNodesPool()aligned with current masters, which is used forALL_SHARDSbroadcasts, keyless routing, andgetConnection(). Adds a unit test that simulates master/replica failover viarenewClusterSlots.Reviewed by Cursor Bugbot for commit 4fbcf0b. Bugbot is set up for automated code reviews on this repo. Configure here.