You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/02/21 16:19:09 UTC

[GitHub] [ignite] pavlukhin commented on a change in pull request #7277: IGNITE-12549 fix mapping queries on replication cache during rebalance

pavlukhin commented on a change in pull request #7277: IGNITE-12549 fix mapping queries on replication cache during rebalance
URL: https://github.com/apache/ignite/pull/7277#discussion_r382672813
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
 ##########
 @@ -654,12 +656,30 @@ private boolean isSafeLossPolicy() {
                 if (prj != null || part != null)
                     return nodes(cctx, prj, part);
 
-                if (cctx.affinityNode())
-                    return Collections.singletonList(cctx.localNode());
+                GridDhtPartitionTopology topology = cctx.topology();
 
-                Collection<ClusterNode> affNodes = nodes(cctx, null, null);
+                topology.readLock();
 
-                return affNodes.isEmpty() ? affNodes : Collections.singletonList(F.rand(affNodes));
+                try {
+                    if (cctx.affinityNode() && !topology.localPartitionMap().hasMovingPartitions())
+                        return Collections.singletonList(cctx.localNode());
+
+                    Collection<ClusterNode> affNodes = nodes(cctx, null, null);
+
+                    List<ClusterNode> nodes = new ArrayList<>(affNodes);
+
+                    Collections.shuffle(nodes);
+
+                    for (ClusterNode node : nodes) {
+                        if (!topology.partitions(node.id()).hasMovingPartitions()) {
 
 Review comment:
   Code style: no curly braces for single-line _if_ statements.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services