contrueCT opened a new pull request, #3468:
URL: https://github.com/apache/hugegraph/pull/3468
## Purpose of the PR
- close #3466
Shortest-path traversal encoded string IDs through sparse integer keys and
used fixed-address segmented records. A small number of widely separated keys
could allocate large arrays before the traversal had visited many vertices,
causing `OutOfMemoryError: Java heap space`.
## Main Changes
The shortest-path record implementation now uses the existing hash-backed
`RecordType.ARRAY` representation and an Eclipse Collections integer hash set
for visited vertices. Path reconstruction reads parent iterators through the
`Record` interface, so it no longer depends on `Int2IntRecord`.
```mermaid
flowchart LR
A[Vertex IDs] --> B[ID encoding]
B --> C{Record storage}
C -->|before: sparse address| D[Large fixed arrays]
C -->|after: hash-backed| E[Entries sized by visited keys]
D --> F[Heap amplification]
E --> G[Bounded record growth]
```
The change is local to `ShortestPathRecords`; it does not alter the global
collection factory or other traversal algorithms.
The regression coverage includes sparse string IDs, unreachable paths, mixed
sparse numeric/string IDs, hash collisions, unlimited request parameters,
multiple shortest paths, and a 1,000-key sparse layer.
## Verifying these changes
- [x] Need tests and can be verified as follows:
- JDK 17, `-Xmx256m`, `ActiveProcessorCount=2`.
- `mvn test -pl hugegraph-server/hugegraph-test -am -P unit-test
-Dtest=ShortestPathTraverserTest -Dsurefire.failIfNoSpecifiedTests=false`.
- 20 tests passed with 0 failures and 0 skips.
- The same sparse-layer probe OOMs on the unmodified implementation in
`IntMapByFixedAddr` and completes with this change.
The validation is local and does not establish HStore production throughput
or full end-to-end acceptance.
## Does this PR potentially affect the following parts?
- [ ] Dependencies
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects
- [x] Nope
## Documentation Status
- [x] `Doc - No Need`
--
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]