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/11/20 16:01:24 UTC

[GitHub] [geode] ringles opened a new pull request #5767: GEODE-8717: INFO command returns specified sections

ringles opened a new pull request #5767:
URL: https://github.com/apache/geode/pull/5767


   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:
   - [ X] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
   
   - [ X] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
   
   - [ X] Is your initial contribution a single, squashed commit?
   
   - [ X] 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] kohlmu-pivotal commented on a change in pull request #5767: GEODE-8717: INFO command returns specified sections

Posted by GitBox <gi...@apache.org>.
kohlmu-pivotal commented on a change in pull request #5767:
URL: https://github.com/apache/geode/pull/5767#discussion_r528011451



##########
File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractInfoIntegrationTest.java
##########
@@ -39,6 +44,71 @@
   private static final int REDIS_CLIENT_TIMEOUT =
       Math.toIntExact(GeodeAwaitility.getTimeout().toMillis());
 
+  final List<String> SERVER_PROPERTIES =
+      Arrays.asList(
+          "# Server",
+          "redis_version:",
+          "redis_mode:",
+          "tcp_port:",
+          "uptime_in_days:",
+          "uptime_in_seconds:");
+
+  final List<String> PERSISTENCE_PROPERTIES =
+      Arrays.asList(
+          "# Persistence",
+          "rdb_changes_since_last_save",
+          "rdb_last_save_time",
+          "loading:");
+
+  final List<String> REPLICATION_PROPERTIES =
+      Arrays.asList(
+          "# Replication",
+          "role:",
+          "connected_slaves:");
+
+  final List<String> CLUSTER_PROPERTIES =
+      Arrays.asList(
+          "# Cluster",
+          "cluster_enabled:");
+
+  final List<String> CLIENTS_PROPERTIES =
+      Arrays.asList(
+          "# Clients",
+          "connected_clients:",
+          "blocked_clients:");
+
+  final List<String> MEMORY_PROPERTIES =
+      Arrays.asList(
+          "# Memory",
+          "used_memory:",
+          "mem_fragmentation_ratio:");
+
+  final List<String> KEYSPACE_PROPERTIES =
+      Arrays.asList(
+          "# Keyspace",
+          "db0:");
+
+  final List<String> STATS_PROPERTIES =
+      Arrays.asList(
+          "# Stats",
+          "total_commands_processed:",
+          "instantaneous_ops_per_sec:",
+          "total_net_input_bytes:",
+          "instantaneous_input_kbps:",
+          "total_connections_received:",
+          "keyspace_hits:",
+          "keyspace_misses:",
+          "evicted_keys:",
+          "rejected_connections:");
+
+
+  final List<String> ALL_PROPERTIES =
+      Stream.of(SERVER_PROPERTIES, PERSISTENCE_PROPERTIES, CLUSTER_PROPERTIES,
+          MEMORY_PROPERTIES, CLIENTS_PROPERTIES, STATS_PROPERTIES, REPLICATION_PROPERTIES)
+          .flatMap(Collection::stream)
+          .collect(
+              Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));

Review comment:
       Wow... this seems so hard compared to `list.addAll`




----------------------------------------------------------------
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] jdeppe-pivotal commented on a change in pull request #5767: GEODE-8717: INFO command returns specified sections

Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #5767:
URL: https://github.com/apache/geode/pull/5767#discussion_r527844246



##########
File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractInfoIntegrationTest.java
##########
@@ -98,71 +165,115 @@ public void shouldReturnClusterEnabledProperty() {
     assertThat(actualResult).contains(expectedResult);
   }
 
-  final List<String> SERVER_PROPERTIES =
-      Arrays.asList(
-          "# Server",
-          "redis_version:",
-          "tcp_port:",
-          "redis_mode:");
-
-  final List<String> PERSISTENCE_PROPERTIES =
-      Arrays.asList(
-          "# Persistence",
-          "loading:");
-
-  final List<String> CLUSTER_PROPERTIES =
-      Arrays.asList(
-          "# Cluster",
-          "cluster_enabled:");
-
   @Test
