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 2022/04/12 18:24:47 UTC

[GitHub] [geode] dschneider-pivotal opened a new pull request, #7585: GEODE-10235: fix --maxHeap for java 17

dschneider-pivotal opened a new pull request, #7585:
URL: https://github.com/apache/geode/pull/7585

   The product code will no longer add CMS args for java versions that do not support CMS.
   
   <!-- 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.

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [geode] dschneider-pivotal merged pull request #7585: GEODE-10235: fix --maxHeap for java 17

Posted by GitBox <gi...@apache.org>.
dschneider-pivotal merged PR #7585:
URL: https://github.com/apache/geode/pull/7585


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

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [geode] kirklund commented on a diff in pull request #7585: GEODE-10235: fix --maxHeap for java 17

Posted by GitBox <gi...@apache.org>.
kirklund commented on code in PR #7585:
URL: https://github.com/apache/geode/pull/7585#discussion_r848894688


##########
geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/StartMemberUtilsTest.java:
##########
@@ -172,9 +177,14 @@ public void testAddMaxHeap() {
 
     // Only Max Heap Option Set
     StartMemberUtils.addMaxHeap(baseCommandLine, "32g");
-    assertThat(baseCommandLine.size()).isEqualTo(3);
-    assertThat(baseCommandLine).containsExactly("-Xmx32g", "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+    if (getJavaMajorVersion() < 14) {
+      assertThat(baseCommandLine.size()).isEqualTo(3);

Review Comment:
   ```
   assertThat(baseCommandLine).hasSize(3);
   ```
   Same with the one on line 185.



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

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [geode] demery-pivotal commented on a diff in pull request #7585: GEODE-10235: fix --maxHeap for java 17

Posted by GitBox <gi...@apache.org>.
demery-pivotal commented on code in PR #7585:
URL: https://github.com/apache/geode/pull/7585#discussion_r848762749


##########
geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/StartMemberUtilsTest.java:
##########
@@ -172,9 +177,14 @@ public void testAddMaxHeap() {
 
     // Only Max Heap Option Set
     StartMemberUtils.addMaxHeap(baseCommandLine, "32g");
-    assertThat(baseCommandLine.size()).isEqualTo(3);
-    assertThat(baseCommandLine).containsExactly("-Xmx32g", "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+    if (getJavaMajorVersion() < 14) {
+      assertThat(baseCommandLine.size()).isEqualTo(3);
+      assertThat(baseCommandLine).containsExactly("-Xmx32g", "-XX:+UseConcMarkSweepGC",
+          "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+    } else {
+      assertThat(baseCommandLine.size()).isEqualTo(1);
+      assertThat(baseCommandLine).containsExactly("-Xmx32g");
+    }
 

Review Comment:
   Take a look at JUnit 5's `@EnabledOnJre(…)` and `@EnabledForJreRange(min=…, max=…)` annotations. There are also `@Disabled…` ones.



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

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [geode] kirklund commented on a diff in pull request #7585: GEODE-10235: fix --maxHeap for java 17

Posted by GitBox <gi...@apache.org>.
kirklund commented on code in PR #7585:
URL: https://github.com/apache/geode/pull/7585#discussion_r848893733


##########
geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/StartMemberUtilsTest.java:
##########
@@ -172,9 +177,14 @@ public void testAddMaxHeap() {
 
     // Only Max Heap Option Set
     StartMemberUtils.addMaxHeap(baseCommandLine, "32g");
-    assertThat(baseCommandLine.size()).isEqualTo(3);
-    assertThat(baseCommandLine).containsExactly("-Xmx32g", "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+    if (getJavaMajorVersion() < 14) {
+      assertThat(baseCommandLine.size()).isEqualTo(3);
+      assertThat(baseCommandLine).containsExactly("-Xmx32g", "-XX:+UseConcMarkSweepGC",
+          "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+    } else {
+      assertThat(baseCommandLine.size()).isEqualTo(1);
+      assertThat(baseCommandLine).containsExactly("-Xmx32g");
+    }
 

Review Comment:
   You should change the assertion to use `hasSize`. You can even combine both if you want or even eliminate `hasSize` altogether since the other assertion will still fail if it's zero:
   ```
   assertThat(baseCommandLine)
       .hasSize(1)
       .containsExactly("-Xmx32g");
   ```



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

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [geode] demery-pivotal commented on a diff in pull request #7585: GEODE-10235: fix --maxHeap for java 17

Posted by GitBox <gi...@apache.org>.
demery-pivotal commented on code in PR #7585:
URL: https://github.com/apache/geode/pull/7585#discussion_r849740759


##########
geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/StartMemberUtilsTest.java:
##########
@@ -151,77 +163,82 @@ public void testExtensionsJars() throws IOException {
     assertThat(gemfireClasspath).doesNotContain("extensions");
 
     // when there is a `test.jar` in `extensions` directory
-    File folder = temporaryFolder.newFolder("extensions");
+    File folder = new File(temporaryFolder, "extensions");
+    Files.createDirectories(folder.toPath());
     File jarFile = new File(folder, "test.jar");
-    jarFile.createNewFile();
+    assertThat(jarFile.createNewFile()).isTrue();
     gemfireClasspath = StartMemberUtils.toClasspath(true, new String[] {jarFile.getAbsolutePath()});
     assertThat(gemfireClasspath).contains(jarFile.getName());
 
   }
 
+  @EnabledForJreRange(max = JAVA_13)
   @Test
-  public void testAddMaxHeap() {
+  public void testAddMaxHeapWithCMS() {
     List<String> baseCommandLine = new ArrayList<>();
 
     // Empty Max Heap Option
     StartMemberUtils.addMaxHeap(baseCommandLine, null);
-    assertThat(baseCommandLine.size()).isEqualTo(0);
+    assertThat(baseCommandLine).isEmpty();
 
     StartMemberUtils.addMaxHeap(baseCommandLine, "");
-    assertThat(baseCommandLine.size()).isEqualTo(0);
+    assertThat(baseCommandLine).isEmpty();
 
     // Only Max Heap Option Set
     StartMemberUtils.addMaxHeap(baseCommandLine, "32g");
-    assertThat(baseCommandLine.size()).isEqualTo(3);
     assertThat(baseCommandLine).containsExactly("-Xmx32g", "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+        "-XX:CMSInitiatingOccupancyFraction=" + MemberJvmOptions.CMS_INITIAL_OCCUPANCY_FRACTION);

Review Comment:
   If we don't care about the specific order, consider relaxing the assertion slightly (and the other assertions of multiple options): `containsExactlyInAnyOrder(…)`.



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

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [geode] dschneider-pivotal commented on pull request #7585: GEODE-10235: fix --maxHeap for java 17

Posted by GitBox <gi...@apache.org>.
dschneider-pivotal commented on PR #7585:
URL: https://github.com/apache/geode/pull/7585#issuecomment-1098225346

   @kirklund I like you idea about refactoring how the options are constructed, but lets hold off on doing it until we add ZGC support for 17. I'd like to get this fix in now since it fixes GEODE-10235 and moves us towards a green jdk17 ci


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

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [geode] dschneider-pivotal commented on a diff in pull request #7585: GEODE-10235: fix --maxHeap for java 17

Posted by GitBox <gi...@apache.org>.
dschneider-pivotal commented on code in PR #7585:
URL: https://github.com/apache/geode/pull/7585#discussion_r849647859


##########
geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/StartMemberUtilsTest.java:
##########
@@ -172,9 +177,14 @@ public void testAddMaxHeap() {
 
     // Only Max Heap Option Set
     StartMemberUtils.addMaxHeap(baseCommandLine, "32g");
-    assertThat(baseCommandLine.size()).isEqualTo(3);
-    assertThat(baseCommandLine).containsExactly("-Xmx32g", "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+    if (getJavaMajorVersion() < 14) {
+      assertThat(baseCommandLine.size()).isEqualTo(3);

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.

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [geode] demery-pivotal commented on a diff in pull request #7585: GEODE-10235: fix --maxHeap for java 17

Posted by GitBox <gi...@apache.org>.
demery-pivotal commented on code in PR #7585:
URL: https://github.com/apache/geode/pull/7585#discussion_r849739507


##########
geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/StartMemberUtilsTest.java:
##########
@@ -151,77 +163,82 @@ public void testExtensionsJars() throws IOException {
     assertThat(gemfireClasspath).doesNotContain("extensions");
 
     // when there is a `test.jar` in `extensions` directory
-    File folder = temporaryFolder.newFolder("extensions");
+    File folder = new File(temporaryFolder, "extensions");
+    Files.createDirectories(folder.toPath());
     File jarFile = new File(folder, "test.jar");
-    jarFile.createNewFile();
+    assertThat(jarFile.createNewFile()).isTrue();
     gemfireClasspath = StartMemberUtils.toClasspath(true, new String[] {jarFile.getAbsolutePath()});
     assertThat(gemfireClasspath).contains(jarFile.getName());
 
   }
 
+  @EnabledForJreRange(max = JAVA_13)
   @Test
-  public void testAddMaxHeap() {
+  public void testAddMaxHeapWithCMS() {
     List<String> baseCommandLine = new ArrayList<>();
 
     // Empty Max Heap Option
     StartMemberUtils.addMaxHeap(baseCommandLine, null);
-    assertThat(baseCommandLine.size()).isEqualTo(0);
+    assertThat(baseCommandLine).isEmpty();
 
     StartMemberUtils.addMaxHeap(baseCommandLine, "");
-    assertThat(baseCommandLine.size()).isEqualTo(0);
+    assertThat(baseCommandLine).isEmpty();
 
     // Only Max Heap Option Set
     StartMemberUtils.addMaxHeap(baseCommandLine, "32g");
-    assertThat(baseCommandLine.size()).isEqualTo(3);
     assertThat(baseCommandLine).containsExactly("-Xmx32g", "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+        "-XX:CMSInitiatingOccupancyFraction=" + MemberJvmOptions.CMS_INITIAL_OCCUPANCY_FRACTION);
 
     // All Options Set
     List<String> customCommandLine = new ArrayList<>(
         Arrays.asList("-XX:+UseConcMarkSweepGC", "-XX:CMSInitiatingOccupancyFraction=30"));
     StartMemberUtils.addMaxHeap(customCommandLine, "16g");
-    assertThat(customCommandLine.size()).isEqualTo(3);
     assertThat(customCommandLine).containsExactly("-XX:+UseConcMarkSweepGC",
         "-XX:CMSInitiatingOccupancyFraction=30", "-Xmx16g");
   }
 
-  private void writePid(final File pidFile, final int pid) throws IOException {
-    final FileWriter fileWriter = new FileWriter(pidFile, false);
-    fileWriter.write(String.valueOf(pid));
-    fileWriter.write("\n");
-    fileWriter.flush();
-    IOUtils.close(fileWriter);
+  @EnabledForJreRange(min = JAVA_14)
+  @Test
+  public void testAddMaxHeapWithoutCMS() {
+    List<String> baseCommandLine = new ArrayList<>();
+
+    // Empty Max Heap Option
+    StartMemberUtils.addMaxHeap(baseCommandLine, null);
+    assertThat(baseCommandLine).isEmpty();

Review Comment:
   Consider either of these, to give the failure message a bit more information about the nature of the `maxHeap` argument that caused the failure:
   - Separate these assertions into separate tests with names that describe `maxHeap`. E.g. `addNullMaxHeapWithoutCMS()`.
   - Distinguish the assertions by adding `as(…)` to describe the max heap parameter. E.g. `as("command line from null maxHeap parameter")`.



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

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org