You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/03/12 17:56:08 UTC

[GitHub] [geode] dschneider-pivotal commented on a change in pull request #6117: GEODE-9023: Add sharding support to redis region

dschneider-pivotal commented on a change in pull request #6117:
URL: https://github.com/apache/geode/pull/6117#discussion_r593352417



##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
##########
@@ -51,4 +65,23 @@ public RegionProvider(InternalCache cache) {
   public Region<String, Object> getConfigRegion() {
     return configRegion;
   }
+
+  /**
+   * Validates that the value passed in is a power of 2 and that it is not greater than
+   * {@link #REDIS_SLOTS}
+   *
+   * @throws ManagementException if there is a problem with the value
+   */
+  protected static void validateBuckets(int buckets) {
+    if (buckets <= 0 || ((buckets & (buckets - 1)) != 0)) {
+      throw new ManagementException(
+          "Could not start Redis Server - redis region buckets must be a power of 2. Configured value is invalid: "

Review comment:
       Put the system property name "redis.region.buckets" in a constant and use it in the exception strings instead of "redis region buckets" to help communicate that they set the system property to an illegal value. Some readers of this exception may not be able to tie it back to the system property otherwise.

##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
##########
@@ -51,4 +65,23 @@ public RegionProvider(InternalCache cache) {
   public Region<String, Object> getConfigRegion() {
     return configRegion;
   }
+
+  /**
+   * Validates that the value passed in is a power of 2 and that it is not greater than
+   * {@link #REDIS_SLOTS}
+   *
+   * @throws ManagementException if there is a problem with the value
+   */
+  protected static void validateBuckets(int buckets) {

Review comment:
       the name "validateBuckets" is a little misleading. I thought it was going to validate the actual buckets. Perhaps "validateBucketCount" would be better.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org