Github user mxm commented on a diff in the pull request:
https://github.com/apache/flink/pull/1129#discussion_r39493894
--- Diff: flink-dist/src/main/flink-bin/bin/taskmanager.sh ---
@@ -51,13 +51,41 @@ if [[ $STARTSTOP == "start" ]]; then
fi
fi
- if [[ ! ${FLINK_TM_HEAP} =~ ${IS_NUMBER} ]]; then
- echo "[ERROR] Configured TaskManager JVM heap size is not a
number. Please set '$KEY_TASKM_HEAP_MB' in $FLINK_CONF_FILE."
+ if [[ ! ${FLINK_TM_HEAP} =~ ${IS_NUMBER} ]] || [[ "${FLINK_TM_HEAP}"
-lt "0" ]]; then
+ echo "[ERROR] Configured TaskManager JVM heap size is not a
number. Please set '${KEY_TASKM_MEM_SIZE}' in ${FLINK_CONF_FILE}."
exit 1
fi
- if [ "$FLINK_TM_HEAP" -gt 0 ]; then
- export JVM_ARGS="$JVM_ARGS -Xms"$FLINK_TM_HEAP"m
-Xmx"$FLINK_TM_HEAP"m"
+ if [ "${FLINK_TM_HEAP}" -gt "0" ]; then
+
+ TM_HEAP_SIZE=${FLINK_TM_HEAP}
+ TM_OFFHEAP_SIZE=0
+ # some space for Netty initilization
+ NETTY_BUFFERS=$((1024 * 1024))
+
+ if useOffHeapMemory; then
+ if [[ "${FLINK_TM_MEM_MANAGED_SIZE}" -gt "0" ]]; then
+ # We split up the total memory in heap and off-heap memory
+ if [[ "${FLINK_TM_HEAP}" -le
"${FLINK_TM_MEM_MANAGED_SIZE}" ]]; then
+ echo "[ERROR] Configured TaskManager memory size
('${KEY_TASKM_MEM_SIZE}') must be larger than the managed memory size
('${KEY_TASKM_MEM_MANAGED_SIZE}')."
+ exit 1
+ fi
+ TM_OFFHEAP_SIZE=${FLINK_TM_MEM_MANAGED_SIZE}
+ TM_HEAP_SIZE=$((FLINK_TM_HEAP - FLINK_TM_MEM_MANAGED_SIZE))
+ else
+ # We calculate the memory using a fraction of the total
memory
+ if [[ `bc -l <<< "${FLINK_TM_MEM_MANAGED_FRACTION} >=
1.0"` != "0" ]]; then
+ echo "[ERROR] Configured TaskManager managed memory
fraction is not a valid value. Please set '${KEY_TASKM_MEM_MANAGED_FRACTION}'
in ${FLINK_CONF_FILE}"
--- End diff --
Thanks, added a lower bound.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---