lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject lucene-solr:jira/solr-11990: SOLR-11990: Ensure that the suggestion are validated by the policy engine otherwise move to the next candidate replica or the next candidate node
Date Fri, 27 Jul 2018 08:39:52 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-11990 a97d45b22 -> bb4ffb32c


SOLR-11990: Ensure that the suggestion are validated by the policy engine otherwise move to
the next candidate replica or the next candidate node


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/bb4ffb32
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/bb4ffb32
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/bb4ffb32

Branch: refs/heads/jira/solr-11990
Commit: bb4ffb32c4960a2809ac8927e214e1e012204a73
Parents: a97d45b
Author: Shalin Shekhar Mangar <shalin@apache.org>
Authored: Fri Jul 27 14:09:44 2018 +0530
Committer: Shalin Shekhar Mangar <shalin@apache.org>
Committed: Fri Jul 27 14:09:44 2018 +0530

----------------------------------------------------------------------
 .../autoscaling/WithCollectionVarType.java      | 27 ++++++++++----------
 1 file changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bb4ffb32/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/WithCollectionVarType.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/WithCollectionVarType.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/WithCollectionVarType.java
index f4653d7..989a087 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/WithCollectionVarType.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/WithCollectionVarType.java
@@ -113,13 +113,13 @@ public class WithCollectionVarType implements VarType {
       uniqueCollections.add(replicaInfoAndErr.replicaInfo.getCollection());
     }
 
+    collectionLoop:
     for (String collection : uniqueCollections) {
       String withCollection = withCollectionsMap.get(collection);
       if (withCollection == null) continue;
 
       // can we find a node from which we can move a replica of the `withCollection`
       // without creating another violation?
-      Set<String> sourceNodes = new HashSet<>();
       for (Row row : ctx.session.matrix) {
         if (ctx.violation.node.equals(row.node))  continue; // filter the violating node
 
@@ -127,7 +127,7 @@ public class WithCollectionVarType implements VarType {
         row.forEachReplica(replicaInfo -> hostedCollections.add(replicaInfo.getCollection()));
 
         if (hostedCollections.contains(withCollection) && !hostedCollections.contains(collection))
 {
-          // find the replica we can move
+          // find the candidate replicas that we can move
           List<ReplicaInfo> movableReplicas = new ArrayList<>();
           row.forEachReplica(replicaInfo -> {
             if (replicaInfo.getCollection().equals(withCollection)) {
@@ -135,18 +135,17 @@ public class WithCollectionVarType implements VarType {
             }
           });
 
-          if (movableReplicas.isEmpty())  continue;
-          ReplicaInfo toMove = movableReplicas.get(0);
-
-          // candidate source node for a move replica operation
-          Suggester suggester = ctx.session.getSuggester(MOVEREPLICA)
-              .forceOperation(true)
-              .hint(Suggester.Hint.COLL_SHARD, new Pair<>(withCollection, "shard1"))
-              .hint(Suggester.Hint.SRC_NODE, row.node)
-              .hint(Suggester.Hint.REPLICA, toMove.getName())
-              .hint(Suggester.Hint.TARGET_NODE, ctx.violation.node);
-          ctx.addSuggestion(suggester);
-          return; // one is enough
+          for (ReplicaInfo toMove : movableReplicas) {
+            // candidate source node for a move replica operation
+            Suggester suggester = ctx.session.getSuggester(MOVEREPLICA)
+                .forceOperation(true)
+                .hint(Suggester.Hint.COLL_SHARD, new Pair<>(withCollection, "shard1"))
+                .hint(Suggester.Hint.SRC_NODE, row.node)
+                .hint(Suggester.Hint.REPLICA, toMove.getName())
+                .hint(Suggester.Hint.TARGET_NODE, ctx.violation.node);
+            if (ctx.addSuggestion(suggester) != null)
+              continue collectionLoop; // one suggestion is enough for this collection
+          }
         }
       }
 


Mime
View raw message