Commit Graph

2148 Commits

Author SHA1 Message Date
KAI de62d97f34
fix(server): configure finite DNS cache TTL (#3126)
1. A Store pod is replaced in Kubernetes and comes back on a new IP behind the
   same stable DNS name.
2. HugeGraph Server runs with `HugeSecurityManager` installed by default.
3. With a `SecurityManager` present and no explicit policy, Java 11 falls back to
   `networkaddress.cache.ttl = -1`, so `InetAddressCachePolicy` is `FOREVER`.
4. The Server therefore keeps resolving the Store name to the old pod IP, and
   HStore writes keep going to an address that no longer exists.
5. Nothing recovers this until the Server process is restarted.

The setting is only honoured as a **security** property. The ordinary
`-Dnetworkaddress.cache.ttl` system property has no effect here, which is why
that form is deliberately not used.

---------

Co-authored-by: imbajin <jin@apache.org>
2026-08-04 21:24:18 +08:00
KAI 1716c77486
refactor: replace lsof port preflight with ss/netstat (#3105)
Fix a startup hang in kind/Kubernetes environments — the case that surfaced while bringing up the Helm chart. In a pod where `ulimit -n` is very large, `lsof -i :PORT` walks an enormous file descriptor table and `start-hugegraph.sh` stalls before the server ever binds.

The fix replaces that `lsof` call in the server's `check_port`, and removes the dead `check_port` copies from PD/Store.
- retain a bounded real-clock startup smoke test

---------

Co-authored-by: imbajin <jin@apache.org>
2026-08-03 17:25:00 +08:00
KAI 8b2932c764
fix(server): retry all PD peers while waiting for storage (#3129)
- cap each PD connection attempt at 2 seconds
- cap each PD request at 3 seconds
- cover failover after a hanging first peer

---------

Co-authored-by: imbajin <jin@apache.org>
2026-07-31 21:52:47 +08:00
KAI b026a90a0c
fix(store): bind each gRPC stub to its own channel (#3128)
AbstractGrpcClient opens concurrency (32) ManagedChannels per target, but
both stub-pool initializers used one precomputed channel index inside their
loops. Every pool entry therefore pointed at the same channel while the other
31 channels remained idle.

- use channels[i] in the blocking and async pool initializers
- add self-contained tests that verify every pool channel is bound
- add ClientSuiteTest so the store-client-test profile runs the tests

Fixes #3125
2026-07-31 21:47:22 +08:00
legendpei b9710a7b03
fix(server): handle repeated range predicates correctly (#3122) 2026-07-28 21:12:26 +08:00
legendpei f8e7abf9b1
chore(server): remove outdated backends code (#3116)
Remove the backend implementations that have been unsupported since 1.7.0, and
clean up their related build, distribution, test, release, and documentation
artifacts.

- retain the server and backend component boxes in the ASCII diagram
- show HugeGraph-PD and HStore as separate distributed components
- keep removed legacy backends out of the current topology

---------

Co-authored-by: imbajin <jin@apache.org>
2026-07-27 17:39:54 +08:00
Sean c10779dc6d
feat(server): support build & use(RocksDB) on RISC-V (#3102)
- Address the HugeGraph Server + RocksDB `linux/riscv64` build and minimum runtime
  support tracked by #3099.
- Keep the change isolated from the existing Docker image design and from the JDK,
  build, and test paths used by other architectures.

---------

Co-authored-by: Sean <sean@SeandeMacBook-Pro.local>
2026-07-25 13:45:19 +08:00
lokidundun e960cc5ec2
fix(server): skip unsafe count optm for nested predicates (#3100) 2026-07-23 11:21:24 +08:00
imbajin 89b648a7f9
feat: support secure Hubble monitoring targets (#3096)
Provide the minimum Server/PD compatibility and security boundary needed by Hubble native
monitoring and GraphSpace administration. Matching Hubble work:
https://github.com/apache/hugegraph-toolchain/pull/743
2026-07-21 14:37:33 +08:00
imbajin a80291223c
perf(docker): build Java artifacts natively (#3092)
- bind Maven build stages to BUILDPLATFORM
- keep all runtime stages target-platform specific
- avoid emulated Maven builds for ARM images
- cover PD, Store, standalone, and HStore images
2026-07-12 21:36:10 +08:00
Dev Hingu 74e439fbbc
chore(commons): remove redundant version property (#3089)
* fix(deps): remove redundant hugegraph-commons.version property

* fix(deps): update stale reference of hugegraph-commons.version
2026-07-12 20:27:09 +08:00
Yeaury 99936be5f4
feat(server): adapt Hubble 2.0 & add graph/role management (#3008)
Main Changes
Graph management (GraphsAPI.java)
GraphSpace and default-role APIs (GraphSpaceAPI.java)
GraphSpace managers (ManagerAPI.java)
Schema templates (SchemaTemplateAPI.java)
Authentication and graph metadata support

---------

Co-authored-by: imbajin <jin@apache.org>
2026-07-11 02:52:37 +08:00
Tsukilc 2d63804206
refactor(server): disable legacy master-worker scheduler logic (#3082)
This PR soft-disables the pre-PD master-worker task scheduling path while keeping old configs and task data upgrade-safe. Scheduler selection is now backend-driven: `hstore` uses `DistributedTaskScheduler`, and other backends use the local `StandardTaskScheduler`.

---------

Co-authored-by: Himanshu Verma <himnshuverma10152006@gmail.com>
Co-authored-by: imbajin <jin@apache.org>
2026-07-08 13:03:56 +08:00
legendpei 03e6b8e9ef
fix(core): keep unsafe range filters local (#3068) 2026-06-29 12:56:27 +08:00
contrueCT 86e0a66fd9
chore(ci): add gremlin-console smoke test (#3040) 2026-06-23 19:44:53 +08:00
Davide Polato 398a5edc95
fix(core): self-heal etcd meta watch on transport reconnect (#3062)
EtcdMetaDriver.listen/listenPrefix handed jetcd a bare Consumer<WatchResponse>,
so a terminal watch error (e.g. after a transport reconnect) was swallowed and
the JVM-global schema-cache-clear listener died silently: a node stopped
receiving cross-node cache-clear events with no error or warning.

Switch to the Watch.Listener overload and re-subscribe on onError/onCompleted
via a daemon-backed backoff, mirroring the self-heal PdMetaDriver already gets
from KvClient. The driver watch now stays live across reconnects, so
CachedSchemaTransactionV2's register-once flag staying true is correct; the
unused resetMetaListenerForReconnect stopgap and its TODO are removed.
2026-06-23 19:43:04 +08:00
contrueCT 63c97ff93f
fix(server): avoid loading huge task results for metadata queries (#3060) 2026-06-21 20:27:45 +08:00
Davide Polato c3f56b5e9f
fix(core): ref-count store event listener to fix owner-first close leak (#3058)
storeEventListenStatus had the same owner-first-close bug #3017 fixed for
graph cache listeners: non-owner close() dropped the entry and skipped
unlisten() as a no-op, leaking the owner's listener.

Apply CacheListenerHolder ref-count pattern: StoreListenerHolder +
STORE_EVENT_LISTENERS in CachedGraphTransaction, acquire/release via
compute() with provider-identity guard for close/reopen.

Removes storeEventListenStatus from GraphTransaction and
restoreStoreListenerStatusForKnownTeardownBug workaround from tests.
CachedSchemaTransaction* unaffected (per-instance, balanced 1:1).
2026-06-17 12:39:35 +08:00
legendpei 5ddeb0331c
feat(server) : make buffer max capacity configurable (#3049)
Move BytesBuffer.initMaxBufferCapacity() and other process-wide static
config initializations before LockUtil.init() so that validation failures
(e.g. invalid or conflicting serializer.buffer_max_capacity) cannot leave
orphaned lock groups in LockManager, which would block subsequent graph
load attempts without a process restart.

🤖 Generated with [Qoder][https://qoder.com]
2026-06-15 14:01:10 +08:00
KAI ef5d4e0b45
docs: document -d flag and Docker process supervision model (#3056)
- Add -d true|false option to PD and Store startup options sections
  (default: true = daemon; false = foreground for Docker/supervisors)
- Add section to docker/README.md explaining HEALTHCHECK endpoints
  and the Java process supervision model (replaces old cron monitor)

Chunk 10 of #3043.
2026-06-09 18:24:21 +08:00
KAI 0ecd844d9e
chore(ci): exit 77 when tools missing to distinguish skip from pass (#3055)
All three startup test scripts previously exited 0 when required tools
(lsof, curl, java) were not found. This is indistinguishable from a
passing test run — CI shows green even though no tests ran.

Change skip exits to 77 (conventional skip code) and update the CI
workflow steps to treat exit 77 as a visible skip notice rather than
a failure.

Flagged as non-blocking follow-up in reviews of #3044 and #3047.
Related to: #3043
2026-06-09 17:13:02 +08:00
Vaibhav Joshi 39dfb2da5c
fix: gremlin-console.sh fails on Mac M/ARM CPU #3050
* fix [Bug]: gremlin-console.sh fails on Mac M4 (Apple Silicon)#3031

Added org.fusesource.jansi:jansi:2.4.0 as a runtime dependency in
`hugegraph-server/hugegraph-dist/pom.xml` to prevent
NoClassDefFoundError: org/fusesource/jansi/AnsiConsole when launching gremlin-console.
2026-06-08 14:20:48 +08:00
contrueCT 42c039d695
fix(core): align count strategy connective steps (#3037) 2026-06-08 12:38:15 +08:00
KAI fc226637e9
chore(docker): add HEALTHCHECK & clean Dockerfiles (#3052)
Without HEALTHCHECK, docker ps always shows 'Up' even when Java has
crashed inside the container. Add HEALTHCHECK to all three Dockerfiles:
- Server: curl http://localhost:8080/versions
- PD:     curl http://localhost:8620/v1/health
- Store:  curl http://localhost:8520/v1/health

Fallback: if HTTP is not yet up but Java is alive (kill -0 on pid file),
report healthy. Avoids false unhealthy during startup.

Remove cron: Docker containers use foreground mode (-d false) after the
entrypoint fix. The cron-based monitor is for VM/bare-metal only and is
never started in Docker — removing it shrinks the image and reduces
attack surface.

Endpoints match what is already used in docker/docker-compose.yml.

Related to: #3043
2026-06-08 11:16:30 +08:00
KAI 817887dcce
fix(docker): supervise Java process in entrypoints instead of tail -f /dev/null (#3051)
Problem: all three docker-entrypoint.sh files used tail -f /dev/null to
keep the container alive. When Java crashed, tail kept running and the
container stayed up with no Java inside — Docker restart policy never fired.

Verified locally: kill -9 Java inside running container -> container
exits -> Docker restarts it automatically (tested 3 times for server,
PD restart loop confirmed for pd).
2026-06-08 11:14:19 +08:00
lokidundun 1f61c4839a
refactor(server): optimize rockdb batch query perf (#2982)
* optimize: Optimize RocksDB batch query performance

* Refactor getByIds to queryByIds in RocksDBTable

* Modify queryByIds to use super method temporarily

Temporarily use super.queryByIds() instead of getByIds() for batch version support.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-05 11:13:49 +08:00
KAI 16382ccfbd
fix(pd,store): fg mode exit code propagation in startup scripts (#3047)
In foreground mode (-d false), start-hugegraph-pd.sh had no foreground
branch — the script always backgrounded Java with exec ... &, wrote $!
to the pid file, and exited 0, losing Java's exit code entirely.

Fix: add DAEMON="true" default and -d flag to getopts. In the daemon
branch, keep the existing exec ... & pattern. In the foreground branch,
write $$ to the pid file before exec (exec replaces the shell with Java,
so $$ == Java's PID after exec), then exec java without & so the process
blocks and Java's exit code propagates out directly.

No trap needed in the foreground branch — exec replaces the shell
process with Java, so signals from Docker/systemd go directly to Java
without a wrapper to forward through.

Add test-start-hugegraph-pd.sh with 4 tests (daemon regression,
foreground blocking, exit code propagation on SIGKILL, SIGTERM
forwarding via exec) — 12 assertions, all pass after the fix.

Baseline on unmodified code: 3 passed, 9 failed.
After fix: 12 passed, 0 failed.

Wire test into pd-store-ci.yml for the RocksDB backend.

Related to: #3043
2026-06-04 21:25:42 +08:00
legendpei 7f0a44adc0
fix(server): handle match() in no index case (#3039) 2026-06-04 17:50:07 +08:00
KAI d6e6216222
fix(server): fix foreground mode exit code propagation in startup scripts (#3044)
The previous implementation captured $! after the daemon/foreground
if/else block. The script blocked at hugegraph-server.sh until Java
exited, then $! was empty, the pid file got an empty string, and the
script exited 0, losing Java's exit code entirely.
2026-06-03 21:42:36 +08:00
Davide Polato 3405832800
fix(server): normalize typed DEFAULT_VALUE after JSON reload (#3035)
Normalizes PropertyKey default values to their declared data type upon retrieval. Previously, values stored in userdata could lose their original type during serialization and deserialization (e.g., Date becoming String), leading to type mismatches.

The `defaultValue()` method now converts deserialized string representations back to their expected runtime types. This change is verified with extensive tests covering schema parsing, vertex property assignment, and both binary and text serializers.
2026-06-03 21:31:26 +08:00
Vaibhav Joshi a49bf667a9
docs(server): add Docker with HBase validation runbook 2026-06-03 21:18:24 +08:00
legendpei beb30eee62
fix(server): avoid extracting text range filters (#3034) 2026-06-02 12:40:49 +08:00
contrueCT b9a3dd9d99
chore(ci): enable hugegraph-struct tests (#3038) 2026-05-27 18:25:19 +08:00
Vaibhav Joshi 31e8268760
docs: update "Build from Source" instructions in README (#3022)
- Replace exploratory README steps with the actual packaged archive path
- Use the version placeholder instead of hard-coded 1.7.0
- Keep the PR focused on the source-build documentation fix

---------

Co-authored-by: imbajin <jin@apache.org>
2026-05-27 18:20:00 +08:00
Vaibhav Joshi f56462a14d
feat(server): use HBase 2.6 to replace hbase-shaded & support docker-compose way (#3021)
-Added hbase-shaded-client and hbase-endpoint dependencies instead of custom hbase-shaded-endpoint library.
-Added docker files and HBASE.md containing instructions for HBase backend
- Updated known-dependencies.txt to reflect the minimal allowlist.
Improved pom.xml comments to document exclusion rationales and
addressed automated review feedback regarding dependency management.
2026-05-22 11:27:05 +08:00
Davide Polato 454dd3d799
fix(server): keep schema ~create_time as Date after reload (#3026)
Normalize server-side schema ~create_time userdata in SchemaElement so serializer reloads and fromMap paths keep the Date contract.

Add SchemaElement, TextSerializer, and BinarySerializer coverage.

The builder accumulates userdata via Userdata.put() before eliminate()
runs, so `.userdata(CREATE_TIME, "").eliminate()` parsed "" as a date
and threw before the key-only removal path. Pass a blank ~create_time
through unchanged; non-empty malformed values still throw on the add
path, so the existing contract is unchanged.
2026-05-19 17:35:51 +08:00
KAI 8d095e1d99
perf(docker): improve all images build cache efficiency (#3025)
- Fix .gitattribut -> .gitattributes typo in .dockerignore
- Fix **/*.tar.gz* -> **/*.tar.gz (remove unintended trailing wildcard)
- Remove **/target/dist/ (redundant, already covered by **/target/)
- Restore cron to apt-get install in all 4 Dockerfiles to keep the
  existing start-hugegraph.sh -m true monitor path working
2026-05-18 12:47:20 +08:00
Soyaazz 66e5339e3a
fix(server): different graph name share the same backend (#3027)
## Main Changes

Change `ServerInfoManager.selfNodeId()` which returns "server-1" previously to "{graphname}/server-1"

## Upgrade impact

This change namespaces the server id by graph name, so old unfinished tasks in the non-PD local scheduler may still reference the previous bare server id, for example `server-1`.

Those historical tasks can remain visible, but they may not be restored or cancelled by the new namespaced server id after upgrade. The impact is limited to unfinished local-scheduler tasks that already existed before upgrading; newly scheduled tasks use the new namespaced id. To avoid this compatibility edge case, finish or cancel pending local tasks before upgrading.
2026-05-17 11:54:28 +08:00
Davide Polato f69ca66cd6
fix(server): align cache event actions in legacy EventHub path (#3017)
- Align legacy cache invalidation producers and listeners on ACTION_INVALID and
  ACTION_CLEAR, removing the obsolete ACTION_INVALIDED/ACTION_CLEARED constants.
- Add EventHub.notifyExcept(...) so cache transactions and the cache notifier
  bridge can avoid re-processing their own local listener while still delivering
  events to other listeners.
- Track registered graph/schema cache listeners per graph so notifyExcept(...)
  uses the listener instance actually registered on the EventHub, including
  multi-transaction cases where later transactions reuse the first listener.
- Update cache notifier forwarding to prevent local RPC bridge loops after action
  names are unified.
- Add regression coverage for notifyExcept semantics, graph/schema action names,
  listener teardown/re-registration, and notifier no-loop behavior.

- The holder keeps the EventHub listener registered while any transaction for the
  graph is alive, and unregisters/removes it only when the last transaction
  releases it. The registry update, ref-count decrement, and hub unlisten now run
  inside ConcurrentMap.compute() to avoid owner-closes-first invalidation gaps.

  Also add graph/schema regression coverage for owner-first close and last-close
  cleanup, including graph close/reopen handling for stale EventHub holders.
2026-05-15 11:25:33 +08:00
contrueCT e108076aca
fix(server): normalize bool range predicates in gremlin filters (#2991) 2026-05-09 15:23:52 +08:00
contrueCT de8781e182
chore(ci): optimize rerun workflow and add macOS RocksDB coverage (#3010)
- Resolve Travis helper directory to an absolute path
- Use the script directory directly for JaCoCo agent lookup
- Avoid nesting absolute paths under the repository root

---------

Co-authored-by: imbajin <jin@apache.org>
2026-05-08 15:46:33 +08:00
imbajin 06c52e48d4
chore: update project memories with latest codebase state(1.8.0) (#2998)
- Refresh all 8 memories to reflect current code (v1.7.0)
- Remove all PR number references (derivable from git history)
- Remove "Key Recent Changes" changelog section
- Remove CI implementation details (rerun delay/count)
- Describe current behavior as facts, not change events
- Mark legacy backends as excluded from Serena context
- Add GraphSpace, Swagger UI, TTL update, bridge networking info
2026-05-07 16:32:45 +08:00
Davide Polato ee177a0f70
fix(server): sync hstore schema cache clears (#3011)
Register a JVM-wide MetaManager listener on CachedSchemaTransactionV2 so
remote nodes clear their V2 schema-id/schema-name caches and the array
attachment on schema add/remove. Events carry a per-JVM source id to skip
self-echo; 

legacy plain-string payloads still accepted for safe rolling
upgrades. Status transitions no longer broadcast to avoid notify storms
from background rebuild/remove jobs.
2026-05-06 20:59:36 +08:00
Davide Polato 836b34832b
fix(server): auto-recover session after Cassandra restart (#2997)
- Reset driver session after each transient failure in executeWithRetry()
  so retries reopen cleanly via lazy open()
- Remove redundant finally block in reconnectIfNeeded(); null session
  directly on DriverException
- Store retryBaseDelay as field, reuse in open() (removes double-read)
- One-time LOG.warn via AtomicBoolean for commitAsync() retry gap
- Tighten defaults: max_delay 60s→10s, max_retries 10→3, interval 5s→1s
- Wire retry config via HugeConfig in tests; add cross-validator tests
2026-04-26 04:13:06 +08:00
contrueCT 68dd29b29b
refactor(server): add logs for load-based request rejection (#2972)
* fix(filter): enhance load detection logging and memory management
* fix(api): refine low-memory rejection handling
2026-04-25 16:02:49 +08:00
Himanshu Verma bcaa5f1ae5
fix(server): fix check_port port extraction for schemeless URLs (#3005) 2026-04-25 15:14:03 +08:00
Çağlar Eker 7afce9daa2
fix(pd): populate memberSize in GET / endpoint response (#3003)
* fix(pd): complete GET / stats fix and add test coverage

- Use pdService.getMembers() for memberSize (consistent with cluster())
  instead of RaftEngine directly, as suggested in issue #3002 discussion
- Add dataState field to BriefStatistics: exposes worst partition health
  state across all graphs, the most useful missing operational indicator
- Align graphSize to count only user-facing graphs (endsWith("/g")),
  matching the semantics of cluster() to avoid silent count discrepancy
- Add testQueryIndexInfo() to both RestApiTest classes to assert state,
  leader, memberSize > 0, and storeSize > 0 — catches this class of bug

* fix(pd): relax storeSize assertion in PD-only test environment

---------

Co-authored-by: imbajin <jin@apache.org>
2026-04-21 15:27:08 +08:00
imbajin a8ae76b617
fix(docker): skip partition wait for standalone rocksdb mode (#3000)
* fix(docker): skip partition wait for standalone rocksdb mode (#2999)

The `wait-partition.sh` script was called unconditionally in
`docker-entrypoint.sh`, causing standalone containers (rocksdb backend)
to hang for 120s printing "Waiting for partition assignment..." since
there is no Store service to respond.

Now reads the actual backend from `hugegraph.properties` and only runs
the partition wait when `backend=hstore`.
2026-04-20 15:09:52 +08:00
lokidundun 6a983f97e6
fix: enable CI badges displaying normally (#2996)
* fix: fix wrong image address

---------

Co-authored-by: imbajin <jin@apache.org>
2026-04-19 04:38:48 +08:00
contrueCT 9336b5e298
fix(server): guard count strategy on negative bounds (#2993)
* fix(traversal): guard count strategy on negative bounds

* test(traversal): cover repeat count on negative bounds

* test(traversal): cover collection count on negative bounds
2026-04-17 15:51:02 +08:00