sergey-chugunov-1985 commented on code in PR #12473:
URL: https://github.com/apache/ignite/pull/12473#discussion_r2477255921


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java:
##########
@@ -228,8 +234,18 @@ public boolean 
disableRebalancingCancellationOptimization() {
                 if (grp.persistenceEnabled() && exchFut != null) {
                     List<UUID> nodeIds = 
exchFut.partitionHistorySupplier(grp.groupId(), p, part.initialUpdateCounter());
 
-                    if (!F.isEmpty(nodeIds))
+                    if (!F.isEmpty(nodeIds)) {
+                        if (sameDcNodeIds != null) {

Review Comment:
   I suggest to reuse this code for the very similar block on the line 279: 
just unify filtering operation (it is possible to use `removeIf` here instead 
of `retainAll`) and move it to a separate method with a name like 
`filterNodesFromRemoteDcs`.
   
   It could look like this:
   `
       private <T> List<T> filterNodesFromRemoteDcs(List<T> nodesToFilter, 
Collection<UUID> nodesToRetain, Predicate<T> filter) {
           if (nodesToRetain == null)
               return nodesToFilter;
           
           List<T> nodes0 = new ArrayList<>(nodesToFilter);
   
           nodes0.removeIf(filter);
   
           return !F.isEmpty(nodes0) ? nodes0 : nodesToFilter;
       }
   `



-- 
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]

Reply via email to