Allow RF greater than number of zones to select more than one instance per zone #5411
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.
What this PR does:
ring.Get
that should return n (or more) instances which form the replicas for the given key uses the following configs:ring.cfg.ReplicationFactor
to control how many replicas you would like to use per keyring.cfg.ZoneAwarenessEnabled
to allow replicas to be across the zones evenlyProblem is, when
ZoneAwarenessEnabled
is enabled andReplicationFactor
is greater than number of available zones, the function was silently ignoring the ReplicationFactor and returned only one instance from each zone:cortex/pkg/ring/ring.go
Lines 376 to 380 in a307fc0
RF doesn't need to be bound to number of zones, and the following scenario is valid as well:
This PR fixes the function to be able to return max
ceil(RF/len(zones))
number of instances per zone. For instance, numOfZones = 3 and RF = 4 will return 4 instances, and each zone will have either 1 or 2 instances returned.Which issue(s) this PR fixes:
n/a
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]