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 20:57:25 UTC

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

upthewaterspout commented on a change in pull request #6117:
URL: https://github.com/apache/geode/pull/6117#discussion_r593443695



##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/data/ByteArrayWrapper.java
##########
@@ -39,6 +45,8 @@
    */
   protected byte[] value;
 
+  private transient Object routingId;

Review comment:
       Do we actually call the PartitionResolver more than once on a value? I wonder if we ought to just compute the routingID in the partition resolver and not bother caching the result. This is taking up extra memory.

##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
##########
@@ -51,4 +67,24 @@ 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 validateBucketCount(int buckets) {
+    if (buckets <= 0 || ((buckets & (buckets - 1)) != 0)) {
+      throw new ManagementException(
+          String.format(
+              "Could not start Redis Server - System property '%s' must be a power of 2. Configured value is invalid: %d",

Review comment:
       Technically, I don't know if we really need to restrict users to powers of two. I think your math will work fine with any number of buckets.

##########
File path: geode-redis/src/test/java/org/apache/geode/redis/internal/executor/cluster/CRC16JUnitTest.java
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.executor.cluster;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+public class CRC16JUnitTest {

Review comment:
       Is this enough for us to feel confident in our implementation? Should we compare our results to Jedis or Lettuce's CRC16 implementation?




----------------------------------------------------------------
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