You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
In bug report #2769, an issue was identified when handling Redis Cluster topology refreshes during node reconfigurations where nodes temporarily had no assigned slots. The maintainer suggested subclassing RedisClusterClient and overriding determinePartitions to address the issue. I followed the suggestion and initially used redisClusterNode.getSlots().isEmpty() to identify this case. However, I found that getSlots() is quite time-consuming, increasing the overhead of topology refreshes.
Describe the solution you'd like
To improve efficiency, I propose adding a method hasNoSlots() toRedisClusterNode. This method has much better performance than getSlots().isEmpty()
Proposed Method:
/**
* Checks if the node has no slots assigned.
*
* @return {@code true} if the slots field is null or empty, {@code false} otherwise.
*/
public boolean hasNoSlots() {
return slots == null || slots.isEmpty();
}
Describe alternatives you've considered
Currently, the alternative is to use getSlots().isEmpty() to determine if a node has no slots assigned. However, this approach is inefficient because it involves generating a new list object, which adds overhead during topology refreshes.
This feature request aims to improve the efficiency and readability of RedisClusterNode's API, particularly in scenarios involving cluster scaling and topology adjustments. I appreciate your consideration and am happy to make any additional changes or provide further details if needed.
The text was updated successfully, but these errors were encountered:
Feature Request
Is your feature request related to a problem? Please describe
In bug report #2769, an issue was identified when handling Redis Cluster topology refreshes during node reconfigurations where nodes temporarily had no assigned slots. The maintainer suggested subclassing RedisClusterClient and overriding determinePartitions to address the issue. I followed the suggestion and initially used redisClusterNode.getSlots().isEmpty() to identify this case. However, I found that getSlots() is quite time-consuming, increasing the overhead of topology refreshes.
Describe the solution you'd like
To improve efficiency, I propose adding a method
hasNoSlots()
toRedisClusterNode.
This method has much better performance thangetSlots().isEmpty()
Proposed Method:
Describe alternatives you've considered
Currently, the alternative is to use getSlots().isEmpty() to determine if a node has no slots assigned. However, this approach is inefficient because it involves generating a new list object, which adds overhead during topology refreshes.
Teachability, Documentation, Adoption, Migration Strategy
This feature request aims to improve the efficiency and readability of RedisClusterNode's API, particularly in scenarios involving cluster scaling and topology adjustments. I appreciate your consideration and am happy to make any additional changes or provide further details if needed.
The text was updated successfully, but these errors were encountered: