Skip to content

Conversation

@pan3793
Copy link
Member

@pan3793 pan3793 commented Dec 24, 2024

Description of PR

The Hadoop codebase has some JDK version-specific code, and uses maven-compiler-plugin to exclude the specific packages, while IDEA does not work well for this plugin. For example, when setting project JDK to Java 17, the IDEA still loads those excluded source code and complains of class reference issues.
image

The PR proposes to use build-helper-maven-plugin to organize JDK version-specific code, which gets better support from IDEA.

BTW, hadoop-common also uses the same way to organize the arch-specific code, in src/main/arm-java.

How was this patch tested?

IntelliJ IDEA 2024.3.1.1 (Community Edition)
Build #IC-243.22562.218, built on December 18, 2024
Runtime version: 21.0.5+8-b631.28 aarch64 (JCEF 122.1.9)
macOS 15.2

When setting the project JDK to Java 8
image

When setting the project JDK to Java 17
image

Also, verified by running mvn clean install -DskipTests in both Java 8 and 17.

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

<id>jdk1.8</id>
<id>jdk8</id>
<activation>
<jdk>1.8</jdk>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maven supports both 1.8 and 8, but seems IDEA only supports 1.8

@pan3793
Copy link
Member Author

pan3793 commented Dec 24, 2024

cc @jojochuang

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 17m 34s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 6m 47s Maven dependency ordering for branch
+1 💚 mvninstall 30m 15s trunk passed
+1 💚 compile 16m 37s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 15m 8s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 4m 14s trunk passed
+1 💚 mvnsite 2m 13s trunk passed
+1 💚 javadoc 2m 7s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 2m 34s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 4m 9s trunk passed
+1 💚 shadedclient 35m 26s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 32s Maven dependency ordering for patch
+1 💚 mvninstall 1m 21s the patch passed
+1 💚 compile 15m 42s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 15m 42s the patch passed
+1 💚 compile 15m 16s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 15m 16s root-jdkPrivateBuild-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga generated 0 new + 35 unchanged - 9 fixed = 35 total (was 44)
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 35 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
+1 💚 checkstyle 4m 15s root: The patch generated 0 new + 0 unchanged - 21 fixed = 0 total (was 21)
+1 💚 mvnsite 2m 13s the patch passed
+1 💚 javadoc 2m 0s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 2m 37s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 4m 30s the patch passed
+1 💚 shadedclient 35m 34s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 0m 39s hadoop-annotations in the patch passed.
+1 💚 unit 272m 14s hadoop-hdfs in the patch passed.
+1 💚 asflicense 1m 13s The patch does not generate ASF License warnings.
496m 36s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/1/artifact/out/Dockerfile
GITHUB PR #7245
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient codespell detsecrets xmllint spotbugs checkstyle
uname Linux c4d3c1cfc3e6 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 2d58f50
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/1/testReport/
Max. process+thread count 3536 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-annotations hadoop-hdfs-project/hadoop-hdfs U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/1/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@pan3793
Copy link
Member Author

pan3793 commented Dec 24, 2024

The files complaint by Yetus are renamed without changes, I tend to keep them as-is to avoid introducing any unnecessary noisy changes.

@pan3793
Copy link
Member Author

pan3793 commented Jan 2, 2025

cc @steveloughran

@pan3793
Copy link
Member Author

pan3793 commented Feb 7, 2025

cc @slfan1989 @cnauroth, it's a minor change that affects developers who use IDEA with JDK 17, could you please take a look, thanks in advance

@slfan1989
Copy link
Contributor

slfan1989 commented Feb 7, 2025

@pan3793 LGTM.

