lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1206388 - /lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
Date Sat, 26 Nov 2011 01:16:24 GMT
Author: markrmiller
Date: Sat Nov 26 01:16:13 2011
New Revision: 1206388

URL: http://svn.apache.org/viewvc?rev=1206388&view=rev
Log:
remove nocommit - do not try and forward update cmds to nodes that are down

Modified:
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java

Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1206388&r1=1206387&r2=1206388&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
Sat Nov 26 01:16:13 2011
@@ -31,6 +31,7 @@ import org.apache.lucene.util.CharsRef;
 import org.apache.solr.cloud.HashPartitioner;
 import org.apache.solr.cloud.HashPartitioner.Range;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.SolrInputField;
 import org.apache.solr.common.cloud.CloudState;
 import org.apache.solr.common.cloud.Slice;
@@ -429,20 +430,26 @@ public class DistributedUpdateProcessor 
       String shardId, String shardZkNodeName) {
     CloudState cloudState = req.getCore().getCoreDescriptor()
         .getCoreContainer().getZkController().getCloudState();
+   
     Slice replicas = cloudState.getSlices(collection).get(shardId);
     
-    // nocommit: ignore shards on nodes that are down
     Map<String,ZkNodeProps> shardMap = replicas.getShards();
 
     StringBuilder replicasUrl = new StringBuilder();
     for (Entry<String,ZkNodeProps> entry : shardMap.entrySet()) {
-      if (replicasUrl.length() > 0) {
-        replicasUrl.append("|");
+      if (cloudState.liveNodesContain(entry.getValue().get(
+          ZkStateReader.NODE_NAME_PROP))) {
+        
+        if (replicasUrl.length() > 0) {
+          replicasUrl.append("|");
+        }
+        String replicaUrl = entry.getValue().get(ZkStateReader.URL_PROP);
+        replicasUrl.append(replicaUrl);
       }
-      String replicaUrl = entry.getValue().get("url");
-      replicasUrl.append(replicaUrl);
     }
-
+    if (replicasUrl.length() == 0) {
+      throw new ZooKeeperException(ErrorCode.SERVICE_UNAVAILABLE, "No servers hosting shard
" + shardId + " found");
+    }
     return replicasUrl.toString();
   }
   



Mime
View raw message