Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refactor(server): optimize rockdb batch query perf #2982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
refactor(server): optimize rockdb batch query perf #2982
Changes from 17 commits
5ba6d4af5405a0939ace0502c7df352f66b0d9052d45298f9223fb28ce4e2cb6fe08a70391069ce802b9c06225ca99491b10cb0a4d33123ec1b35990432f58cb98e6373588c4f2d2e29b11ec06File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set<Id>→Collection<Id>语义变化需注意原方法接收
Set<Id>(天然去重),改为Collection<Id>后,传入List时若含重复 ID,RocksDBmultiGet会对同一 key 重复查询并返回重复结果。测试
testVertexQueryByIdsWithDuplicateIds验证了这个行为(id1 返回 2 次),但这与原Set语义不一致。需要确认上层IdQuery的 ids 是否可能含重复——如果含重复,行为变更可能导致上层重复处理数据。建议:在
getByIds入口去重以保持原语义,或者明确文档说明Collection含重复返回的行为变更。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added LinkedHashSet deduplication at the getByIds() entry point while preserving input order; skips if Set is already passed. Test updated to verify dedup behavior. The
backend deduplication does not affect final semantics since GraphTransaction reassembles results by the original input order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
完整路径是:
也就是说,GraphTransaction 只有在检测到重复 id 时才会回到按原始
ids重建结果的慢路径;但当前 fast path 只能识别相邻重复,识别不了e1, e2, e1这种非相邻重复。旧的 scan/flat-map 路径会按输入 id 展开 3 次查询,新路径在这里被压成 2 个 key,最终返回结果会少一条。建议不要在 Edge 的这条 fast path 上做 table-level 全局去重,或者在 transaction 层改成能检测任意重复 id 后再决定是否直接返回 backend iterator。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 PR 描述与实际改动不完全匹配
PR 描述提到 "improves the performance of Gremlin queries... when using RPC-based backends such as HBase and HStore",但代码改动全在
hugegraph-rocksdb模块。建议更新 PR 描述,准确反映本次优化的范围是 RocksDB 后端。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catch! This PR is RocksDB-only. I’ve updated the description to change closes 2674 to related 2674
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryByIds逻辑完全重复Vertex.queryByIds()和Edge.queryByIds()代码完全一致(5 行相同逻辑)。可以考虑:RocksDBTable.queryByIds()中统一做hasChanges()判断这样可以减少重复,也降低后续维护时两处不一致的风险。
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.