Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3468 +/- ##
==========================================
Coverage 58.63% 58.63%
- Complexity 6933 7310 +377
==========================================
Files 780 780
Lines 69635 69635
Branches 9605 9605
==========================================
+ Hits 40829 40832 +3
- Misses 25115 25117 +2
+ Partials 3691 3686 -5
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: no. Summary: The switch to RecordType.ARRAY and IntHashSet removes the sparse-key fixed-address allocation in ShortestPathRecords without changing path reconstruction, and the new tests ran green in UnitTestSuite. One cleanup: the PR commits its description diagram into the repository.
imbajin
left a comment
There was a problem hiding this comment.
Score: 8.2/10 · Confidence: medium
Blocking: no
Summary
The hash-backed record change avoids sparse-key allocation while preserving single-parent path reconstruction. No new actionable correctness finding was identified. Approval is deferred because CI has failures and dense-graph performance remains unmeasured.
Evidence
Reviewed ID encoding, traversal and parent lookup against the record implementations; the PR adds sparse and collision cases. Server memory and RocksDB checks passed; commons, PD, Store and dependency checks failed.
Validation notes
Static independent review only; no independent runtime or production HStore performance test.
11264fb to
8485bf4
Compare
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the localized shortest-path storage change.
No open issues 🎉
What changed in this PR
Addresses #3466 by replacing sparse-ID-sensitive storage in shortest-path records with hash-backed collections, avoiding large fixed-address allocations while keeping the change local to shortest-path traversal.
Changes:
- Uses
RecordType.ARRAYfor path records andIntHashSetfor visited vertices. - Reconstructs paths through the
Recordinterface rather thanInt2IntRecord. - Adds regression coverage for sparse and mixed IDs, collisions, unreachable paths, unlimited parameters, multiple shortest paths, and a 1,000-key layer.
| File | Description |
|---|---|
| hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/traversal/ShortestPathTraverserTest.java | Adds sparse-ID memory-growth and shortest-path correctness regression tests. |
| hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/ShortestPathRecords.java | Switches to hash-backed storage and interface-based parent lookup. |
Review effort: Balanced (adaptive)
imbajin
left a comment
There was a problem hiding this comment.
Score: 8.2/10 · Confidence: medium
Blocking: no
Summary
The hash-backed records avoid fixed-address allocation for sparse IDs and preserve single-parent path reconstruction. No new actionable correctness issue was established. Dense layers may use substantially more memory, so representative heap and throughput measurements would be useful.
Evidence
Int2IntsMap allocates ten int slots per distinct key plus a hash map; isNew admits one parent per layer. The existing SVG comment is resolved by its removal from the diff. The current Server memory and RocksDB CI jobs passed.
Validation notes
Independent review was static; no heap comparison, production HStore test, or independent test execution was performed. Actual dense-workload impact depends on occupancy and allocation overhead.
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: no. Summary: Hash-backed records remove the fixed-address segment allocation for sparse codes, path reconstruction still follows the single parent isNew() admits, and the new tests ran green in UnitTestSuite. One cost remains: RecordType.ARRAY spends several times more heap per key than a one-value map on large dense numeric layers.
| super(RecordType.INT, false, sourceV, targetV); | ||
| // ID hash codes are sparse; fixed-address records allocate large arrays | ||
| // for a handful of vertices. Reuse the hash-backed path records instead. | ||
| super(RecordType.ARRAY, false, sourceV, targetV); |
There was a problem hiding this comment.
Minor: RecordType.ARRAY stores each layer in Int2IntsMap, which reserves a 10-int chunk per key although isNew() admits one parent per key, so a layer of 5M dense numeric ids retains about 460 MB against about 137 MB in an IntIntHashMap. Back these records with a one-parent-per-key IntIntHashMap record instead.
Purpose of the PR
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.ARRAYrepresentation and an Eclipse Collections integer hash set for visited vertices. Path reconstruction reads parent iterators through theRecordinterface, so it no longer depends onInt2IntRecord.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
-Xmx256m,ActiveProcessorCount=2.mvn test -pl hugegraph-server/hugegraph-test -am -P unit-test -Dtest=ShortestPathTraverserTest -Dsurefire.failIfNoSpecifiedTests=false.IntMapByFixedAddrand 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?
Documentation Status
Doc - No Need