vaijosh commented on code in PR #3021:
URL: https://github.com/apache/hugegraph/pull/3021#discussion_r3249184227


##########
hugegraph-server/hugegraph-hbase/pom.xml:
##########
@@ -27,24 +27,49 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>hugegraph-hbase</artifactId>
-
+    <properties>
+        <hbase.version>2.6.5</hbase.version>
+    </properties>
     <dependencies>
         <dependency>
             <groupId>org.apache.hugegraph</groupId>
             <artifactId>hugegraph-core</artifactId>
             <version>${revision}</version>
         </dependency>
+        <!--
+            hbase-endpoint must come before hbase-shaded-client so that the
+            unshaded LongColumnInterpreter (using com.google.protobuf) is on
+            the classpath ahead of the shaded variant, allowing 
AggregationClient
+            rowCount() generic bounds to resolve correctly.
+        -->
         <dependency>
-            <groupId>com.baidu.hugegraph</groupId>
-            <artifactId>hbase-shaded-endpoint</artifactId>
-            <version>2.0.6</version>
+            <groupId>org.apache.hbase</groupId>
+            <artifactId>hbase-endpoint</artifactId>
+            <version>${hbase.version}</version>
             <exclusions>
                 <exclusion>
-                    <groupId>log4j</groupId>
-                    <artifactId>log4j</artifactId>
+                    <groupId>org.apache.hbase</groupId>
+                    <artifactId>hbase-server</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.hadoop</groupId>
+                    <artifactId>hadoop-common</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.hadoop</groupId>
+                    <artifactId>hadoop-hdfs</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.hadoop</groupId>
+                    <artifactId>hadoop-mapreduce-client-core</artifactId>
                 </exclusion>

Review Comment:
   Done



