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/11 21:44:26 UTC

[GitHub] [geode] nonbinaryprogrammer opened a new pull request #6121: GEODE-9022: Support Info Command

nonbinaryprogrammer opened a new pull request #6121:
URL: https://github.com/apache/geode/pull/6121


   - add info command to supported list
   - add unit/integration tests
   - add dunit concurrency test
   
   Thank you for submitting a contribution to Apache Geode.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   - [ ] Does `gradlew build` run cleanly?
   
   - [ ] Have you written or updated unit tests to verify your changes?
   
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   
   ### Note:
   Please ensure that once the PR is submitted, check Concourse for build issues and
   submit an update to your PR as soon as possible. If you need help, please send an
   email to dev@geode.apache.org.
   


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



[GitHub] [geode] nonbinaryprogrammer commented on a change in pull request #6121: GEODE-9022: Support Info Command

Posted by GitBox <gi...@apache.org>.
nonbinaryprogrammer commented on a change in pull request #6121:
URL: https://github.com/apache/geode/pull/6121#discussion_r594499784



##########
File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/InfoDUnitTest.java
##########
@@ -116,7 +114,7 @@ public void testConcurrentInfoFromDifferentServers_doNotStepOnEachOther() {
           int commandsProcessed2 = Integer.valueOf(info2.get(COMMANDS_PROCESSED));
           assertThat(commandsProcessed2).isGreaterThanOrEqualTo(previousCommandsProcessed2.get());
           previousCommandsProcessed2.set(commandsProcessed2);
-        }).runInLockstep();
+        }).run();

Review comment:
       yes, it was, thanks for checking




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



[GitHub] [geode] sabbey37 commented on a change in pull request #6121: GEODE-9022: Support Info Command

Posted by GitBox <gi...@apache.org>.
sabbey37 commented on a change in pull request #6121:
URL: https://github.com/apache/geode/pull/6121#discussion_r593310386



##########
File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractInfoIntegrationTest.java
##########
@@ -134,7 +132,7 @@ public void shouldReturnRedisVersion() {
 
   @Test
   public void shouldReturnTCPPort() {
-    int expectedPort = getExposedPort();
+    int expectedPort = getPort();
     String expectedResult = "tcp_port:" + expectedPort;

Review comment:
       Upon further inspection... I'm wondering if we need both of these tests (this one and `tcpPort_returnsExposedTCPPort()`) ...they seem so similar.




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



[GitHub] [geode] nonbinaryprogrammer merged pull request #6121: GEODE-9022: Support Info Command

Posted by GitBox <gi...@apache.org>.
nonbinaryprogrammer merged pull request #6121:
URL: https://github.com/apache/geode/pull/6121


   


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



[GitHub] [geode] sabbey37 commented on a change in pull request #6121: GEODE-9022: Support Info Command

Posted by GitBox <gi...@apache.org>.
sabbey37 commented on a change in pull request #6121:
URL: https://github.com/apache/geode/pull/6121#discussion_r593468034



##########
File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/InfoDUnitTest.java
##########
@@ -116,7 +114,7 @@ public void testConcurrentInfoFromDifferentServers_doNotStepOnEachOther() {
           int commandsProcessed2 = Integer.valueOf(info2.get(COMMANDS_PROCESSED));
           assertThat(commandsProcessed2).isGreaterThanOrEqualTo(previousCommandsProcessed2.get());
           previousCommandsProcessed2.set(commandsProcessed2);
-        }).runInLockstep();
+        }).run();

Review comment:
       Just wanted to make sure this was intentionally changed.




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



[GitHub] [geode] sabbey37 commented on a change in pull request #6121: GEODE-9022: Support Info Command

Posted by GitBox <gi...@apache.org>.
sabbey37 commented on a change in pull request #6121:
URL: https://github.com/apache/geode/pull/6121#discussion_r593417657



