Skip to content

Commit

Permalink
Fix heap dump path (#14105)
Browse files Browse the repository at this point in the history
* fix bug

* remove variable
  • Loading branch information
shuwenwei authored Nov 17, 2024
1 parent e2788a2 commit cfb4c8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand All @@ -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
Expand Down
21 changes: 9 additions & 12 deletions iotdb-core/datanode/src/assembly/resources/conf/datanode-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit cfb4c8a

Please sign in to comment.