imbajin commented on code in PR #2982:
URL: https://github.com/apache/hugegraph/pull/2982#discussion_r3068218442
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java:
##########
@@ -783,8 +783,10 @@ protected Iterator<Vertex> queryVerticesByIds(Object[]
vertexIds, boolean adjace
// NOTE: allowed duplicated vertices if query by duplicated ids
List<Id> ids = InsertionOrderUtil.newList();
Map<Id, HugeVertex> vertices = new HashMap<>(vertexIds.length);
+ Set<Id> fetchedIds = InsertionOrderUtil.newSet();
+ IdQuery batchQuery = null;
+ final int batchSize = this.batchSize;
Review Comment:
⚠️ 这里把 batching 放在 `GraphTransaction` 通用层后,会影响所有 backend,而不只是 issue #2674
里提到的 RPC backend。以 RocksDB 为例,当前 `queryByIds()` 仍然是逐 id 展开查询,并没有真正走
multi-get;现在强制按 `query.batch_size` 拆成多个 `IdQuery`,很可能只是增加额外的 query/iterator
次数。建议把这类分批策略下沉到具体 backend,或者至少通过 feature/store type 把它限定在 HBase/HStore 这类 RPC
backend 上,避免把针对性优化变成全局行为变化。
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java:
##########
@@ -783,8 +783,10 @@ protected Iterator<Vertex> queryVerticesByIds(Object[]
vertexIds, boolean adjace
// NOTE: allowed duplicated vertices if query by duplicated ids
List<Id> ids = InsertionOrderUtil.newList();
Map<Id, HugeVertex> vertices = new HashMap<>(vertexIds.length);
+ Set<Id> fetchedIds = InsertionOrderUtil.newSet();
Review Comment:
⚠️ 这里新增 `fetchedIds` 之后,非相邻的重复 id 也会被全局去重;而旧逻辑里 `IdQuery.query()` 只会折叠相邻重复
id。最终返回结果看起来应该还是保持重复输出,但真实的后端访问路径已经变了。建议补一个回归测试,至少覆盖 `超过 query.batch_size`、`跨
batch 的重复 id`、`缺失 id + checkMustExist` 这几个组合场景,避免后面再改这里时把语义悄悄带偏。
--
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]