ctubbsii commented on code in PR #2120:
URL: https://github.com/apache/zookeeper/pull/2120#discussion_r1471474942


##########
bin/zkEnv.sh:
##########
@@ -144,9 +144,15 @@ fi
 
 #echo "CLASSPATH=$CLASSPATH"
 
-# default heap for zookeeper server
-ZK_SERVER_HEAP="${ZK_SERVER_HEAP:-1000}"
-export SERVER_JVMFLAGS="-Xmx${ZK_SERVER_HEAP}m $SERVER_JVMFLAGS"
+# ZK_SERVER_MAXRAMPERCENTAGE has higher precedence over ZK_SERVER_HEAP 
+if [ "x$ZK_SERVER_MAXRAMPERCENTAGE" = "x" ]
+then
+  # default heap for zookeeper server
+  ZK_SERVER_HEAP="${ZK_SERVER_HEAP:-1000}"
+  export SERVER_JVMFLAGS="-Xmx${ZK_SERVER_HEAP}m $SERVER_JVMFLAGS"
+else
+  export SERVER_JVMFLAGS="-XX:MaxRAMPercentage=$ZK_SERVER_MAXRAMPERCENTAGE 
$SERVER_JVMFLAGS"
+fi

Review Comment:
   Could do something like:
   
   ```bash
   if [[ -n $ZK_SERVER_HEAP ]]; then
       echo 'WARNING: ZK_SERVER_HEAP will not be recognized in a future 
version. Set -Xmx directly using SERVER_JVMFLAGS instead.'
       SERVER_JVMFLAGS="-Xmx${ZK_SERVER_HEAP}m $SERVER_JVMFLAGS"
   fi
   export SERVER_JVMFLAGS=${SERVER_JVMFLAGS:--Xmx1000m}
   ```



-- 
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: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to