Skip to content

HDDS-14890. Improve ozone_add_default_gc_opts#10021

Merged
adoroszlai merged 1 commit intoapache:masterfrom
AdyChechani:HDDS-14890
Apr 1, 2026
Merged

HDDS-14890. Improve ozone_add_default_gc_opts#10021
adoroszlai merged 1 commit intoapache:masterfrom
AdyChechani:HDDS-14890

Conversation

@AdyChechani
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  • Made java_major_version a local variable so it doesn’t leak into the broader shell environment.
  • GC options now go into a local variable. Passing XX as the checkstring takes care of duplicate options, so there’s no need for the old [[ ! "$OZONE_OPTS" =~ "-XX" ]] check.
  • Removed ozone_error messages, instead used ozone_debug.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14890

How was this patch tested?

Tested the function ozone_add_default_gc_opts in isolation manually by creating a shell script locally, verifying that:

  • Default GC options are correctly appended to OZONE_OPTS
  • No duplicate -XX options are added when one is already present

Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @AdyChechani for the patch.

Comment on lines +1530 to +1532
ozone_debug "No '-XX:...' jvm parameters are set. Adding safer GC settings '-XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:NewRatio=3 -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled' to the OZONE_OPTS"
else
ozone_debug "No '-XX:...' jvm parameters are set. Adding safer GC settings '-XX:ParallelGCThreads=8' to the OZONE_OPTS"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove these ozone_debug messages. Since presence of -XX is not checked beforehand, these would always be printed. ozone_add_param already prints debug message:

ozone_debug "$1 accepted $3"
else
ozone_debug "$1 declined $3"

{
local gc_opts
local java_major_version
java_major_version=$(ozone_get_java_major_version)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: please move this variable assignment into the if block to avoid running it unnecessarily for client commands

Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @AdyChechani for updating the patch.

@adoroszlai adoroszlai merged commit 5e009a3 into apache:master Apr 1, 2026
30 of 31 checks passed
@adoroszlai
Copy link
Copy Markdown
Contributor

@AdyChechani Please try to avoid force-push when updating the PR. Here are some great articles that explain why:

https://developers.mattermost.com/blog/submitting-great-prs/#4-avoid-force-pushing
https://www.freecodecamp.org/news/optimize-pull-requests-for-reviewer-happiness#request-a-review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants