You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2024/11/15 07:09:01 UTC
(iotdb) 03/06: [to dev/1.3] Add default value in config node scripts (#14089)
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch rc/1.3.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 33528476dc16e2de60b00813222436b1376c2a7b
Author: shuwenwei <55...@users.noreply.github.com>
AuthorDate: Thu Nov 14 18:24:33 2024 +0800
[to dev/1.3] Add default value in config node scripts (#14089)
---
.../src/assembly/resources/conf/confignode-env.sh | 34 +++++++++++++++++++++-
.../src/assembly/resources/conf/datanode-env.sh | 2 +-
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/iotdb-core/confignode/src/assembly/resources/conf/confignode-env.sh b/iotdb-core/confignode/src/assembly/resources/conf/confignode-env.sh
index 2e89a6f0d7f..202fc759d04 100644
--- a/iotdb-core/confignode/src/assembly/resources/conf/confignode-env.sh
+++ b/iotdb-core/confignode/src/assembly/resources/conf/confignode-env.sh
@@ -148,6 +148,38 @@ calculate_memory_sizes()
OFF_HEAP_MEMORY="${off_heap_memory_size_in_mb}M"
}
+CONFIGNODE_CONF_DIR="`dirname "$0"`"
+get_cn_system_dir() {
+ local config_file="$1"
+ local cn_system_dir=""
+
+ cn_system_dir=`sed '/^cn_system_dir=/!d;s/.*=//' ${CONFIGNODE_CONF_DIR}/${config_file} | tail -n 1`
+
+ if [ -z "$cn_system_dir" ]; then
+ echo ""
+ return 0
+ fi
+
+ if [[ "$cn_system_dir" == /* ]]; then
+ echo "$cn_system_dir"
+ else
+ echo "$CONFIGNODE_CONF_DIR/../$cn_system_dir"
+ fi
+}
+
+if [ -f "${CONFIGNODE_CONF_DIR}/iotdb-system.properties" ]; then
+ heap_dump_dir=$(get_cn_system_dir "iotdb-system.properties")
+else
+ heap_dump_dir=$(get_cn_system_dir "iotdb-confignode.properties")
+fi
+
+if [ -z "$heap_dump_dir" ]; then
+ heap_dump_dir="$(dirname "$0")/../data/confignode/system"
+fi
+
+if [ ! -d "$heap_dump_dir" ]; then
+ mkdir -p "$heap_dump_dir"
+fi
# find java in JAVA_HOME
if [ -n "$JAVA_HOME" ]; then
@@ -275,7 +307,7 @@ CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -XX:MaxDirectMemorySize=${OFF_HEAP_MEM
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Djdk.nio.maxCachedBufferSize=${MAX_CACHED_BUFFER_SIZE}"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+CrashOnOutOfMemoryError"
# 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
-#IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/confignode_heapdump.hprof"
+#IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${heap_dump_dir}/confignode_heapdump.hprof"
echo "ConfigNode on heap memory size = ${ON_HEAP_MEMORY}B, off heap memory size = ${OFF_HEAP_MEMORY}B"
echo "If you want to change this configuration, please check conf/confignode-env.sh."
diff --git a/iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh b/iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh
index dfbb63d04e1..aea7cbcd446 100755
--- a/iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh
+++ b/iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh
@@ -179,7 +179,7 @@ else
fi
if [ -z "$heap_dump_dir" ]; then
- heap_dump_dir="$(dirname "$0")/../data/datanode/data/"
+ heap_dump_dir="$(dirname "$0")/../data/datanode/data"
fi
if [ ! -d "$heap_dump_dir" ]; then
mkdir -p "$heap_dump_dir"