SOLR-5018: The Overseer should avoid publishing the state for collections that do not exist under the /collections zk node.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1501916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-07-10 19:06:27 +00:00
parent 6455dec1e0
commit 7d1e3ba363
5 changed files with 24 additions and 1 deletions

View File

@ -291,6 +291,8 @@ Bug Fixes
* SOLR-5019: spurious ConcurrentModificationException when spell check component
was in use with filters. (yonik)
* SOLR-5018: The Overseer should avoid publishing the state for collections that do not
exist under the /collections zk node. (Mark Miller)
Optimizations
----------------------

View File

@ -28,6 +28,7 @@ import java.util.Map.Entry;
import java.util.Set;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.cloud.ClosableThread;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.DocCollection;
@ -269,6 +270,19 @@ public class Overseer {
*/
private ClusterState updateState(ClusterState state, final ZkNodeProps message) {
final String collection = message.getStr(ZkStateReader.COLLECTION_PROP);
assert collection.length() > 0 : message;
try {
if (!zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection, true)) {
log.warn("Could not find collection node for " + collection + ", skipping publish state");
}
} catch (KeeperException e) {
throw new SolrException(ErrorCode.SERVER_ERROR, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SolrException(ErrorCode.SERVER_ERROR, e);
}
String coreNodeName = message.getStr(ZkStateReader.CORE_NODE_NAME_PROP);
if (coreNodeName == null) {
coreNodeName = getAssignedCoreNodeName(state, message);

View File

@ -990,6 +990,9 @@ public final class ZkController {
numShards = Integer.getInteger(ZkStateReader.NUM_SHARDS_PROP);
}
assert cd.getCloudDescriptor().getCollectionName() != null && cd.getCloudDescriptor()
.getCollectionName().length() > 0;
String coreNodeName = cd.getCloudDescriptor().getCoreNodeName();
//assert cd.getCloudDescriptor().getShardId() != null;
ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, "state",

View File

@ -298,7 +298,7 @@ public class ConfigSolrXmlOld extends ConfigSolr {
+ ">\n"
+ " <core name=\""
+ CoreContainer.DEFAULT_DEFAULT_CORE_NAME
+ "\" shard=\"${shard:}\" collection=\"${collection:}\" instanceDir=\"collection1\" />\n"
+ "\" shard=\"${shard:}\" collection=\"${collection:collection1}\" instanceDir=\"collection1\" />\n"
+ " </cores>\n" + "</solr>";
@Override

View File

@ -154,6 +154,10 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 {
"testcore");
dcore.setDataDir(dataDir4.getAbsolutePath());
CloudDescriptor cloudDesc = new CloudDescriptor();
cloudDesc.setCollectionName("testcore");
dcore.setCloudDescriptor(cloudDesc);
if (container1.getZkController() != null) {
container1.preRegisterInZk(dcore);