SOLR-5580: NPE when creating a core with both explicit shard and coreNodeName.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1553967 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-12-28 23:19:03 +00:00
parent 26e92f36ad
commit c3f2a19022
3 changed files with 15 additions and 12 deletions

View File

@ -302,6 +302,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
----------------------

View File

@ -442,18 +442,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

View File

@ -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 extends AbstractFullDistribZkTestBase {
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"));
@ -928,11 +931,16 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
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);
}