You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/04/28 02:57:59 UTC

[GitHub] [hadoop] jteagles opened a new pull request, #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

jteagles opened a new pull request, #4242:
URL: https://github.com/apache/hadoop/pull/4242

   …ateTimeFormatter class
   
   <!--
     Thanks for sending a pull request!
       1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
       2. Make sure your PR title starts with JIRA issue id, e.g., 'HADOOP-17799. Your PR title ...'.
   -->
   
   ### Description of PR
   Upgrading to the recommended thread safe java.time libraries for formatting and parsing with a little better performance
   
   ### How was this patch tested?
   Attached a performance test patch to the jira and added unit test to ensure compatible behavior
   
   ### For code changes:
   
   - [ x] Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
   - [ x] Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
   - [ x] 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)?
   - [ x] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files?
   
   


-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] jteagles commented on a diff in pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
jteagles commented on code in PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#discussion_r860986710


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestTimes.java:
##########
@@ -61,4 +67,15 @@ public void testFinishTimesAheadOfStartTimes() {
     elapsed = Times.elapsed(Long.MAX_VALUE, 0, true);
     Assert.assertEquals("Elapsed time is not -1", -1, elapsed);
   }
+
+  @Test
+  public void validateISO() throws IOException {
+    SimpleDateFormat isoFormat = new SimpleDateFormat(ISO8601_DATE_FORMAT);
+    for (int i = 0; i < 1000; i++) {
+      long now = System.currentTimeMillis();
+      String instant =  Times.formatISO8601(now);
+      String date = isoFormat.format(new Date(now));
+      Assert.assertEquals(date, instant);

Review Comment:
   Thanks for the quick reply, @aajisaka. Double checking on this one, since expected and actual are a bit confusing to me in this case. isoFormat is using the old method of calculating the date and instant is being checked against isoFormat to ensure the same result has been achieved after the change. I can see it either way. If you confirm, I will make the change you suggested.



-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] aajisaka merged pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
aajisaka merged PR #4242:
URL: https://github.com/apache/hadoop/pull/4242


-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] jteagles commented on pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
jteagles commented on PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#issuecomment-1115215449

   @aajisaka, I was hoping to backport this to earlier lines. Do you see any problem with me backporting to 2.10.x? Perhaps that is too far back.
   
   I was taking a look at https://cwiki.apache.org/confluence/display/HADOOP/GitHub+Integration#GitHubIntegration-MergingaPR(forcommitters) to catch myself up with the updated github process. Before, I would just cherry-pick at this now that it is merged to trunk, but don't see the exact steps to follow.


-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] aajisaka commented on a diff in pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
aajisaka commented on code in PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#discussion_r860997327


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestTimes.java:
##########
@@ -61,4 +67,15 @@ public void testFinishTimesAheadOfStartTimes() {
     elapsed = Times.elapsed(Long.MAX_VALUE, 0, true);
     Assert.assertEquals("Elapsed time is not -1", -1, elapsed);
   }
+
+  @Test
+  public void validateISO() throws IOException {
+    SimpleDateFormat isoFormat = new SimpleDateFormat(ISO8601_DATE_FORMAT);
+    for (int i = 0; i < 1000; i++) {
+      long now = System.currentTimeMillis();
+      String instant =  Times.formatISO8601(now);
+      String date = isoFormat.format(new Date(now));
+      Assert.assertEquals(date, instant);

Review Comment:
   Thank you @jteagles.
   
   > isoFormat is using the old method of calculating the date and instant is being checked against isoFormat to ensure the same result has been achieved after the change.
   
   +1, thank you for your explanation. Sorry my comment was wrong. Current implementation (old/expected, new/actual) seems correct.



-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] aajisaka commented on pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
aajisaka commented on PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#issuecomment-1115223462

   @jteagles, I cannot backport this to 2.10.x because 2.10.x still supports JDK 7.
   
   > How to update the release branches
   
   Just cherry-picking the trunk commit to the branches is fine. Thanks.


-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] jteagles commented on pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
jteagles commented on PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#issuecomment-1115230847

   @aajisaka, good catch on jdk 7. Thanks so much on this jira.


-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] aajisaka commented on a diff in pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
aajisaka commented on code in PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#discussion_r860997327


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestTimes.java:
##########
@@ -61,4 +67,15 @@ public void testFinishTimesAheadOfStartTimes() {
     elapsed = Times.elapsed(Long.MAX_VALUE, 0, true);
     Assert.assertEquals("Elapsed time is not -1", -1, elapsed);
   }
