imbajin commented on code in PR #2952:
URL: https://github.com/apache/hugegraph/pull/2952#discussion_r2878257556
##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh:
##########
@@ -29,11 +29,17 @@ function abs_path() {
BIN=$(abs_path)
TOP="$(cd "$BIN"/../ && pwd)"
GRAPH_CONF="$TOP/conf/graphs/hugegraph.properties"
-WAIT_STORAGE_TIMEOUT_S=120
-DETECT_STORAGE="$TOP/scripts/detect-storage.groovy"
+WAIT_STORAGE_TIMEOUT_S=300
. "$BIN"/util.sh
+log() {
+ echo "[wait-storage] $1"
+}
+
+# Hardcoded PD auth
+PD_AUTH_ARGS="-u store:admin"
Review Comment:
‼️ **Hardcoded credentials**
`PD_AUTH_ARGS` is hardcoded to `-u store:admin`. Any deployment using a
non-default password will silently fail here since there is no way to override
this value.
Consider reading from env vars with a fallback:
```suggestion
PD_AUTH_ARGS="-u ${PD_AUTH_USER:-store}:${PD_AUTH_PASSWORD:-admin}"
```
##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh:
##########
@@ -70,7 +76,48 @@ done < <(env | sort -r | awk -F= '{ st = index($0, "=");
print $1 " " substr($0,
# wait for storage
if env | grep '^hugegraph\.' > /dev/null; then
if [ -n "${WAIT_STORAGE_TIMEOUT_S:-}" ]; then
- timeout "${WAIT_STORAGE_TIMEOUT_S}s" bash -c \
- "until bin/gremlin-console.sh -- -e $DETECT_STORAGE > /dev/null 2>&1;
do echo \"Hugegraph server are waiting for storage backend...\"; sleep 5; done"
+
+ PD_PEERS="${hugegraph_pd_peers:-}"
+ if [ -z "$PD_PEERS" ]; then
+ PD_PEERS=$(grep -E "^\s*pd\.peers\s*=" "$GRAPH_CONF" | sed
's/.*=\s*//' | tr -d ' ')
+ fi
+
+ if [ -n "$PD_PEERS" ]; then
+ : "${HG_SERVER_PD_REST_ENDPOINT:=}"
+
+ if [ -n "${HG_SERVER_PD_REST_ENDPOINT}" ]; then
+ PD_REST="${HG_SERVER_PD_REST_ENDPOINT}"
+ else
+ PD_REST=$(echo "$PD_PEERS" | sed 's/:8686/:8620/g' | cut -d','
-f1)
+ fi
+
+ log "PD REST endpoint = $PD_REST"
+ log "Timeout = ${WAIT_STORAGE_TIMEOUT_S}s"
+
+ timeout "${WAIT_STORAGE_TIMEOUT_S}s" bash -c "
+
+ log() { echo '[wait-storage] '\"\$1\"; }
+
+ until curl ${PD_AUTH_ARGS} -f -s \
+ http://${PD_REST}/v1/health >/dev/null 2>&1; do
+ log 'PD not ready, retrying in 5s'
+ sleep 5
+ done
+ log 'PD health check PASSED'
+
+ until curl ${PD_AUTH_ARGS} -f -s \
Review Comment:
‼️ **`detect-storage.groovy` removed without a real replacement**
The original storage readiness check used `gremlin-console.sh -- -e
detect-storage.groovy`, which actually verified the server could connect and
execute queries against the backend. That check has been replaced by polling
`PD /v1/health` and `PD /v1/stores`.
Those HTTP checks only confirm PD is alive and a store is registered — they
do **not** verify that HugeGraph Server can successfully read/write through the
backend. The `detect-storage.groovy` script has also been commented out from
`Dockerfile-hstore`, so there is no fallback path.
This is a functional regression — the server may start and report healthy
while the storage backend is actually not usable.
--
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]