tillrohrmann commented on a change in pull request #43:
URL: https://github.com/apache/flink-docker/pull/43#discussion_r523040310



##########
File path: docker-entrypoint.sh
##########
@@ -93,21 +94,49 @@ prepare_job_manager_start() {
     envsubst < "${CONF_FILE}" > "${CONF_FILE}.tmp" && mv "${CONF_FILE}.tmp" 
"${CONF_FILE}"
 }
 
+disable_jemalloc_env() {
+  if [ "$1" = ${COMMAND_DISABLE_JEMALLOC} ]; then
+      echo "Disable Jemalloc as the memory allocator"
+      return 0
+  else
+      echo "Enable Jemalloc as the memory allocator via appending env variable 
LD_PRELOAD with /usr/lib/x86_64-linux-gnu/libjemalloc.so"
+      export LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/libjemalloc.so
+      return 1
+  fi
+}
+
 if [ "$1" = "help" ]; then
-    echo "Usage: $(basename "$0") 
(jobmanager|${COMMAND_STANDALONE}|taskmanager|${COMMAND_NATIVE_KUBERNETES}|${COMMAND_HISTORY_SERVER}|help)"
+    printf "Usage: $(basename "$0") 
(jobmanager|${COMMAND_STANDALONE}|taskmanager|${COMMAND_NATIVE_KUBERNETES}|${COMMAND_HISTORY_SERVER})
 [${COMMAND_DISABLE_JEMALLOC}]\n"
+    printf "    Or $(basename "$0") help\n\n"
+    printf "By default, Flink image adopts jemalloc as default memory 
allocator and will disable jemalloc if option '${COMMAND_DISABLE_JEMALLOC}' 
given.\n"
     exit 0
 elif [ "$1" = "jobmanager" ]; then
     shift 1
+    disable_jemalloc_env $@
+    disabled_jemalloc="$?"
+    if [ ${disabled_jemalloc} = 0 ]; then
+      shift 1
+    fi

Review comment:
       This block is repeated for all the commands. Can we simply have a 
function which is called with `$@` and which returns the new list of arguments 
for the `exec` command?

##########
File path: docker-entrypoint.sh
##########
@@ -21,6 +21,7 @@
 COMMAND_STANDALONE="standalone-job"
 COMMAND_NATIVE_KUBERNETES="native-k8s"
 COMMAND_HISTORY_SERVER="history-server"
+COMMAND_DISABLE_JEMALLOC="disablejemalloc"

Review comment:
       Maybe use `disable-jemalloc` instead.




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

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


Reply via email to