##########
docker/HBASE.md:
##########
@@ -0,0 +1,425 @@
+# HBase Backend Testing with Docker
+
+This guide explains how to start HBase locally with Docker, verify it is 
working, and validate HugeGraph API operations.
+
+> **All commands in this guide should be run from the repository root** unless 
otherwise noted.
+
+> **Recent path change**: The HBase compose file moved from 
`docker/docker-compose.hbase.yml` to `docker/hbase/docker-compose.hbase.yml`. 
If you have older shell history/scripts, update `-f` accordingly.
+
+> **Security note**: The HBase Docker build enforces SHA512 verification by 
default and fails when checksum download/parsing/validation fails. Only use 
`--build-arg ALLOW_UNVERIFIED_DOWNLOAD=true` for trusted test environments with 
restricted networks.
+
+---
+
+## Quick Start
+
+### 0. (Optional) Clean Up Leftover HBase Tables
+```bash
+docker compose -f docker/hbase/docker-compose.hbase.yml build --no-cache hbase
+```
+
+### 1. Start HBase with Docker
+
+```bash
+docker compose -f docker/hbase/docker-compose.hbase.yml up -d
+```
+
+### 2. Wait for HBase to be Ready (~2 minutes)
+
+```bash
+# Check ZooKeeper connectivity
+nc -z localhost 2181 && echo "Ready" || echo "Not ready"
+
+# Or watch the logs
+docker compose -f docker/hbase/docker-compose.hbase.yml logs
+```
+
+### 3. (Optional) Clean Up Leftover HBase Tables
+
+For reruns, drop any leftover HugeGraph tables after the container is up:
+
+```bash
+docker exec hg-hbase-test bash -c '
+  for t in $(echo "list" | hbase shell -n 2>/dev/null | grep 
"^default_hugegraph"); do
+    echo "disable '"'"'$t'"'"'; drop '"'"'$t'"'"'"
+  done | hbase shell
+'
+```
+
+Verify tables are gone before proceeding:
+
+```bash
+docker exec hg-hbase-test bash -lc "echo 'list' | hbase shell -n"
+# Expected: TABLE (empty), 0 row(s)
+```
+
+
+### 4. Configure and Init the HugeGraph Server (required for API tests)
+
+> This step is only needed for HugeGraph API sanity checks.
+
+> **Prerequisite**: Run `mvn clean package -DskipTests` from the repository 
root to generate the distribution. This creates an 
`apache-hugegraph-<version>/` directory with all necessary binaries and configs.
+
+Set backend to HBase in the server config:
+
+```bash
+SERVER_DIR="$(find . -maxdepth 3 -type d -path 
'./apache-hugegraph-*/apache-hugegraph-server-*' | head -n 1)"
+SERVER_DIR="${SERVER_DIR#./}"
+[ -n "$SERVER_DIR" ] || { echo "HugeGraph server runtime not found. Run mvn 
clean package -DskipTests first."; exit 1; }
+CONF="$SERVER_DIR/conf/graphs/hugegraph.properties"
+
+# Switch backend to hbase
+perl -pi -e 's/^backend=.*/backend=hbase/'     "$CONF"
+perl -pi -e 's/^serializer=.*/serializer=hbase/' "$CONF"
+
+# Uncomment HBase connection settings
+perl -pi -e 's/^#(hbase\.hosts=.*)/$1/'        "$CONF"
+perl -pi -e 's/^#(hbase\.port=.*)/$1/'         "$CONF"
+perl -pi -e 's/^#(hbase\.znode_parent=.*)/$1/' "$CONF"
+```
+
+Initialize HBase tables and start the server:
+
+```bash
+printf 'pa\npa\n' | "$SERVER_DIR/bin/init-store.sh"
+"$SERVER_DIR/bin/start-hugegraph.sh" -t 60
+```
+
+After `init-store.sh`, you can verify the tables were created:
+
+```bash
+docker exec hg-hbase-test bash -lc "echo 'list' | hbase shell -n"
+```
+
+---
+
+## Docker Compose Services
+
+### HBase Container
+
+- **Image**: `hugegraph/hbase:2.6.5`
+- **Container Name**: `hg-hbase-test`
+- **Hostname**: `hbase`
+- **Ports**:
+  - `2181` - ZooKeeper (embedded)
+  - `16000` - HBase Master RPC
+  - `16010` - HBase Master Web UI (http://localhost:16010)
+  - `16020` - HBase RegionServer RPC
+  - `16030` - HBase RegionServer Web UI (http://localhost:16030)
+- **Health Check**: ZooKeeper connectivity on port 2181
+- **Startup Time**: ~90-120 seconds
+
+---
+
+## Manual Verification
+
+### 1. Check Container is Healthy
+
+```bash
+docker compose -f docker/hbase/docker-compose.hbase.yml ps
+docker logs hg-hbase-test | tail -50
+```
+
+### 2. Check ZooKeeper Connectivity
+
+```bash
+# From host machine
+nc -z localhost 2181 && echo "ZooKeeper OK" || echo "ZooKeeper not ready"
+
+# From inside the container
+docker exec hg-hbase-test nc -z localhost 2181 && echo "Ready" || echo "Not 
ready"
+```
+
+### 3. Check HBase Master and RegionServer Web UIs
+
+```bash
+# HBase Master Web UI (should return HTML)
+curl -s http://localhost:16010 | head -20
+
+# RegionServer Web UI
+curl -s http://localhost:16030 | head -20
+
+# Or open in browser
+open http://localhost:16010
+```
+
+### 4. Verify HBase Tables via Shell
+
+```bash
+# List all tables (should show HugeGraph tables after init-store)
+docker exec hg-hbase-test bash -lc "echo 'list' | hbase shell -n"
+
+# Check a specific table exists (example: after backend init)
+docker exec hg-hbase-test bash -lc 'echo "describe 
'"'"'default_hugegraph:g_v'"'"'" | hbase shell -n'
+```
+
+### 5. Verify HBase Logs for Errors
+
+```bash
+# Check for any ERROR lines in HBase logs
+docker exec hg-hbase-test bash -lc "grep -i error /opt/hbase/logs/*.log | tail 
-20"
+
+# Tail live logs (run from repo root)
+docker compose -f docker/hbase/docker-compose.hbase.yml logs
+```
+
+> **Known benign messages** — these are safe to ignore in standalone mode:
+> - `SASL config status: Will not attempt to authenticate using SASL (unknown 
error)` — ZooKeeper SASL is not configured; standalone HBase does not need it.
+> - `Invalid configuration, only one server specified (ignoring)` — expected 
when running a single-node ZooKeeper.
+> - `NoClassDefFoundError: org/eclipse/jetty/...` — Jetty UI dependency 
missing in the container; does not affect HBase or ZooKeeper functionality.
+
+---
+
+## Manual API Sanity (curl)
+
+These steps assume the HugeGraph server is running at `http://localhost:8080` 
with auth enabled (`admin/pa`).
+
+> **Note on Idempotency**: Schema creation calls below use `"check_exist": 
false`. Re-running is safe only when the submitted schema definition matches 
the existing one. If definitions conflict, HugeGraph returns `ExistedException`.
+>
+> **Prerequisite**: The HBase backend tables must be initialized before any 
API calls will work. If you see `TableNotFoundException` errors, re-run 
`init-store.sh` (see Step 0 below or the Quick Start section).
+
+### 0. Initialize Backend and Start Server
+
+> **Skip this if the server is already running.** This step is required the 
first time or after a full cleanup.
+>
+> **Prerequisite**: Run `mvn clean package -DskipTests` from the repository 
root first to generate the distribution.
+
+```bash
+SERVER_DIR="$(find . -maxdepth 3 -type d -path 
'./apache-hugegraph-*/apache-hugegraph-server-*' | head -n 1)"
+SERVER_DIR="${SERVER_DIR#./}"
+[ -n "$SERVER_DIR" ] || { echo "HugeGraph server runtime not found. Run mvn 
clean package -DskipTests first."; exit 1; }
+
+# Initialize HBase tables (enter password 'pa' when prompted)
+printf 'pa\npa\n' | "$SERVER_DIR/bin/init-store.sh"
+
+# Start the server (wait up to 60s for startup)
+"$SERVER_DIR/bin/start-hugegraph.sh" -t 60
+```
+
+Verify the server is up before continuing:
+
+### 1. Check Server is Up
+
+```bash
+curl -s http://localhost:8080/versions | python3 -m json.tool
+```
+
+### 2. List Graphs
+
+```bash
+curl -s -u admin:pa http://localhost:8080/graphspaces/DEFAULT/graphs | python3 
-m json.tool
+```
+
+### 3. Create Property Keys
+
+Create multiple property keys for testing. Re-running with the same schema 
returns the existing definition.
+
+```bash
+# Text property
+curl -s -u admin:pa -X POST \
+  
http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/propertykeys \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "name": "email",
+    "data_type": "TEXT",
+    "cardinality": "SINGLE",
+    "check_exist": false
+  }' | python3 -m json.tool
+
+# Numeric property
+curl -s -u admin:pa -X POST \
+  
http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/propertykeys \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "name": "age",
+    "data_type": "INT",
+    "cardinality": "SINGLE",
+    "check_exist": false
+  }' | python3 -m json.tool
+```
+
+### 4. Create a Vertex Label
+
+```bash
+curl -s -u admin:pa -X POST \
+  
http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabels \
+  -H 'Content-Type: application/json' \
+  -d '{
+    "name": "user",
+    "id_strategy": "PRIMARY_KEY",
+    "primary_keys": ["email"],
+    "properties": ["email", "age"],
+    "check_exist": false
+  }' | python3 -m json.tool
+```

Review Comment:
   fixed



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