##########
File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/InfoDUnitTest.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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 static org.apache.geode.distributed.ConfigurationProperties.MAX_WAIT_TIME_RECONNECT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import redis.clients.jedis.Jedis;
+
+import org.apache.geode.redis.ConcurrentLoopingThreads;
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+
+public class InfoDUnitTest {
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new RedisClusterStartupRule(4);
+
+  private static final String LOCAL_HOST = "127.0.0.1";
+  private static final int NUM_ITERATIONS = 1000;
+  private static final int JEDIS_TIMEOUT = Math.toIntExact(GeodeAwaitility.getTimeout().toMillis());
+  private static final String COMMANDS_PROCESSED = "total_commands_processed";
+  private static final String REDIS_TCP_PORT = "tcp_port";
+
+  private static Jedis jedis1;
+  private static Jedis jedis2;
+
+  private static Properties locatorProperties;
+
+  private static MemberVM locator;
+  private static MemberVM server1;
+  private static MemberVM server2;
+
+  private static int redisServerPort1;
+  private static int redisServerPort2;
+
+  private static final AtomicInteger numInfoCalled = new AtomicInteger();

Review comment:
       It looks like we increment this in the `getInfo` method, but never use this in the test. Could it be removed? Apologies for noticing this after the initial review.

##########
File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractRedisInfoStatsIntegrationTest.java
##########
@@ -60,9 +61,20 @@
   private static final String NETWORK_KB_READ_OVER_LAST_SECOND = "instantaneous_input_kbps";
   private static final String UPTIME_IN_DAYS = "uptime_in_days";
   private static final String UPTIME_IN_SECONDS = "uptime_in_seconds";
+  private static final String USED_MEMORY = "used_memory";
+  private static final String MEMORY_FRAGMENTATION = "mem_fragmentation_ratio";
+  private static final String TCP_PORT = "tcp_port";
+  private static final String MAX_MEMORY = "maxmemory";
 
   private static final AtomicInteger numInfoCalled = new AtomicInteger(0);
 
+  public int getExposedPort() {
+    return -1; // This must be overridden by implementation classes
+  }
+
+  public void configureMaxMemory(Jedis jedis) throws Exception {
+    throw new Exception("configureMaxMemory must be overridden");
+  }

Review comment:
       Maybe we could declare `configureMaxMemory` abstract as well, like `getExposedPort`

##########
File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractRedisInfoStatsIntegrationTest.java
##########
@@ -60,9 +61,20 @@
   private static final String NETWORK_KB_READ_OVER_LAST_SECOND = "instantaneous_input_kbps";
   private static final String UPTIME_IN_DAYS = "uptime_in_days";
   private static final String UPTIME_IN_SECONDS = "uptime_in_seconds";
+  private static final String USED_MEMORY = "used_memory";
+  private static final String MEMORY_FRAGMENTATION = "mem_fragmentation_ratio";
+  private static final String TCP_PORT = "tcp_port";
+  private static final String MAX_MEMORY = "maxmemory";
 
   private static final AtomicInteger numInfoCalled = new AtomicInteger(0);
 
+  public int getExposedPort() {
+    return -1; // This must be overridden by implementation classes
+  }

Review comment:
       I like the way we used to do this in `AbstractInfoIntegrationTest` (declaring the method abstract so it had to be overridden):
   ```
   abstract int getExposedPort();
   ```




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



[GitHub] [geode] sabbey37 commented on a change in pull request #6121: GEODE-9022: Support Info Command

Posted by GitBox <gi...@apache.org>.
sabbey37 commented on a change in pull request #6121:
URL: https://github.com/apache/geode/pull/6121#discussion_r593280670



##########
File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractInfoIntegrationTest.java
##########
@@ -134,7 +132,7 @@ public void shouldReturnRedisVersion() {
 
   @Test
   public void shouldReturnTCPPort() {
-    int expectedPort = getExposedPort();
+    int expectedPort = getPort();
     String expectedResult = "tcp_port:" + expectedPort;

Review comment:
       I think this needs to be changed back to `getExposedPort()`




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