-  public void shouldReturnServerSectionsGivenServerSectionParameter() {
+  public void shouldReturnServerSections_givenServerSectionParameter() {
+    List<String> nonServerProperties = ALL_PROPERTIES;
+    nonServerProperties.removeAll(SERVER_PROPERTIES);
+
     String actualResult = jedis.info("server");
 
     assertThat(actualResult).contains(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(CLUSTER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(PERSISTENCE_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonServerProperties);
   }
 
   @Test
-  public void shouldReturnClusterSectionsGivenClusterSectionParameter() {
+  public void shouldReturnClusterSections_givenClusterSectionParameter() {
+    List<String> nonClusterProperties = ALL_PROPERTIES;
+    nonClusterProperties.removeAll(CLUSTER_PROPERTIES);
+
     String actualResult = jedis.info("cluster");
 
     assertThat(actualResult).contains(CLUSTER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(PERSISTENCE_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonClusterProperties);
   }
 
   @Test
-  public void shouldReturnPersistenceSectionsGivenPersistenceSectionParameter() {
+  public void shouldReturnPersistenceSections_givenPersistenceSectionParameter() {
+    List<String> nonPersistenceProperties = ALL_PROPERTIES;
+    nonPersistenceProperties.removeAll(PERSISTENCE_PROPERTIES);
+
     String actualResult = jedis.info("persistence");
 
     assertThat(actualResult).contains(PERSISTENCE_PROPERTIES);
-    assertThat(actualResult).doesNotContain(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(CLUSTER_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonPersistenceProperties);
+  }
+
+  @Test
+  public void shouldReturnStatsSections_givenStatsSectionParameter() {
+    List<String> nonStatsProperties = ALL_PROPERTIES;
+    nonStatsProperties.removeAll(STATS_PROPERTIES);

Review comment:
       This is going to also modify `ALL_PROPERTIES` since `nonStatsProperties` is just a reference. I'd suggest making `ALL_PROPERTIES` immutable with something like
   ```
   .collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
   ```
   and then it would be evident that you need to make a copy here and other places where this is happening.




----------------------------------------------------------------
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] jdeppe-pivotal commented on a change in pull request #5767: GEODE-8717: INFO command returns specified sections

Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #5767:
URL: https://github.com/apache/geode/pull/5767#discussion_r527844246



##########
File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractInfoIntegrationTest.java
##########
@@ -98,71 +165,115 @@ public void shouldReturnClusterEnabledProperty() {
     assertThat(actualResult).contains(expectedResult);
   }
 
-  final List<String> SERVER_PROPERTIES =
-      Arrays.asList(
-          "# Server",
-          "redis_version:",
-          "tcp_port:",
-          "redis_mode:");
-
-  final List<String> PERSISTENCE_PROPERTIES =
-      Arrays.asList(
-          "# Persistence",
-          "loading:");
-
-  final List<String> CLUSTER_PROPERTIES =
-      Arrays.asList(
-          "# Cluster",
-          "cluster_enabled:");
-
   @Test
-  public void shouldReturnServerSectionsGivenServerSectionParameter() {
+  public void shouldReturnServerSections_givenServerSectionParameter() {
+    List<String> nonServerProperties = ALL_PROPERTIES;
+    nonServerProperties.removeAll(SERVER_PROPERTIES);
+
     String actualResult = jedis.info("server");
 
     assertThat(actualResult).contains(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(CLUSTER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(PERSISTENCE_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonServerProperties);
   }
 
   @Test
-  public void shouldReturnClusterSectionsGivenClusterSectionParameter() {
+  public void shouldReturnClusterSections_givenClusterSectionParameter() {
+    List<String> nonClusterProperties = ALL_PROPERTIES;
+    nonClusterProperties.removeAll(CLUSTER_PROPERTIES);
+
     String actualResult = jedis.info("cluster");
 
     assertThat(actualResult).contains(CLUSTER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(PERSISTENCE_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonClusterProperties);
   }
 
   @Test
-  public void shouldReturnPersistenceSectionsGivenPersistenceSectionParameter() {
+  public void shouldReturnPersistenceSections_givenPersistenceSectionParameter() {
+    List<String> nonPersistenceProperties = ALL_PROPERTIES;
+    nonPersistenceProperties.removeAll(PERSISTENCE_PROPERTIES);
+
     String actualResult = jedis.info("persistence");
 
     assertThat(actualResult).contains(PERSISTENCE_PROPERTIES);
-    assertThat(actualResult).doesNotContain(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(CLUSTER_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonPersistenceProperties);
+  }
+
+  @Test
+  public void shouldReturnStatsSections_givenStatsSectionParameter() {
+    List<String> nonStatsProperties = ALL_PROPERTIES;
+    nonStatsProperties.removeAll(STATS_PROPERTIES);

Review comment:
       This is going to also modify `ALL_PROPERTIES` since `nonStatsProperties` is just a reference. I'd suggest making `ALL_PROPERTIES` immuntable with something like
   ```
   .collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
   ```
   and then it would be evident that you need to make a copy here and other places where this is happening.




----------------------------------------------------------------
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] ringles commented on a change in pull request #5767: GEODE-8717: INFO command returns specified sections

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



##########
File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractInfoIntegrationTest.java
##########
@@ -98,71 +165,115 @@ public void shouldReturnClusterEnabledProperty() {
     assertThat(actualResult).contains(expectedResult);
   }
 
-  final List<String> SERVER_PROPERTIES =
-      Arrays.asList(
-          "# Server",
-          "redis_version:",
-          "tcp_port:",
-          "redis_mode:");
-
-  final List<String> PERSISTENCE_PROPERTIES =
-      Arrays.asList(
-          "# Persistence",
-          "loading:");
-
-  final List<String> CLUSTER_PROPERTIES =
-      Arrays.asList(
-          "# Cluster",
-          "cluster_enabled:");
-
   @Test
-  public void shouldReturnServerSectionsGivenServerSectionParameter() {
+  public void shouldReturnServerSections_givenServerSectionParameter() {
+    List<String> nonServerProperties = ALL_PROPERTIES;
+    nonServerProperties.removeAll(SERVER_PROPERTIES);
+
     String actualResult = jedis.info("server");
 
     assertThat(actualResult).contains(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(CLUSTER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(PERSISTENCE_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonServerProperties);
   }
 
   @Test
-  public void shouldReturnClusterSectionsGivenClusterSectionParameter() {
+  public void shouldReturnClusterSections_givenClusterSectionParameter() {
+    List<String> nonClusterProperties = ALL_PROPERTIES;
+    nonClusterProperties.removeAll(CLUSTER_PROPERTIES);
+
     String actualResult = jedis.info("cluster");
 
     assertThat(actualResult).contains(CLUSTER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(PERSISTENCE_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonClusterProperties);
   }
 
   @Test
-  public void shouldReturnPersistenceSectionsGivenPersistenceSectionParameter() {
+  public void shouldReturnPersistenceSections_givenPersistenceSectionParameter() {
+    List<String> nonPersistenceProperties = ALL_PROPERTIES;
+    nonPersistenceProperties.removeAll(PERSISTENCE_PROPERTIES);
+
     String actualResult = jedis.info("persistence");
 
     assertThat(actualResult).contains(PERSISTENCE_PROPERTIES);
-    assertThat(actualResult).doesNotContain(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(CLUSTER_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonPersistenceProperties);
+  }
+
+  @Test
+  public void shouldReturnStatsSections_givenStatsSectionParameter() {
+    List<String> nonStatsProperties = ALL_PROPERTIES;
+    nonStatsProperties.removeAll(STATS_PROPERTIES);

Review comment:
       Done!




----------------------------------------------------------------
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] jdeppe-pivotal merged pull request #5767: GEODE-8717: INFO command returns specified sections

Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal merged pull request #5767:
URL: https://github.com/apache/geode/pull/5767


   


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