You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2013/09/17 20:47:55 UTC
svn commit: r1524174 - in /lucene/dev/branches/lucene_solr_4_5: ./ solr/
solr/solrj/
solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
Author: markrmiller
Date: Tue Sep 17 18:47:55 2013
New Revision: 1524174
URL: http://svn.apache.org/r1524174
Log:
SOLR-4816: deal with leader=null case and init map with known size
Modified:
lucene/dev/branches/lucene_solr_4_5/ (props changed)
lucene/dev/branches/lucene_solr_4_5/solr/ (props changed)
lucene/dev/branches/lucene_solr_4_5/solr/solrj/ (props changed)
lucene/dev/branches/lucene_solr_4_5/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
Modified: lucene/dev/branches/lucene_solr_4_5/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_5/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1524174&r1=1524173&r2=1524174&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_5/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java (original)
+++ lucene/dev/branches/lucene_solr_4_5/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java Tue Sep 17 18:47:55 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);