Attila Doroszlai created HDDS-11236:
---------------------------------------

             Summary: Move Java version-specific NETTY_OPTS to 
ozone-functions.sh
                 Key: HDDS-11236
                 URL: https://issues.apache.org/jira/browse/HDDS-11236
             Project: Apache Ozone
          Issue Type: Improvement
    Affects Versions: 1.5.0
            Reporter: Attila Doroszlai
            Assignee: Sarveksha Yeshavantha Raju


HDDS-10382 added Java-version specific logic for Netty:

{code:title=https://github.com/apache/ozone/blob/e33fd2d7caa7a0d7380b1a2eef803ae64e3dad47/hadoop-ozone/dist/src/shell/ozone/ozone#L84-L95}
  # Get the version string
  JAVA_VERSION_STRING=$(java -version 2>&1)


  # Extract the major version number
  JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION_STRING" | grep -oE 
'[0-9]+(\.[0-9]+)*' | head -n 1 | awk -F. '{print ($1 == 1 ? $2 : $1)}')


  # Add JVM parameter for Java 9+
  # (org.apache.ratis.thirdparty.io.netty.tryReflectionSetAccessible=true) to 
allow Netty unsafe memory allocation.
  # Corresponding issue https://issues.apache.org/jira/browse/HDDS-10382.
  if [[ "${JAVA_MAJOR_VERSION}" -ge "9" ]]; then
    
NETTY_OPTS="-Dorg.apache.ratis.thirdparty.io.netty.tryReflectionSetAccessible=true
 ${NETTY_OPTS}"
  fi
{code}

Please move setting of {{NETTY_OPTS}} to {{ozone_java_setup}} in 
{{hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh}}:

{code:title=https://github.com/apache/ozone/blob/e33fd2d7caa7a0d7380b1a2eef803ae64e3dad47/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L1409-L1415}
  # Get the version string
  JAVA_VERSION_STRING=$(${JAVA} -version 2>&1 | head -n 1)


  # Extract the major version number
  JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION_STRING" | sed -E -n 's/.* version 
"([^.-]*).*"/\1/p' | cut -d' ' -f1)


  ozone_set_module_access_args
{code}

Also, since {{RATIS_OPTS}} also contains setting for shaded Netty 
({{org.apache.ratis.thirdparty.io.netty...}}), I think we can merge the two 
variables, keeping the {{RATIS_OPTS}} name for compatibility.



--
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