You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/01/20 02:52:15 UTC

[GitHub] [flink-docker] wangyang0918 commented on a change in pull request #57: [FLINK-21034] Refactor jemalloc switch to environment variable

wangyang0918 commented on a change in pull request #57:
URL: https://github.com/apache/flink-docker/pull/57#discussion_r560635988



##########
File path: docker-entrypoint.sh
##########
@@ -95,40 +94,34 @@ prepare_job_manager_start() {
     envsubst < "${CONF_FILE}" > "${CONF_FILE}.tmp" && mv "${CONF_FILE}.tmp" "${CONF_FILE}"
 }
 
-disable_jemalloc_env() {
-  # use nameref '_args' to update the passed 'args' within function
-  local -n _args=$1
-  if [ "${_args[0]}" = ${COMMAND_DISABLE_JEMALLOC} ]; then
-      echo "Disable Jemalloc as the memory allocator"
-      _args=("${_args[@]:1}")
-  else
-      export LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/libjemalloc.so
-  fi
+maybe_enable_jemalloc() {

Review comment:
       Since the `jemalloc` is enabled by default, maybe the name `disable_jemalloc_if_required` is better. It is aligned with `copy_plugins_if_required`.

##########
File path: docker-entrypoint.sh
##########
@@ -95,40 +94,34 @@ prepare_job_manager_start() {
     envsubst < "${CONF_FILE}" > "${CONF_FILE}.tmp" && mv "${CONF_FILE}.tmp" "${CONF_FILE}"
 }
 
-disable_jemalloc_env() {
-  # use nameref '_args' to update the passed 'args' within function
-  local -n _args=$1
-  if [ "${_args[0]}" = ${COMMAND_DISABLE_JEMALLOC} ]; then
-      echo "Disable Jemalloc as the memory allocator"
-      _args=("${_args[@]:1}")
-  else
-      export LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/libjemalloc.so
-  fi
+maybe_enable_jemalloc() {
+    if ! [ "${DISABLE_JEMALLOC:-false}" == "true" ]; then

Review comment:
       ```suggestion
       if [ "${DISABLE_JEMALLOC:-false}" != "true" ]; then
   ```
   Or
   ```suggestion
       if [ "${DISABLE_JEMALLOC:-false}" == "false" ]; then
   ```

##########
File path: testing/bin/docker-entrypoint.sh
##########
@@ -0,0 +1,37 @@
+#!/bin/bash -e
+
+###############################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+
+if ! [ "$1" == "hello" ] || ! [ "$2" == "world" ]; then
+    echo "Incorrect arguments passed through:" "$@"
+    exit 1
+fi
+
+originalLdPreloadSetting=$3
+jemallocDisabled=$4
+
+if [ "$jemallocDisabled" == "true" ] && ! [ "$originalLdPreloadSetting" == "$LD_PRELOAD" ]; then
+    echo "jemalloc was not disabled; exploed LD_PRELOAD to be '$originalLdPreloadSetting' but was '$LD_PRELOAD'"

Review comment:
       typo here? `exploed` -> `expected`




----------------------------------------------------------------
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:
users@infra.apache.org