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 2013/10/16 21:17:11 UTC

svn commit: r1532868 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java solr/solrj/ solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java

Author: shalin
Date: Wed Oct 16 19:17:10 2013
New Revision: 1532868

URL: http://svn.apache.org/r1532868
Log:
SOLR-5338: CompositeIdRouter.keyHashRange should not throw exception if route key is not composite

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java?rev=1532868&r1=1532867&r2=1532868&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java Wed Oct 16 19:17:10 2013
@@ -561,6 +561,11 @@ public class OverseerCollectionProcessor
           throw new SolrException(ErrorCode.BAD_REQUEST,
               "The split.key: " + splitKey + " has a hash range that is exactly equal to hash range of shard: " + slice);
         }
+        for (DocRouter.Range subRange : subRanges) {
+          if (subRange.min == subRange.max) {
+            throw new SolrException(ErrorCode.BAD_REQUEST, "The split.key: " + splitKey + " must be a compositeId");
+          }
+        }
         log.info("Partitioning parent shard " + slice + " range: " + parentSlice.getRange() + " yields: " + subRanges);
         rangesStr = "";
         for (int i = 0; i < subRanges.size(); i++) {

Modified: lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java?rev=1532868&r1=1532867&r2=1532868&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java Wed Oct 16 19:17:10 2013
@@ -96,7 +96,8 @@ public class CompositeIdRouter extends H
   public Range keyHashRange(String routeKey) {
     int idx = routeKey.indexOf(separator);
     if (idx < 0) {
-      throw new IllegalArgumentException("Route key must be a composite id");
+      int hash = sliceHash(routeKey, null, null, null);
+      return new Range(hash, hash);
     }
     String part1 = routeKey.substring(0, idx);
     int commaIdx = part1.indexOf(bitsSeparator);