imbajin commented on code in PR #3253:
URL: https://github.com/apache/hugegraph/pull/3253#discussion_r4166640827


##########
hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh:
##########
@@ -105,17 +100,26 @@ if [ -z "$DAEMON" ]; then
     DAEMON="true"
 fi
 
-while getopts "d:g:j:y:" arg; do
+while getopts "d:c:g:i:j:l:y:" arg; do
     case ${arg} in
+        c) CONF_OVERRIDE="$OPTARG" ;;
         g) GC_OPTION="$OPTARG" ;;
+        i) PID_FILE_OVERRIDE="$OPTARG" ;;
         j) USER_OPTION="$OPTARG" ;;
+        l) LOGS_OVERRIDE="$OPTARG" ;;
         # Telemetry is used to collect metrics, traces and logs
         y) OPEN_TELEMETRY="$OPTARG" ;;
         d) DAEMON="$OPTARG" ;;
-        ?) echo "USAGE: $0 [-d true|false] [-g g1] [-j xxx] [-y true|false]" 
&& exit 1 ;;
+        ?) echo "USAGE: $0 [-d true|false] [-c conf_dir] [-g g1] [-i pid_file] 
[-j opts] [-l logs_dir] [-y true|false]" && exit 1 ;;
     esac
 done
 
+CONF="${CONF_OVERRIDE:-$TOP/conf}"
+LOGS="${LOGS_OVERRIDE:-$TOP/logs}"
+PLUGINS="$TOP/plugins"
+OUTPUT=${LOGS}/hugegraph-store-server.log
+PID_FILE="${PID_FILE_OVERRIDE:-$BIN/pid}"

Review Comment:
   ⚠️ Important: This path is used to write the PID only after the background 
server is launched. If the supplied file's parent is missing or unwritable, 
that write fails but the script continues, leaving the process without a PID 
file for the stop script. Please validate the path before launch, or stop the 
just-launched process and exit when the PID write fails. Evidence: exact-head 
trace from this assignment to the later unchecked PID redirection at line 247; 
PD and Server also write their PID after launching.



##########
hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh:
##########
@@ -53,13 +56,13 @@ function abs_path() {
 
 BIN=$(abs_path)
 TOP="$(cd "$BIN"/../ && pwd)"
-CONF="$TOP/conf"
+CONF="${CONF_OVERRIDE:-$TOP/conf}"
 LIB="$TOP/lib"
 PLUGINS="$TOP/plugins"
-LOGS="$TOP/logs"
+LOGS="${LOGS_OVERRIDE:-$TOP/logs}"
 OUTPUT=${LOGS}/hugegraph-pd-stdout.log
 GITHUB="https://github.com";
-PID_FILE="$BIN/pid"
+PID_FILE="${PID_FILE_OVERRIDE:-$BIN/pid}"

Review Comment:
   ⚠️ Important: The `-i` value stays relative here, but PD changes to `$TOP` 
before writing it while `stop-hugegraph-pd.sh` checks the same value from the 
caller's working directory. Starting and stopping outside the install root with 
`-i run/pid` therefore addresses different files and can leave the process 
running. Please resolve the override to an absolute path before changing 
directories, or define and use the same base in both scripts. Evidence: 
exact-head trace of `start-hugegraph-pd.sh` (`cd "$TOP"` before the PID write) 
and `stop-hugegraph-pd.sh` (no matching `cd`); Store has the same pattern.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to