lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [2/2] lucene-solr:jira/solr-11285: SOLR-11285: Fix some tests.
Date Tue, 03 Oct 2017 16:28:53 GMT
SOLR-11285: Fix some tests.


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

Branch: refs/heads/jira/solr-11285
Commit: 967f837ae2c7b3d62140e9529c8ae447d9444840
Parents: 337dff9
Author: Andrzej Bialecki <ab@apache.org>
Authored: Tue Oct 3 18:28:38 2017 +0200
Committer: Andrzej Bialecki <ab@apache.org>
Committed: Tue Oct 3 18:28:38 2017 +0200

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/cloud/Assign.java         | 8 ++++++--
 .../java/org/apache/solr/cloud/autoscaling/TriggerBase.java  | 2 ++
 .../client/solrj/cloud/autoscaling/DistribStateManager.java  | 2 +-
 .../solr/client/solrj/cloud/autoscaling/PolicyHelper.java    | 2 --
 .../apache/solr/client/solrj/impl/ZkDistribStateManager.java | 4 ++--
 5 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/967f837a/solr/core/src/java/org/apache/solr/cloud/Assign.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/Assign.java b/solr/core/src/java/org/apache/solr/cloud/Assign.java
index 674a685..5f861f0 100644
--- a/solr/core/src/java/org/apache/solr/cloud/Assign.java
+++ b/solr/core/src/java/org/apache/solr/cloud/Assign.java
@@ -71,7 +71,11 @@ public class Assign {
     String path = "/collections/"+collection;
     try {
       if (!stateManager.hasData(path)) {
-        stateManager.makePath(path);
+        try {
+          stateManager.makePath(path);
+        } catch (AlreadyExistsException e) {
+          // it's okay if another beats us creating the node
+        }
       }
       path += "/counter";
       if (!stateManager.hasData(path)) {
@@ -247,7 +251,7 @@ public class Assign {
     String policyName = message.getStr(POLICY);
     AutoScalingConfig autoScalingConfig = ocmh.overseer.getSolrCloudManager().getDistribStateManager().getAutoScalingConfig();
 
-    if (rulesMap == null && policyName == null && autoScalingConfig.isEmpty())
{
+    if (rulesMap == null && policyName == null && autoScalingConfig.getPolicy().getClusterPolicy().isEmpty())
{
       log.debug("Identify nodes using default");
       int i = 0;
       List<ReplicaPosition> result = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/967f837a/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerBase.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerBase.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerBase.java
index c2aa3a7..3d095ab 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerBase.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerBase.java
@@ -87,6 +87,8 @@ public abstract class TriggerBase implements AutoScaling.Trigger {
       if (!stateManager.hasData(ZkStateReader.SOLR_AUTOSCALING_TRIGGER_STATE_PATH)) {
         stateManager.makePath(ZkStateReader.SOLR_AUTOSCALING_TRIGGER_STATE_PATH);
       }
+    } catch (AlreadyExistsException e) {
+      // ignore
     } catch (InterruptedException | KeeperException | IOException e) {
       LOG.warn("Exception checking ZK path " + ZkStateReader.SOLR_AUTOSCALING_TRIGGER_STATE_PATH,
e);
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/967f837a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DistribStateManager.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DistribStateManager.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DistribStateManager.java
index 9f69c49..084c5b2 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DistribStateManager.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DistribStateManager.java
@@ -45,7 +45,7 @@ public interface DistribStateManager {
 
   // state mutators
 
-  void makePath(String path) throws IOException, KeeperException, InterruptedException;
+  void makePath(String path) throws AlreadyExistsException, IOException, KeeperException,
InterruptedException;
 
   String createData(String path, byte[] data, CreateMode mode) throws AlreadyExistsException,
IOException, KeeperException, InterruptedException;
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/967f837a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
index ae20666..7749100 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/PolicyHelper.java
@@ -18,7 +18,6 @@
 package org.apache.solr.client.solrj.cloud.autoscaling;
 
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.EnumMap;
 import java.util.List;
@@ -31,7 +30,6 @@ import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.cloud.autoscaling.Policy.Suggester.Hint;
 import org.apache.solr.client.solrj.impl.ClusterStateProvider;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.cloud.ReplicaPosition;
 import org.apache.solr.common.util.Pair;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/967f837a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
index f3d2e62..7664ce2 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
@@ -85,11 +85,11 @@ public class ZkDistribStateManager implements DistribStateManager {
   }
 
   @Override
-  public void makePath(String path) throws IOException, KeeperException, InterruptedException
{
+  public void makePath(String path) throws AlreadyExistsException, IOException, KeeperException,
InterruptedException {
     try {
       zkClient.makePath(path, true);
     } catch (KeeperException.NodeExistsException e) {
-      // ignore - someone beat us to it
+      throw new AlreadyExistsException(path);
     } catch (InterruptedException e) {
       throw e;
     }


Mime
View raw message