alex-plekhanov commented on code in PR #12679:
URL: https://github.com/apache/ignite/pull/12679#discussion_r2798795389
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java:
##########
@@ -856,17 +859,17 @@ private static Collection<ClusterNode> nodes(final
GridCacheContext<?, ?> cctx,
if (prj == null && part == null)
return affNodes;
- if (part != null && part >= cctx.affinity().partitions())
- throw new IgniteCheckedException("Invalid partition number: " +
part);
+ if (part != null) {
+ if (part >= cctx.affinity().partitions())
+ throw new IgniteCheckedException("Invalid partition number: "
+ part);
- final Set<ClusterNode> owners =
- part == null ? Collections.<ClusterNode>emptySet() : new
HashSet<>(cctx.topology().owners(part, topVer));
+ affNodes = cctx.topology().nodes(part, topVer);
+ }
return F.view(affNodes, new P1<ClusterNode>() {
@Override public boolean apply(ClusterNode n) {
return cctx.discovery().cacheAffinityNode(n, cctx.name()) &&
Review Comment:
Looks like `cctx.discovery().cacheAffinityNode` always true for nodes,
derived by `CU.affinityNodes(cctx, topVer)`.
The whole statement can be simplified to something like:
`return prj == null ? affNodes : F.view(affNodes, n -> prj.node(n.id()) !=
null);`
Also, looks like `prj` is only used for local node filtering. Perhaps it can
be simplified too (but maybe not in this ticket)
--
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]