Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YARN-11734. Fix spotbugs in ServiceScheduler#load #7088

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

zhtttylz
Copy link
Contributor

@zhtttylz zhtttylz commented Oct 1, 2024

JIRA:YARN-11734. Fix spotbugs in ServiceScheduler#load.

@zhtttylz zhtttylz changed the title HDFS-17461. Fix spotbugs in ServiceScheduler#load YARN-11734. Fix spotbugs in ServiceScheduler#load Oct 1, 2024
@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 10s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s 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.
_ trunk Compile Tests _
+1 💚 shadedclient 41m 41s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 shadedclient 34m 4s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 asflicense 0m 39s The patch does not generate ASF License warnings.
79m 16s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7088/1/artifact/out/Dockerfile
GITHUB PR #7088
Optional Tests dupname asflicense codespell detsecrets xmllint
uname Linux 5c935f128505 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 730103e
Max. process+thread count 551 (vs. ulimit of 5500)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7088/1/console
versions git=2.25.1 maven=3.6.3
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

<Match>
<Class name="org.apache.hadoop.yarn.service.ServiceScheduler$1"/>
<Method name="load"/>
<Bug code="NP" pattern="NP_NONNULL_RETURN_VIOLATION"/>
Copy link

@zeekling zeekling Oct 1, 2024

Choose a reason for hiding this comment

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

Why not delete @Nonnull

Copy link
Contributor

@slfan1989 slfan1989 Oct 1, 2024

Choose a reason for hiding this comment

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

@zeekling The reason for modifying this PR is that SpotBugs flagged the following issue.

NP	org.apache.hadoop.yarn.service.ServiceScheduler$1.load(ConfigFile) may return null, but is declared @Nonnull

[Bug type NP_NONNULL_RETURN_VIOLATION]
In class org.apache.hadoop.yarn.service.ServiceScheduler$1
In method org.apache.hadoop.yarn.service.ServiceScheduler$1.load(ConfigFile)
At ServiceScheduler.java:[line 558]

The @Nonnull annotation is from the Guava package, so we can't modify it. However, after carefully reviewing the code, adding a rule is a more straightforward solution. From my personal perspective, this change is acceptable.

Copy link

Choose a reason for hiding this comment

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

reviewing

i see.

Copy link
Contributor

Choose a reason for hiding this comment

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

@zeekling Do you have any other feedback or suggestions regarding this PR?
cc: @zhtttylz

@slfan1989
Copy link
Contributor

slfan1989 commented Oct 1, 2024

@zhtttylz Thank you for your contribution! LGTM.

We need to remove the following rule:

[hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api ]

  <!-- The ServiceScheduler#createConfigFileCache method uses the `load` method,
       which is not allowed to return null; we can ignore it here. -->
  <Match>
    <Class name="org.apache.hadoop.yarn.service.ServiceScheduler"/>
    <Method name="$1.load(ConfigFile)" />
    <Bug pattern="NP_NONNULL_RETURN_VIOLATION"/>
  </Match>

@zhtttylz
Copy link
Contributor Author

zhtttylz commented Oct 2, 2024

@zhtttylz Thank you for your contribution! LGTM.

We need to remove the following rule:

[hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api ]

  <!-- The ServiceScheduler#createConfigFileCache method uses the `load` method,
       which is not allowed to return null; we can ignore it here. -->
  <Match>
    <Class name="org.apache.hadoop.yarn.service.ServiceScheduler"/>
    <Method name="$1.load(ConfigFile)" />
    <Bug pattern="NP_NONNULL_RETURN_VIOLATION"/>
  </Match>

Thanks a lot for your feedback! I'll make the necessary changes to the code as soon as possible.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 18m 0s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s 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 1s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ trunk Compile Tests _
+0 🆗 mvndep 15m 53s Maven dependency ordering for branch
+1 💚 shadedclient 51m 7s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 33s Maven dependency ordering for patch
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 shadedclient 34m 8s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 asflicense 0m 38s The patch does not generate ASF License warnings.
106m 7s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7088/2/artifact/out/Dockerfile
GITHUB PR #7088
Optional Tests dupname asflicense codespell detsecrets xmllint
uname Linux 435cff1b2664 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / aa5e405
Max. process+thread count 622 (vs. ulimit of 5500)
modules C: hadoop-yarn-project/hadoop-yarn hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services U: hadoop-yarn-project/hadoop-yarn
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7088/2/console
versions git=2.25.1 maven=3.6.3
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@slfan1989 slfan1989 merged commit b781882 into apache:trunk Oct 2, 2024
4 checks passed
@slfan1989
Copy link
Contributor

@zhtttylz Thanks for the contribution! @zeekling Thanks for the review!

@zhtttylz
Copy link
Contributor Author

zhtttylz commented Oct 3, 2024

Thanks @slfan1989 @zeekling help review and merged.

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.

4 participants