Attila Doroszlai created HDDS-14890:
---------------------------------------

             Summary: Improve ozone_add_default_gc_opts
                 Key: HDDS-14890
                 URL: https://issues.apache.org/jira/browse/HDDS-14890
             Project: Apache Ozone
          Issue Type: Improvement
            Reporter: Attila Doroszlai


Improve {{ozone_add_default_gc_opts}}:

- Remove {{ozone_error}} messages.  Setting default GC options is not an error. 
 Users (admins) can enable {{OZONE_SHELL_SCRIPT_DEBUG}} to check how 
{{OZONE_OPTS}} (and other variables) are manipulated during startup.
- Collect options to be added in a local variable, append in one step at the 
end.  Use function 
[{{ozone_add_param}}|https://github.com/apache/ozone/blob/987e3bcbb4b1038a37fb060d205c40d922dc7f8a/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L1110-L1118]
 (see example 
[usage|https://github.com/apache/ozone/blob/987e3bcbb4b1038a37fb060d205c40d922dc7f8a/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L1474]),
 passing {{XX}} as {{checkstring}} (second argument).  This makes the separate 
check for {{-XX}} unnecessary.
- Declare {{java_major_version}} as local variable.

{code:title=https://github.com/apache/ozone/blob/987e3bcbb4b1038a37fb060d205c40d922dc7f8a/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L1521-L1535}
function ozone_add_default_gc_opts
{
  java_major_version=$(ozone_get_java_major_version)
  if [[ "${OZONE_SUBCMD_SUPPORTDAEMONIZATION}" == true ]]; then
    if [[ ! "$OZONE_OPTS" =~ "-XX" ]] ; then
      OZONE_OPTS="${OZONE_OPTS} -XX:ParallelGCThreads=8"
      if [[ "$java_major_version" -lt 15 ]]; then
        OZONE_OPTS="${OZONE_OPTS} -XX:+UseConcMarkSweepGC -XX:NewRatio=3 
-XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled"
        ozone_error "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_error "No '-XX:...' jvm parameters are set. Adding safer GC 
settings '-XX:ParallelGCThreads=8' to the OZONE_OPTS"
      fi
    fi
  fi
}
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to