You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2021/03/16 18:54:54 UTC

[geode] 21/36: Optionally return replica detail in CLUSTER SLOTS

This is an automated email from the ASF dual-hosted git repository.

upthewaterspout pushed a commit to branch feature/redis-performance-testing
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 4c08b5ad51f419a2d37f787dddfd967b74867a8f
Author: Jens Deppe <jd...@vmware.com>
AuthorDate: Thu Mar 4 13:13:45 2021 -0800

    Optionally return replica detail in CLUSTER SLOTS
    
    - The system property redis.cluster-slots-with-replicas=[true/false]
      determines whether CLUSTER SLOTS will contain replica information.
---
 .../geode/redis/internal/cluster/BucketRetrievalFunction.java      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/cluster/BucketRetrievalFunction.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/cluster/BucketRetrievalFunction.java
index 4605d33..7c0d3c6 100644
--- a/geode-redis/src/main/java/org/apache/geode/redis/internal/cluster/BucketRetrievalFunction.java
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/cluster/BucketRetrievalFunction.java
@@ -40,6 +40,8 @@ import org.apache.geode.redis.internal.data.RedisKey;
 public class BucketRetrievalFunction implements InternalFunction<Void> {
 
   public static final String ID = "REDIS_BUCKET_SLOT_FUNCTION";
+  public static final Boolean CLUSTER_SLOTS_WITH_REPLICAS =
+      Boolean.getBoolean("redis.cluster-slots-with-replicas");
   private final String hostAddress;
   private final int redisPort;
 
@@ -78,7 +80,10 @@ public class BucketRetrievalFunction implements InternalFunction<Void> {
           .map(InternalDistributedMember::getId)
           .filter(x -> !x.equals(memberId))
           .collect(Collectors.toList());
-      bucketToSecondaries.put(bucketId, a);
+
+      if (CLUSTER_SLOTS_WITH_REPLICAS) {
+        bucketToSecondaries.put(bucketId, a);
+      }
     }
 
     MemberBuckets mb = new MemberBuckets(memberId, hostAddress, redisPort,