lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1524171 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/solrj/ solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
Date Tue, 17 Sep 2013 18:46:47 GMT
Author: markrmiller
Date: Tue Sep 17 18:46:47 2013
New Revision: 1524171

URL: http://svn.apache.org/r1524171
Log:
SOLR-4816: deal with leader=null case and init map with known size

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java

Modified: lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1524171&r1=1524170&r2=1524171&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
(original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
Tue Sep 17 18:46:47 2013
@@ -302,6 +302,10 @@ public class CloudSolrServer extends Sol
     //The value is a list of URLs for each replica in the slice.
     //The first value in the list is the leader for the slice.
     Map<String,List<String>> urlMap = buildUrlMap(col);
+    if (urlMap == null) {
+      // we could not find a leader yet - use unoptimized general path
+      return null;
+    }
 
     NamedList exceptions = new NamedList();
     NamedList shardResponses = new NamedList();
@@ -314,7 +318,7 @@ public class CloudSolrServer extends Sol
     long start = System.nanoTime();
 
     if (parallelUpdates) {
-      final Map<String, Future<NamedList<?>>> responseFutures = new HashMap<String,
Future<NamedList<?>>>();
+      final Map<String, Future<NamedList<?>>> responseFutures = new HashMap<String,
Future<NamedList<?>>>(routes.size());
       for (final Map.Entry<String, LBHttpSolrServer.Req> entry : routes.entrySet())
{
         final String url = entry.getKey();
         final LBHttpSolrServer.Req lbRequest = entry.getValue();
@@ -402,6 +406,10 @@ public class CloudSolrServer extends Sol
       String name = slice.getName();
       List<String> urls = new ArrayList<String>();
       Replica leader = slice.getLeader();
+      if (leader == null) {
+        // take unoptimized general path - we cannot find a leader yet
+        return null;
+      }
       ZkCoreNodeProps zkProps = new ZkCoreNodeProps(leader);
       String url = zkProps.getBaseUrl() + "/" + col.getName();
       urls.add(url);



Mime
View raw message