sumitagrawl commented on code in PR #6975:
URL: https://github.com/apache/ozone/pull/6975#discussion_r1687681250


##########
hadoop-ozone/dist/src/shell/ozone/ozone:
##########
@@ -81,6 +81,21 @@ function ozonecmd_case
   # Corresponding Ratis issue https://issues.apache.org/jira/browse/RATIS-534.
   
RATIS_OPTS="-Dorg.apache.ratis.thirdparty.io.netty.allocator.useCacheForAllThreads=false
 ${RATIS_OPTS}"
 
+  # 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.
+  NETTY_OPTS=""
+
+  # 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)}')
+
+  if [[ "${JAVA_MAJOR_VERSION}" -ge "9" ]]; then
+    
NETTY_OPTS="-Dorg.apache.ratis.thirdparty.io.netty.tryReflectionSetAccessible=true"

Review Comment:
   this can be like NETTY_OPTS="..... ${NETTY_OPTS}" to have more changes when 
needed



##########
hadoop-ozone/dist/src/shell/ozone/ozone:
##########
@@ -81,6 +81,21 @@ function ozonecmd_case
   # Corresponding Ratis issue https://issues.apache.org/jira/browse/RATIS-534.
   
RATIS_OPTS="-Dorg.apache.ratis.thirdparty.io.netty.allocator.useCacheForAllThreads=false
 ${RATIS_OPTS}"
 
+  # 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.
+  NETTY_OPTS=""

Review Comment:
   We should not reset value to empty, as it can be set via env also. comments 
can be moved down



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

Reply via email to