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 2020/06/03 17:59:20 UTC

[GitHub] [geode] dschneider-pivotal commented on a change in pull request #5152: Change Redis Rename Functions to Make use of Striped Executor

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



##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/RenameExecutor.java
##########
@@ -47,47 +35,15 @@ public void executeCommand(Command command, ExecutionHandlerContext context) {
 
     ByteArrayWrapper key = command.getKey();
     ByteArrayWrapper newKey = new ByteArrayWrapper(commandElems.get(2));
+    RedisKeyCommands redisKeyCommands =
+        new RedisKeyCommandsFunctionExecutor(context.getRegionProvider().getDataRegion());

Review comment:
       use AbstractExecutor.getRedisKeyCommands(context) instead

##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/StripedExecutor.java
##########
@@ -35,4 +36,8 @@
    */
   public <T> T execute(Object stripeId,
       Callable<T> callable);
+
+  public boolean areSameStripe(Object object1, Object object2);

Review comment:
       consider getting rid of "areSameStripe" in favor of "compareStripes(o1, o2) == 0".

##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/StripedExecutor.java
##########
@@ -18,10 +18,11 @@
 
 import java.util.concurrent.Callable;
 
+
 /**
  * Allows users to "stripe" their execution in such a way that all tasks belonging to one stripe are
  * executed in-order. A stripe is somehow associated with an Object called the "stripeId".
- * It is upto the implementor of this interface to decide how to do this assocations.
+ * It is up to the implementor of this interface to decide how to do this associations.

Review comment:
       change "this associations" to one of the following "these associations" or "this association".

##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/RenameFunction.java
##########
@@ -0,0 +1,254 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.partition.PartitionRegionHelper;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.LocalDataSet;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.execute.RegionFunctionContextImpl;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.RegionProvider;
+import org.apache.geode.redis.internal.executor.set.RedisSet;
+import org.apache.geode.redis.internal.executor.set.SingleResultCollector;
+import org.apache.geode.redis.internal.executor.set.StripedExecutor;
+
+@SuppressWarnings("unchecked")
+public class RenameFunction implements Function {
+
+  public static final String ID = "REDIS_RENAME_FUNCTION";
+
+  private final transient StripedExecutor stripedExecutor;
+  private final RegionProvider regionProvider;

Review comment:
       get rid of RegionProvider on this function. I think this is left over from when we had multiple regions.




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