Skip to content

Commit 3352847

Browse files
shuwenweiHTHou
authored andcommitted
[to dev/1.3] Add default value in config node scripts (#14089)
1 parent 316bfb5 commit 3352847

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

iotdb-core/confignode/src/assembly/resources/conf/confignode-env.sh

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,38 @@ calculate_memory_sizes()
148148
OFF_HEAP_MEMORY="${off_heap_memory_size_in_mb}M"
149149
}
150150

151+
CONFIGNODE_CONF_DIR="`dirname "$0"`"
152+
get_cn_system_dir() {
153+
local config_file="$1"
154+
local cn_system_dir=""
155+
156+
cn_system_dir=`sed '/^cn_system_dir=/!d;s/.*=//' ${CONFIGNODE_CONF_DIR}/${config_file} | tail -n 1`
157+
158+
if [ -z "$cn_system_dir" ]; then
159+
echo ""
160+
return 0
161+
fi
162+
163+
if [[ "$cn_system_dir" == /* ]]; then
164+
echo "$cn_system_dir"
165+
else
166+
echo "$CONFIGNODE_CONF_DIR/../$cn_system_dir"
167+
fi
168+
}
169+
170+
if [ -f "${CONFIGNODE_CONF_DIR}/iotdb-system.properties" ]; then
171+
heap_dump_dir=$(get_cn_system_dir "iotdb-system.properties")
172+
else
173+
heap_dump_dir=$(get_cn_system_dir "iotdb-confignode.properties")
174+
fi
175+
176+
if [ -z "$heap_dump_dir" ]; then
177+
heap_dump_dir="$(dirname "$0")/../data/confignode/system"
178+
fi
179+
180+
if [ ! -d "$heap_dump_dir" ]; then
181+
mkdir -p "$heap_dump_dir"
182+
fi
151183

152184
# find java in JAVA_HOME
153185
if [ -n "$JAVA_HOME" ]; then
@@ -275,7 +307,7 @@ CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -XX:MaxDirectMemorySize=${OFF_HEAP_MEM
275307
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Djdk.nio.maxCachedBufferSize=${MAX_CACHED_BUFFER_SIZE}"
276308
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+CrashOnOutOfMemoryError"
277309
# if you want to dump the heap memory while OOM happening, you can use the following command, remember to replace /tmp/heapdump.hprof with your own file path and the folder where this file is located needs to be created in advance
278-
#IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/confignode_heapdump.hprof"
310+
#IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${heap_dump_dir}/confignode_heapdump.hprof"
279311

280312
echo "ConfigNode on heap memory size = ${ON_HEAP_MEMORY}B, off heap memory size = ${OFF_HEAP_MEMORY}B"
281313
echo "If you want to change this configuration, please check conf/confignode-env.sh."

iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ else
179179
fi
180180

181181
if [ -z "$heap_dump_dir" ]; then
182-
heap_dump_dir="$(dirname "$0")/../data/datanode/data/"
182+
heap_dump_dir="$(dirname "$0")/../data/datanode/data"
183183
fi
184184
if [ ! -d "$heap_dump_dir" ]; then
185185
mkdir -p "$heap_dump_dir"

0 commit comments

Comments
 (0)