lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject lucene-solr:jira/solr-11285: SOLR-11285: Fix minor bugs.
Date Wed, 04 Oct 2017 09:49:54 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-11285 967f837ae -> 06d89bb1c


SOLR-11285: Fix minor bugs.


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

Branch: refs/heads/jira/solr-11285
Commit: 06d89bb1c0aa7527f630e391b3b089094a6356ca
Parents: 967f837
Author: Andrzej Bialecki <ab@apache.org>
Authored: Wed Oct 4 11:49:36 2017 +0200
Committer: Andrzej Bialecki <ab@apache.org>
Committed: Wed Oct 4 11:49:36 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/solr/cloud/CreateShardCmd.java   |  2 +-
 .../solr/cloud/autoscaling/ExecutePlanAction.java    |  6 +++++-
 .../solrj/impl/ZkClientClusterStateProvider.java     | 15 +++++++++++++--
 3 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/06d89bb1/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java b/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java
index ab8cfab..90cecd7 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CreateShardCmd.java
@@ -175,6 +175,6 @@ public class CreateShardCmd implements Cmd {
   static boolean usePolicyFramework(DocCollection collection, OverseerCollectionMessageHandler
ocmh)
       throws IOException, InterruptedException {
     AutoScalingConfig autoScalingConfig = ocmh.overseer.getSolrCloudManager().getDistribStateManager().getAutoScalingConfig();
-    return !autoScalingConfig.isEmpty() || collection.getPolicyName() != null;
+    return !autoScalingConfig.getPolicy().getClusterPolicy().isEmpty() || collection.getPolicyName()
!= null;
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/06d89bb1/solr/core/src/java/org/apache/solr/cloud/autoscaling/ExecutePlanAction.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/ExecutePlanAction.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/ExecutePlanAction.java
index 94d0061..ccc18a9 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/ExecutePlanAction.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/ExecutePlanAction.java
@@ -165,7 +165,11 @@ public class ExecutePlanAction extends TriggerActionBase {
    */
   private String saveAsyncId(DistribStateManager stateManager, TriggerEvent event, String
asyncId) throws InterruptedException, AlreadyExistsException, IOException, KeeperException
{
     String parentPath = ZkStateReader.SOLR_AUTOSCALING_TRIGGER_STATE_PATH + "/" + event.getSource()
+ "/" + getName();
-    stateManager.makePath(parentPath);
+    try {
+      stateManager.makePath(parentPath);
+    } catch (AlreadyExistsException e) {
+      // ignore
+    }
     return stateManager.createData(parentPath + "/" + PREFIX, Utils.toJSON(Collections.singletonMap("requestid",
asyncId)), CreateMode.PERSISTENT_SEQUENTIAL);
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/06d89bb1/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
index fa84025..66f7143 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.lang.invoke.MethodHandles;
 import java.nio.file.Path;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 import java.util.Set;
 
@@ -59,7 +60,12 @@ public class ZkClientClusterStateProvider implements ClusterStateProvider
{
 
   @Override
   public ClusterState.CollectionRef getState(String collection) {
-    return zkStateReader.getClusterState().getCollectionRef(collection);
+    ClusterState clusterState = zkStateReader.getClusterState();
+    if (clusterState != null) {
+      return clusterState.getCollectionRef(collection);
+    } else {
+      return null;
+    }
   }
   public ZkStateReader getZkStateReader(){
     return zkStateReader;
@@ -67,7 +73,12 @@ public class ZkClientClusterStateProvider implements ClusterStateProvider
{
 
   @Override
   public Set<String> getLiveNodes() {
-    return zkStateReader.getClusterState().getLiveNodes();
+    ClusterState clusterState = zkStateReader.getClusterState();
+    if (clusterState != null) {
+      return clusterState.getLiveNodes();
+    } else {
+      return Collections.emptySet();
+    }
   }
 
 


Mime
View raw message