I personally believe that this modification is feasible, but I still need @cnauroth and @steveloughran to review it for confirmation.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 32s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 6m 18s Maven dependency ordering for branch
+1 💚 mvninstall 31m 34s trunk passed
+1 💚 compile 17m 25s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 15m 23s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 4m 12s trunk passed
+1 💚 mvnsite 2m 15s trunk passed
+1 💚 javadoc 2m 6s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 2m 38s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 4m 7s trunk passed
+1 💚 shadedclient 36m 35s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 33s Maven dependency ordering for patch
+1 💚 mvninstall 1m 23s the patch passed
+1 💚 compile 16m 12s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 16m 12s the patch passed
+1 💚 compile 15m 21s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 15m 21s root-jdkPrivateBuild-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga generated 0 new + 35 unchanged - 9 fixed = 35 total (was 44)
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 35 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
+1 💚 checkstyle 4m 4s root: The patch generated 0 new + 0 unchanged - 21 fixed = 0 total (was 21)
+1 💚 mvnsite 2m 12s the patch passed
+1 💚 javadoc 1m 57s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 2m 32s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 4m 28s the patch passed
+1 💚 shadedclient 36m 55s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 0m 39s hadoop-annotations in the patch passed.
-1 ❌ unit 1m 35s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch passed.
+1 💚 asflicense 1m 3s The patch does not generate ASF License warnings.
213m 30s
Reason Tests
Failed junit tests hadoop.hdfs.TestListFilesInDFS
hadoop.hdfs.crypto.TestHdfsCryptoStreams
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/3/artifact/out/Dockerfile
GITHUB PR #7245
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient codespell detsecrets xmllint spotbugs checkstyle
uname Linux 7a223f04558a 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 4075a96
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/3/testReport/
Max. process+thread count 553 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-annotations hadoop-hdfs-project/hadoop-hdfs U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/3/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 0s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+0 🆗 xmllint 0m 1s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 6m 22s Maven dependency ordering for branch
+1 💚 mvninstall 33m 11s trunk passed
+1 💚 compile 18m 19s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 16m 54s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 4m 27s trunk passed
+1 💚 mvnsite 2m 14s trunk passed
+1 💚 javadoc 2m 5s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 2m 32s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 4m 18s trunk passed
+1 💚 shadedclient 41m 15s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 32s Maven dependency ordering for patch
+1 💚 mvninstall 1m 22s the patch passed
+1 💚 compile 17m 34s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 17m 34s the patch passed
+1 💚 compile 16m 51s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 16m 51s root-jdkPrivateBuild-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga generated 0 new + 35 unchanged - 9 fixed = 35 total (was 44)
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 35 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
+1 💚 checkstyle 4m 30s root: The patch generated 0 new + 0 unchanged - 21 fixed = 0 total (was 21)
+1 💚 mvnsite 2m 11s the patch passed
+1 💚 javadoc 1m 55s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 2m 32s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 4m 36s the patch passed
+1 💚 shadedclient 39m 7s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 0m 36s hadoop-annotations in the patch passed.
-1 ❌ unit 1m 39s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch passed.
+1 💚 asflicense 1m 2s The patch does not generate ASF License warnings.
228m 13s
Reason Tests
Failed junit tests hadoop.hdfs.TestListFilesInDFS
hadoop.hdfs.crypto.TestHdfsCryptoStreams
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/2/artifact/out/Dockerfile
GITHUB PR #7245
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient codespell detsecrets xmllint spotbugs checkstyle
uname Linux 980cf3fea7ac 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 4075a96
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/2/testReport/
Max. process+thread count 731 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-annotations hadoop-hdfs-project/hadoop-hdfs U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/2/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@cnauroth cnauroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

This looks fine to me. Thank you, @pan3793 !

Even though this is meant to help with Java 17 support, I wonder if we should merge it down to branch-3.4 and branch-3.3 anyway to reduce potential merge confliclts on cherry-picks.

I won't commit this one right away in case others want to comment.

@cnauroth
Copy link
Contributor

cnauroth commented Feb 8, 2025

There are some test failures, but I think that's because we're in a partial state with the JUnit5 upgrade. The hadoop-hdfs test subclasses a base class from hadoop-common, where it's using the Jupiter annotations, but hadoop-hdfs doesn't have the new runner yet.

@slfan1989
Copy link
Contributor

There are some test failures, but I think that's because we're in a partial state with the JUnit5 upgrade. The hadoop-hdfs test subclasses a base class from hadoop-common, where it's using the Jupiter annotations, but hadoop-hdfs doesn't have the new runner yet.

@cnauroth This seems to be caused by our upgrade of Hadoop-Common. I will continue to follow up on this issue. Once Hadoop Common Part4/Part5 is merged, I will submit Part6 and complete the unit tests for the modules dependent on Hadoop Common. I expect to work on this next week.

cc: @pan3793

@steveloughran
Copy link
Contributor

into 3.4.x please; I'm always mixing java versions and things get really confused in the IDE.

@cnauroth cnauroth closed this in 2202c95 Feb 13, 2025
cnauroth pushed a commit that referenced this pull request Feb 13, 2025
…roach

Closes #7245

Reviewed-by: Steve Loughran <stevel@apache.org>
Signed-off-by: Chris Nauroth <cnauroth@apache.org>
(cherry picked from commit 2202c95)
@cnauroth
Copy link
Contributor

I have committed this to trunk and branch-3.4. @pan3793 , thank you for the patch. @steveloughran , thank you for adding your feedback.

@pan3793
Copy link
Member Author

pan3793 commented Feb 14, 2025

Thanks for merging, it's able to run tests on IDEA with JDK 17 now, which simplifies the debugging process a lot to tackle UT failure after upgrading to JDK 17
image

adideshpande pushed a commit to adideshpande/hadoop that referenced this pull request Feb 27, 2025
…roach

Closes apache#7245

Reviewed-by: Steve Loughran <stevel@apache.org>
Signed-off-by: Chris Nauroth <cnauroth@apache.org>
YanivKunda pushed a commit to YanivKunda/hadoop that referenced this pull request Mar 23, 2025
…roach

Closes apache#7245

Reviewed-by: Steve Loughran <stevel@apache.org>
Signed-off-by: Chris Nauroth <cnauroth@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants