You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2015/06/12 22:07:57 UTC

svn commit: r1685154 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java

Author: shalin
Date: Fri Jun 12 20:07:56 2015
New Revision: 1685154

URL: http://svn.apache.org/r1685154
Log:
SOLR-7566: Search requests should return the shard name that is down

Added:
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java
      - copied unchanged from r1685153, lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java
Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1685154&r1=1685153&r2=1685154&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Fri Jun 12 20:07:56 2015
@@ -69,6 +69,8 @@ Bug Fixes
 * SOLR-6835: ReRankQueryParserPlugin checks now whether the reRankQuery parameter is present and not empty.
   (帅广应, Marius Grama via shalin)
 
+* SOLR-7566: Search requests should return the shard name that is down. (Marius Grama, shalin)
+
 Optimizations
 ----------------------
 * SOLR-7660: Avoid redundant 'exists' calls made to ZK while fetching cluster state updates. (shalin)

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java?rev=1685154&r1=1685153&r2=1685154&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java Fri Jun 12 20:07:56 2015
@@ -58,8 +58,6 @@ import org.apache.solr.core.SolrCore;
 import org.apache.solr.request.SolrQueryRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Strings;
 import org.slf4j.MDC;
 
 public class HttpShardHandler extends ShardHandler {
@@ -469,6 +467,15 @@ public class HttpShardHandler extends Sh
               sliceShardsStr.append(url);
             }
 
+            if (sliceShardsStr.length() == 0) {
+              boolean tolerant = rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false);
+              if (!tolerant) {
+                // stop the check when there are no replicas available for a shard
+                throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,
+                    "no servers hosting shard: " + rb.slices[i]);
+              }
+            }
+
             rb.shards[i] = sliceShardsStr.toString();
           }
         }