Myasuka commented on a change in pull request #43:
URL: https://github.com/apache/flink-docker/pull/43#discussion_r525867175
##########
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:
I have refactored the function and update the array of arguments within
the new `disable_jemalloc_env` function and then passed to next commands.
----------------------------------------------------------------
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:
[email protected]