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/12/29 00:21:26 UTC

svn commit: r1553969 - in /lucene/dev/branches/lucene_solr_4_6: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/cloud/Overseer.java solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

Author: markrmiller
Date: Sat Dec 28 23:21:26 2013
New Revision: 1553969

URL: http://svn.apache.org/r1553969
Log:
SOLR-5580: NPE when creating a core with both explicit shard and coreNodeName.

Modified:
    lucene/dev/branches/lucene_solr_4_6/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/core/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/cloud/Overseer.java
    lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

Modified: lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt?rev=1553969&r1=1553968&r2=1553969&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt Sat Dec 28 23:21:26 2013
@@ -54,6 +54,9 @@ Bug Fixes
   webcontainers / proxies. (Jakob Furrer, hossman, Shawn Heisey, Uwe Schindler,
   Mark Miller)
   
+* SOLR-5580: NPE when creating a core with both explicit shard and coreNodeName.
+  (YouPeng Yang, Mark Miller)
+
 Optimizations
 ----------------------  
 

Modified: lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1553969&r1=1553968&r2=1553969&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/cloud/Overseer.java Sat Dec 28 23:21:26 2013
@@ -352,18 +352,10 @@ public class Overseer {
             // if coreNodeName is null, auto assign one
             coreNodeName = Assign.assignNode(collection, state);
           }
-          message.getProperties().put(ZkStateReader.CORE_NODE_NAME_PROP, coreNodeName);
-        } else {
-          //probably, this core was removed explicitly
-          if (sliceName !=null && collectionExists &&  !"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
-            Slice slice = state.getSlice(collection, sliceName);
-            if (slice.getReplica(coreNodeName) == null) {
-              log.info("core_deleted . Just return");
-              return state;
-            }
-          }
-
+          message.getProperties().put(ZkStateReader.CORE_NODE_NAME_PROP,
+              coreNodeName);
         }
+
         // use the provided non null shardId
         if (sliceName == null) {
           //get shardId from ClusterState

Modified: lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=1553969&r1=1553968&r2=1553969&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java (original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java Sat Dec 28 23:21:26 2013
@@ -34,6 +34,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.lucene.util.LuceneTestCase.Slow;
@@ -100,6 +101,8 @@ public class BasicDistributedZkTest exte
   private String oneInstanceCollection = "oneInstanceCollection";
   private String oneInstanceCollection2 = "oneInstanceCollection2";
   
+  private AtomicInteger nodeCounter = new AtomicInteger();
+  
   ThreadPoolExecutor executor = new ThreadPoolExecutor(0,
       Integer.MAX_VALUE, 5, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
       new DefaultSolrThreadFactory("testExecutor"));
@@ -927,11 +930,16 @@ public class BasicDistributedZkTest exte
         try {
           server = new HttpSolrServer(baseUrl);
           server.setConnectionTimeout(15000);
-          server.setSoTimeout(60000);
           Create createCmd = new Create();
           createCmd.setRoles("none");
           createCmd.setCoreName(collection + num);
           createCmd.setCollection(collection);
+          
+          if (random().nextBoolean()) {
+            // sometimes we use an explicit core node name
+            createCmd.setCoreNodeName("anode" + nodeCounter.incrementAndGet());
+          }
+          
           if (shardId == null) {
             createCmd.setNumShards(2);
           }