adoroszlai commented on code in PR #5993:
URL: https://github.com/apache/ozone/pull/5993#discussion_r1452514798
##########
hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh:
##########
@@ -1406,6 +1406,35 @@ function ozone_java_setup
ozone_error "ERROR: $JAVA is not executable."
exit 1
fi
+
+ # 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
+}
+
+## @description Set OZONE_MODULE_ACCESS_ARGS based on Java version
+## @audience private
+## @stability evolving
+## @replaceable yes
+function ozone_set_module_access_args
+{
+ if [[ -z "${JAVA_MAJOR_VERSION}" ]]; then
+ return
+ fi
+
+ # populate JVM args based on java version
+ if [[ "${JAVA_MAJOR_VERSION}" -ge 17 ]]; then
+ OZONE_MODULE_ACCESS_ARGS="--add-opens java.base/java.lang=ALL-UNNAMED"
+ OZONE_MODULE_ACCESS_ARGS="${OZONE_MODULE_ACCESS_ARGS} --add-opens
java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED"
+ OZONE_MODULE_ACCESS_ARGS="${OZONE_MODULE_ACCESS_ARGS} --add-exports
java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED"
+ fi
+ if [[ "${JAVA_MAJOR_VERSION}" -ge 9 ]]; then
Review Comment:
Yes. The first part (specific to Java 17) was added for `HDDS-8533. Ozone
Cluster components (SCM, OM, DNs) fails to start with JDK 17`. The second part
got added later for `HDDS-7228. ChecksumByteBufferImpl.update() is expensive`.
I just moved these from `ozone` to `ozone-functions.sh`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]