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:36 UTC
[geode] 03/36: Add redis COMMAND that returns an empty array
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 4cb90cb94bf5e7ad3a4923fec18e6a361c7e369d
Author: Jens Deppe <jd...@pivotal.io>
AuthorDate: Thu Feb 18 07:21:23 2021 -0800
Add redis COMMAND that returns an empty array
---
.../cluster/RedisPartitionResolverDUnitTest.java | 7 +-----
.../geode/redis/internal/RedisCommandType.java | 3 ++-
.../internal/executor/server/CommandExecutor.java | 28 ++++++++++++++++++++++
.../redis/internal/SupportedCommandsJUnitTest.java | 4 ++--
4 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/cluster/RedisPartitionResolverDUnitTest.java b/geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/cluster/RedisPartitionResolverDUnitTest.java
index e4df831..4c679a2 100644
--- a/geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/cluster/RedisPartitionResolverDUnitTest.java
+++ b/geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/cluster/RedisPartitionResolverDUnitTest.java
@@ -103,13 +103,8 @@ public class RedisPartitionResolverDUnitTest {
}
@Test
+ @SuppressWarnings("unchecked")
public void testClusterSlotsReferencesAllServers() {
- int numKeys = 1000;
- for (int i = 0; i < numKeys; i++) {
- String key = "key-" + i;
- jedis1.set(key, "value-" + i);
- }
-
List<Object> clusterSlots = jedis1.clusterSlots();
assertThat(clusterSlots).hasSize(RegionProvider.REDIS_REGION_BUCKETS);
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
index 74ac471..3e86e94 100755
--- a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
@@ -72,6 +72,7 @@ import org.apache.geode.redis.internal.executor.pubsub.PublishExecutor;
import org.apache.geode.redis.internal.executor.pubsub.PunsubscribeExecutor;
import org.apache.geode.redis.internal.executor.pubsub.SubscribeExecutor;
import org.apache.geode.redis.internal.executor.pubsub.UnsubscribeExecutor;
+import org.apache.geode.redis.internal.executor.server.CommandExecutor;
import org.apache.geode.redis.internal.executor.server.DBSizeExecutor;
import org.apache.geode.redis.internal.executor.server.FlushAllExecutor;
import org.apache.geode.redis.internal.executor.server.InfoExecutor;
@@ -269,6 +270,7 @@ public enum RedisCommandType {
*************** Server ****************
***************************************/
+ COMMAND(new CommandExecutor(), UNSUPPORTED, new ExactParameterRequirements(1)),
DBSIZE(new DBSizeExecutor(), UNSUPPORTED, new ExactParameterRequirements(1)),
FLUSHALL(new FlushAllExecutor(), UNSUPPORTED, new MaximumParameterRequirements(2, ERROR_SYNTAX)),
FLUSHDB(new FlushAllExecutor(), UNSUPPORTED, new MaximumParameterRequirements(2, ERROR_SYNTAX)),
@@ -292,7 +294,6 @@ public enum RedisCommandType {
BZPOPMIN(null, UNIMPLEMENTED),
BZPOPMAX(null, UNIMPLEMENTED),
CLIENT(null, UNIMPLEMENTED),
- COMMAND(null, UNIMPLEMENTED),
CONFIG(null, UNIMPLEMENTED),
DEBUG(null, UNIMPLEMENTED),
DISCARD(null, UNIMPLEMENTED),
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/server/CommandExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/server/CommandExecutor.java
new file mode 100644
index 0000000..2be4af7
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/server/CommandExecutor.java
@@ -0,0 +1,28 @@
+/*
+ * 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.server;
+
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+import org.apache.geode.redis.internal.executor.RedisResponse;
+import org.apache.geode.redis.internal.netty.Command;
+import org.apache.geode.redis.internal.netty.ExecutionHandlerContext;
+
+public class CommandExecutor extends AbstractExecutor {
+ @Override
+ public RedisResponse executeCommand(Command command, ExecutionHandlerContext context) {
+ return RedisResponse.emptyArray();
+ }
+}
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/internal/SupportedCommandsJUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/internal/SupportedCommandsJUnitTest.java
index 19110b6..115babb 100644
--- a/geode-redis/src/test/java/org/apache/geode/redis/internal/SupportedCommandsJUnitTest.java
+++ b/geode-redis/src/test/java/org/apache/geode/redis/internal/SupportedCommandsJUnitTest.java
@@ -84,6 +84,8 @@ public class SupportedCommandsJUnitTest {
"BITCOUNT",
"BITOP",
"BITPOS",
+ "CLUSTER",
+ "COMMAND",
"DBSIZE",
"DECRBY",
"ECHO",
@@ -130,8 +132,6 @@ public class SupportedCommandsJUnitTest {
"BZPOPMIN",
"BZPOPMAX",
"CLIENT",
- "CLUSTER",
- "COMMAND",
"CONFIG",
"DEBUG",
"DISCARD",