Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-11236

Move Java version-specific NETTY_OPTS to ozone-functions.sh

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Implemented
    • 2.0.0
    • 2.0.0
    • None

    Description

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

        # 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
      

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

        # 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
      

      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.

      Attachments

        Issue Links

          Activity

            People

              sarvekshayr Sarveksha Yeshavantha Raju
              adoroszlai Attila Doroszlai
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: