bitflicker64 commented on code in PR #3134:
URL: https://github.com/apache/hugegraph/pull/3134#discussion_r4125585460


##########
pom.xml:
##########
@@ -203,6 +204,8 @@
                             <exclude>.gitattributes</exclude>
                             <!-- AI Tools -->
                             <exclude>.serena/**</exclude>
+                            <!-- Local validation evidence, not a release 
artifact -->
+                            <exclude>.goal-task/**</exclude>

Review Comment:
   Important: should not exist. `.goal-task/toplingdb-linux-closure/` is 15 
files and 1,496 lines of agent working state: `state.md`, `todo.md`, `mac.md`, 
`linux.md`, three `lessons*.md`, and four `*-history-20260926.md` logs, most of 
it in Chinese and about which machine runs which check. This RAT exclusion 
exists only so those files survive the license check, and its own comment says 
they are "not a release artifact". They still land in every git-based source 
release.
   
   Delete the directory and this `<exclude>` line. If a lesson in there matters 
to the next contributor, move that one line into 
`docs/toplingdb/toplingdb-development.md`.



##########
docs/toplingdb/README.md:
##########
@@ -0,0 +1,33 @@
+# ToplingDB Documentation
+
+ToplingDB is an optional RocksDB-compatible runtime for HugeGraph. Select it
+when a HugeGraph process owns a local RocksDB database:
+
+| Deployment | Process that selects ToplingDB |
+|---|---|
+| Standalone | HugeGraph Server |
+| Distributed HStore | PD and Store |
+| HStore-backed Server | None; it is a remote client |
+
+Start with one of these paths:
+
+- [Quickstart](toplingdb-quickstart.md) explains how to build a Topling
+  distribution, select the provider, keep its data separate, start the
+  component, and return to standard RocksDB safely.
+- [Developer guide](toplingdb-development.md) covers the source layout,
+  distribution contract, tests, CI, Docker status, and native runtime work.
+- [Issue illustrations](images/issues/v1/README.md) explains the scope and

Review Comment:
   Important: should not exist. `docs/toplingdb/images/issues/v1/` adds 11 PNGs 
(13.3 MB total, 1.1 to 1.4 MB each) plus `prompts.json`, `assets.json` and 
`index.html`. Its README says they were made with a built-in `image_gen`, and 
`prompts.json` holds the generation prompts. Every image illustrates an issue 
in the `hugegraph/hugegraph` fork tracker (#240, #248 to #255, #212, #213), not 
in apache/hugegraph, so the links are meaningless to readers of this repo, and 
a 13 MB binary blob in history cannot be removed later without a rewrite.
   
   Delete the directory and this bullet (lines 19-20). The issues can host 
their own images.



##########
hugegraph-server/hugegraph-dist/src/assembly/travis/install-rocksdb.sh:
##########
@@ -0,0 +1,197 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if [ "$(uname -s)" != "Linux" ]; then
+    echo "[install-rocksdb] Skip native preload on non-Linux platform: $(uname 
-s)"
+    return 0 2>/dev/null || exit 0
+fi
+
+ORIG_SHELL_FLAGS="$-"
+ORIG_PIPEFAIL="$(set -o | awk '$1 == "pipefail" { print $2 }')"
+ORIG_ERR_TRAP="$(trap -p ERR)"
+ORIG_EXIT_TRAP="$(trap -p EXIT)"
+# Save original IFS to avoid leaking into parent shell when sourced
+ORIG_IFS="${IFS}"
+set -Eeuo pipefail
+IFS=$'\n\t'
+
+install_rocksdb_restore_state() {
+    local exit_status=$?
+
+    # Prevent recursive execution while restoring the caller's EXIT trap.
+    trap - EXIT
+    IFS="$ORIG_IFS"
+    if [ -n "$ORIG_ERR_TRAP" ]; then
+        eval "$ORIG_ERR_TRAP"
+    else
+        trap - ERR
+    fi
+    if [ -n "$ORIG_EXIT_TRAP" ]; then
+        eval "$ORIG_EXIT_TRAP"
+    else
+        trap - EXIT
+    fi
+    case "$ORIG_SHELL_FLAGS" in *e*) set -e ;; *) set +e ;; esac
+    case "$ORIG_SHELL_FLAGS" in *u*) set -u ;; *) set +u ;; esac
+    case "$ORIG_SHELL_FLAGS" in *E*) set -E ;; *) set +E ;; esac
+    if [ "$ORIG_PIPEFAIL" = "on" ]; then
+        set -o pipefail
+    else
+        set +o pipefail
+    fi
+    return "$exit_status"
+}
+trap install_rocksdb_restore_state EXIT
+
+# Unified error capture for easy positioning
+trap 'echo "[install-rocksdb] error at line ${LINENO}: ${BASH_COMMAND}" >&2' 
ERR
+
+VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+COMPONENT="${1:-server}"
+SERVER_VERSION_DIR="$(pwd)/hugegraph-server/apache-hugegraph-server-$VERSION"
+TOPLING_SOURCE_LIB="$(pwd)/hugegraph-server/hugegraph-dist/src/assembly/static/lib/topling"
+
+case "$COMPONENT" in
+    server | hstore)
+        COMPONENT_VERSION_DIR="$SERVER_VERSION_DIR"
+        ;;
+    pd)
+        
COMPONENT_VERSION_DIR="$(pwd)/hugegraph-pd/apache-hugegraph-pd-$VERSION"
+        ;;
+    store)
+        
COMPONENT_VERSION_DIR="$(pwd)/hugegraph-store/apache-hugegraph-store-$VERSION"
+        ;;
+    *)
+        echo "Error: unsupported component '$COMPONENT' (expected server, pd, 
store, or hstore)" >&2
+        exit 1
+        ;;
+esac
+COMPONENT_BIN="$COMPONENT_VERSION_DIR/bin"
+COMPONENT_LIB="$COMPONENT_VERSION_DIR/lib"
+
+if [ ! -d "$COMPONENT_VERSION_DIR" ]; then
+    echo "Error: component dir not found: $COMPONENT_VERSION_DIR" >&2
+    exit 1
+fi
+
+detect_rocksdb_provider() {
+    local conf_dir="$1"
+    local file
+    local -a values=()
+    local -a unique_values=()
+    local value existing duplicate conflicts
+
+    for file in "$conf_dir"/graphs/*.properties; do
+        [ -f "$file" ] || continue
+        while IFS= read -r value; do
+            values[${#values[@]}]="$value"
+        done < <(
+            awk '
+                /^[[:space:]]*#/ { next }
+                /^[[:space:]]*rocksdb\.provider[[:space:]]*=/ {
+                    value = $0
+                    sub(/^[^=]*=[[:space:]]*/, "", value)
+                    sub(/[[:space:]]+#.*/, "", value)
+                    gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
+                    print value
+                }
+            ' "$file"
+        )
+    done
+    for file in "$conf_dir"/application*.yml; do
+        [ -f "$file" ] || continue
+        while IFS= read -r value; do
+            values[${#values[@]}]="$value"
+        done < <(
+            awk '
+                /^[[:space:]]*#/ || /^[[:space:]]*$/ { next }
+                /^[^[:space:]#][^:]*:/ {
+                    in_rocksdb = ($0 ~ /^rocksdb[[:space:]]*:/)
+                }
+                in_rocksdb && /^[[:space:]]+provider[[:space:]]*:/ {
+                    value = $0
+                    sub(/^[^:]*:[[:space:]]*/, "", value)
+                    sub(/[[:space:]]+#.*/, "", value)
+                    gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
+                    if (value ~ /^"[^"]*"$/ || value ~ /^'\''[^'\'']*'\''$/) {
+                        value = substr(value, 2, length(value) - 2)
+                    }
+                    print value
+                }
+            ' "$file"
+        )
+    done
+
+    for value in "${values[@]}"; do
+        duplicate=false
+        for existing in "${unique_values[@]}"; do
+            if [ "$existing" = "$value" ]; then
+                duplicate=true
+                break
+            fi
+        done
+        if [ "$duplicate" = false ]; then
+            unique_values+=("$value")
+        fi
+    done
+
+    if [ "${#unique_values[@]}" -gt 1 ]; then
+        conflicts=$(IFS=,; echo "${unique_values[*]}")
+        echo "Error: conflicting rocksdb.provider values: $conflicts" >&2
+        return 1
+    fi
+    local provider="${unique_values[0]:-rocksdb}"
+    case "$provider" in
+        rocksdb | topling)
+            echo "$provider"
+            ;;
+        *)
+            echo "Error: invalid rocksdb.provider '$provider'; expected 
rocksdb or topling" >&2
+            return 1
+            ;;
+    esac
+}
+
+PROVIDER=$(detect_rocksdb_provider "$COMPONENT_VERSION_DIR/conf") || exit 1
+
+if [ "$PROVIDER" = "topling" ]; then

Review Comment:
   Important: replace or collapse. The Topling branch here never runs. Every 
caller sources this on a stock distribution: `pd-store-ci.yml:276,421,572-574`, 
`server-ci.yml:200,257`, and the new lines in `run-unit-test.sh`, 
`run-core-test.sh` and `run-api-test.sh`. In all three stock configs the 
provider line is commented out (`#rocksdb.provider=topling`, `# provider: 
topling`, `#   provider: rocksdb`), so `detect_rocksdb_provider` returns 
`rocksdb` and the script prints "skipping native preload". The Topling CI jobs 
(`server-rocksdb-runtime`, `distributed-rocksdb-runtime`) go through 
`install-dist/scripts/build-topling-distribution.sh` instead, which runs 
`prepare-topling.sh` itself.
   
   So the file is 197 lines of shell-state save/restore wrapped around a no-op, 
and `detect_rocksdb_provider` is a second copy of the one in 
`preload-topling.sh:34-91`, with the same two awk programs. Delete 
`install-rocksdb.sh` and the 10 `source ... install-rocksdb.sh` lines. If a 
future job needs a Topling distribution, it already has 
`build-topling-distribution.sh`.



-- 
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