Return-Path: X-Original-To: apmail-lucene-commits-archive@www.apache.org Delivered-To: apmail-lucene-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7142110DF6 for ; Tue, 17 Sep 2013 18:47:39 +0000 (UTC) Received: (qmail 20677 invoked by uid 500); 17 Sep 2013 18:47:17 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 20421 invoked by uid 99); 17 Sep 2013 18:47:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Sep 2013 18:47:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Sep 2013 18:47:08 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id EC34123889D5; Tue, 17 Sep 2013 18:46:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@lucene.apache.org From: markrmiller@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130917184647.EC34123889D5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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> 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>> responseFutures = new HashMap>>(); + final Map>> responseFutures = new HashMap>>(routes.size()); for (final Map.Entry 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 urls = new ArrayList(); 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);