+
+  @Test
+  public void validateISO() throws IOException {
+    SimpleDateFormat isoFormat = new SimpleDateFormat(ISO8601_DATE_FORMAT);
+    for (int i = 0; i < 1000; i++) {
+      long now = System.currentTimeMillis();
+      String instant =  Times.formatISO8601(now);
+      String date = isoFormat.format(new Date(now));
+      Assert.assertEquals(date, instant);

Review Comment:
   Thank you @jteagles.
   
   > isoFormat is using the old method of calculating the date and instant is being checked against isoFormat to ensure the same result has been achieved after the change.
   
   +1, thank you for your explanation. Sorry my comment was wrong.



-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] hadoop-yetus commented on pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
hadoop-yetus commented on PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#issuecomment-1111739842

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |:----:|----------:|--------:|:--------:|:-------:|
   | +0 :ok: |  reexec  |   0m 36s |  |  Docker mode activated.  |
   |||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files found.  |
   | +0 :ok: |  codespell  |   0m  0s |  |  codespell was not available.  |
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to include 1 new or modified test files.  |
   |||| _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  38m 28s |  |  trunk passed  |
   | +1 :green_heart: |  compile  |   1m  5s |  |  trunk passed with JDK Ubuntu-11.0.14.1+1-Ubuntu-0ubuntu1.20.04  |
   | +1 :green_heart: |  compile  |   1m  1s |  |  trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07  |
   | +1 :green_heart: |  checkstyle  |   0m 57s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   1m  7s |  |  trunk passed  |
   | +1 :green_heart: |  javadoc  |   1m 12s |  |  trunk passed with JDK Ubuntu-11.0.14.1+1-Ubuntu-0ubuntu1.20.04  |
   | +1 :green_heart: |  javadoc  |   1m  2s |  |  trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07  |
   | +1 :green_heart: |  spotbugs  |   2m  7s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  21m 27s |  |  branch has no errors when building and testing our client artifacts.  |
   |||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   0m 45s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 48s |  |  the patch passed with JDK Ubuntu-11.0.14.1+1-Ubuntu-0ubuntu1.20.04  |
   | +1 :green_heart: |  javac  |   0m 48s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 44s |  |  the patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07  |
   | +1 :green_heart: |  javac  |   0m 44s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks issues.  |
   | +1 :green_heart: |  checkstyle  |   0m 34s |  |  hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common: The patch generated 0 new + 1 unchanged - 2 fixed = 1 total (was 3)  |
   | +1 :green_heart: |  mvnsite  |   0m 46s |  |  the patch passed  |
   | +1 :green_heart: |  javadoc  |   0m 45s |  |  the patch passed with JDK Ubuntu-11.0.14.1+1-Ubuntu-0ubuntu1.20.04  |
   | +1 :green_heart: |  javadoc  |   0m 44s |  |  the patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07  |
   | +1 :green_heart: |  spotbugs  |   1m 46s |  |  the patch passed  |
   | +1 :green_heart: |  shadedclient  |  21m  6s |  |  patch has no errors when building and testing our client artifacts.  |
   |||| _ Other Tests _ |
   | +1 :green_heart: |  unit  |   4m 59s |  |  hadoop-yarn-common in the patch passed.  |
   | +1 :green_heart: |  asflicense  |   0m 49s |  |  The patch does not generate ASF License warnings.  |
   |  |   | 103m  3s |  |  |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4242/1/artifact/out/Dockerfile |
   | GITHUB PR | https://github.com/apache/hadoop/pull/4242 |
   | Optional Tests | dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell |
   | uname | Linux 6e562b66e22e 4.15.0-156-generic #163-Ubuntu SMP Thu Aug 19 23:31:58 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / e194e3fae5ca1fb7e807de78255b0a8f162a4914 |
   | Default Java | Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 |
   | Multi-JDK versions | /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.14.1+1-Ubuntu-0ubuntu1.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 |
   |  Test Results | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4242/1/testReport/ |
   | Max. process+thread count | 550 (vs. ulimit of 5500) |
   | modules | C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common |
   | Console output | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4242/1/console |
   | versions | git=2.25.1 maven=3.6.3 spotbugs=4.2.2 |
   | Powered by | Apache Yetus 0.14.0-SNAPSHOT https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


[GitHub] [hadoop] aajisaka commented on a diff in pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

Posted by GitBox <gi...@apache.org>.
aajisaka commented on code in PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#discussion_r860503837


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestTimes.java:
##########
@@ -61,4 +67,15 @@ public void testFinishTimesAheadOfStartTimes() {
     elapsed = Times.elapsed(Long.MAX_VALUE, 0, true);
     Assert.assertEquals("Elapsed time is not -1", -1, elapsed);
   }
+
+  @Test
+  public void validateISO() throws IOException {
+    SimpleDateFormat isoFormat = new SimpleDateFormat(ISO8601_DATE_FORMAT);
+    for (int i = 0; i < 1000; i++) {
+      long now = System.currentTimeMillis();
+      String instant =  Times.formatISO8601(now);
+      String date = isoFormat.format(new Date(now));
+      Assert.assertEquals(date, instant);

Review Comment:
   The order of the arguments are (expected, actual). I think it should be (instant, date).



-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org