You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2024/11/17 14:13:59 UTC

(iotdb) branch dev/1.3 updated: [to dev/1.3] Fix heap dump path (#14106)

This is an automated email from the ASF dual-hosted git repository.

tanxinyu pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 10b1899dfde [to dev/1.3] Fix heap dump path (#14106)
10b1899dfde is described below

commit 10b1899dfdeda65d40749871801887276dd1ce51
Author: shuwenwei <55...@users.noreply.github.com>
AuthorDate: Sun Nov 17 22:13:54 2024 +0800

    [to dev/1.3] Fix heap dump path (#14106)
    
    * fix bug
    
    * remove variable
---
 .../src/assembly/resources/conf/confignode-env.sh   |  9 ++++-----
 .../src/assembly/resources/conf/datanode-env.sh     | 21 +++++++++------------
 2 files changed, 13 insertions(+), 17 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 202fc759d04..6e1e188750f 100644
--- a/iotdb-core/confignode/src/assembly/resources/conf/confignode-env.sh
+++ b/iotdb-core/confignode/src/assembly/resources/conf/confignode-env.sh
@@ -148,12 +148,11 @@ 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`
+    cn_system_dir=`sed '/^cn_system_dir=/!d;s/.*=//' ${CONFIGNODE_CONF}/${config_file} | tail -n 1`
 
     if [ -z "$cn_system_dir" ]; then
         echo ""
@@ -163,18 +162,18 @@ get_cn_system_dir() {
     if [[ "$cn_system_dir" == /* ]]; then
         echo "$cn_system_dir"
     else
-        echo "$CONFIGNODE_CONF_DIR/../$cn_system_dir"
+        echo "$CONFIGNODE_HOME/$cn_system_dir"
     fi
 }
 
-if [ -f "${CONFIGNODE_CONF_DIR}/iotdb-system.properties" ]; then
+if [ -f "${CONFIGNODE_CONF}/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"
+  	heap_dump_dir="$CONFIGNODE_HOME/data/confignode/system"
 fi
 
 if [ ! -d "$heap_dump_dir" ]; then
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 aea7cbcd446..635b60e1115 100755
--- a/iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh
+++ b/iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh
@@ -143,43 +143,40 @@ calculate_memory_sizes()
 }
 
 
-DATANODE_CONF_DIR="`dirname "$0"`"
 # find first dir of dn_data_dirs from properties file
 get_first_data_dir() {
     local config_file="$1"
     local data_dir_value=""
 
-    data_dir_value=`sed '/^dn_data_dirs=/!d;s/.*=//' ${DATANODE_CONF_DIR}/${config_file} | tail -n 1`
+    data_dir_value=`sed '/^dn_data_dirs=/!d;s/.*=//' ${IOTDB_CONF}/${config_file} | tail -n 1`
 
     if [ -z "$data_dir_value" ]; then
         echo ""
         return 0
     fi
 
-    local first_dir=""
-
     if [[ "$data_dir_value" == *";"* ]]; then
-        first_dir=$(echo "$data_dir_value" | cut -d';' -f1)
+        data_dir_value=$(echo "$data_dir_value" | cut -d';' -f1)
     fi
-    if [[ "$first_dir" == *","* ]]; then
-        first_dir=$(echo "$first_dir" | cut -d',' -f1)
+    if [[ "$data_dir_value" == *","* ]]; then
+        data_dir_value=$(echo "$data_dir_value" | cut -d',' -f1)
     fi
 
-    if [[ "$first_dir" == /* ]]; then
-        echo "$first_dir"
+    if [[ "$data_dir_value" == /* ]]; then
+        echo "$data_dir_value"
     else
-        echo "$DATANODE_CONF_DIR/../$first_dir"
+        echo "$IOTDB_HOME/$data_dir_value"
     fi
 }
 
-if [ -f "${DATANODE_CONF_DIR}/iotdb-system.properties" ]; then
+if [ -f "${IOTDB_CONF}/iotdb-system.properties" ]; then
   	heap_dump_dir=$(get_first_data_dir "iotdb-system.properties")
 else
   	heap_dump_dir=$(get_first_data_dir "iotdb-datanode.properties")
 fi
 
 if [ -z "$heap_dump_dir" ]; then
-  	heap_dump_dir="$(dirname "$0")/../data/datanode/data"
+  	heap_dump_dir="$IOTDB_HOME/data/datanode/data"
 fi
 if [ ! -d "$heap_dump_dir" ]; then
   	mkdir -p "$heap_dump_dir"