Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-3641: CoreContainer is not persisting roles core attribute.

Mark Robert Millerff7c8d0217de
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f96766db8d8..95e11a62ce2 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -215,6 +215,9 @@ Bug Fixes
* SOLR-3813: When a new leader syncs, we need to ask all shards to sync back,
not just those that are active. (Mark Miller)
+* SOLR-3641: CoreContainer is not persisting roles core attribute.
+ (hossman, Mark Miller)
+
Other Changes
----------------------
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 9d3243fc1dc..93a1fa11b14 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -92,6 +92,7 @@ import org.xml.sax.SAXException;
*/
public class CoreContainer
{
+ private static final String LEADER_VOTE_WAIT = "180000"; // 3 minutes
private static final String DEFAULT_HOST_CONTEXT = "solr";
private static final String DEFAULT_HOST_PORT = "8983";
private static final int DEFAULT_ZK_CLIENT_TIMEOUT = 15000;
@@ -461,7 +462,7 @@ public class CoreContainer
hostContext = cfg.get("solr/cores/@hostContext", DEFAULT_HOST_CONTEXT);
host = cfg.get("solr/cores/@host", null);
- leaderVoteWait = cfg.get("solr/cores/@leaderVoteWait", "180000"); // 3 minutes
+ leaderVoteWait = cfg.get("solr/cores/@leaderVoteWait", LEADER_VOTE_WAIT);
if(shareSchema){
indexSchemaCache = new ConcurrentHashMap<String ,IndexSchema>();
@@ -1246,6 +1247,7 @@ public class CoreContainer
intToString(this.zkClientTimeout),
Integer.toString(DEFAULT_ZK_CLIENT_TIMEOUT));
addCoresAttrib(coresAttribs, "hostContext", this.hostContext, DEFAULT_HOST_CONTEXT);
+ addCoresAttrib(coresAttribs, "leaderVoteWait", this.leaderVoteWait, LEADER_VOTE_WAIT);
List<SolrCoreXMLDef> solrCoreXMLDefs = new ArrayList<SolrCoreXMLDef>();
@@ -1318,11 +1320,15 @@ public class CoreContainer
CloudDescriptor cd = dcore.getCloudDescriptor();
String shard = null;
+ String roles = null;
if (cd != null) {
shard = cd.getShardId();
+ roles = cd.getRoles();
}
addCoreProperty(coreAttribs, coreNode, CORE_SHARD, shard, null);
+ addCoreProperty(coreAttribs, coreNode, CORE_ROLES, roles, null);
+
String collection = null;
// only write out the collection name if it's not the default (the
// core