You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2012/07/19 00:57:25 UTC
svn commit: r1363165 - in /lucene/dev/branches/branch_4x: ./ dev-tools/
lucene/ solr/ solr/CHANGES.txt
solr/core/src/java/org/apache/solr/core/CoreContainer.java
Author: hossman
Date: Wed Jul 18 22:57:25 2012
New Revision: 1363165
URL: http://svn.apache.org/viewvc?rev=1363165&view=rev
Log:
SOLR-3629: Typo in solr.xml persistence when overriding the solrconfig.xml file name using the "config" attribute prevented the override file from being used (merge r1363161)
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/dev-tools/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/CHANGES.txt
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreContainer.java
Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1363165&r1=1363164&r2=1363165&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Wed Jul 18 22:57:25 2012
@@ -104,6 +104,11 @@ Bug Fixes
* SOLR-3639: Update ZooKeeper to 3.3.5 for a variety of bug fixes. (Mark Miller)
+* SOLR-3629: Typo in solr.xml persistence when overriding the solrconfig.xml
+ file name using the "config" attribute prevented the override file from being
+ used. (Ryan Zezeski, hossman)
+
+
Other Changes
----------------------
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreContainer.java?rev=1363165&r1=1363164&r2=1363165&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreContainer.java Wed Jul 18 22:57:25 2012
@@ -96,6 +96,18 @@ public class CoreContainer
protected static Logger log = LoggerFactory.getLogger(CoreContainer.class);
+ // solr.xml node constants
+ private static final String CORE_NAME = "name";
+ private static final String CORE_CONFIG = "config";
+ private static final String CORE_INSTDIR = "instanceDir";
+ private static final String CORE_DATADIR = "dataDir";
+ private static final String CORE_SCHEMA = "schema";
+ private static final String CORE_SHARD = "shard";
+ private static final String CORE_COLLECTION = "collection";
+ private static final String CORE_ROLES = "roles";
+ private static final String CORE_PROPERTIES = "properties";
+
+
protected final Map<String, SolrCore> cores = new LinkedHashMap<String, SolrCore>();
protected boolean persistent = false;
protected String adminPath = null;
@@ -477,43 +489,43 @@ public class CoreContainer
for (int i=0; i<nodes.getLength(); i++) {
Node node = nodes.item(i);
try {
- String rawName = DOMUtil.getAttr(node, "name", null);
+ String rawName = DOMUtil.getAttr(node, CORE_NAME, null);
if (null == rawName) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Each core in solr.xml must have a 'name'");
}
String name = rawName;
- CoreDescriptor p = new CoreDescriptor(this, name, DOMUtil.getAttr(node, "instanceDir", null));
+ CoreDescriptor p = new CoreDescriptor(this, name, DOMUtil.getAttr(node, CORE_INSTDIR, null));
// deal with optional settings
- String opt = DOMUtil.getAttr(node, "config", null);
+ String opt = DOMUtil.getAttr(node, CORE_CONFIG, null);
if (opt != null) {
p.setConfigName(opt);
}
- opt = DOMUtil.getAttr(node, "schema", null);
+ opt = DOMUtil.getAttr(node, CORE_SCHEMA, null);
if (opt != null) {
p.setSchemaName(opt);
}
if (zkController != null) {
- opt = DOMUtil.getAttr(node, "shard", null);
+ opt = DOMUtil.getAttr(node, CORE_SHARD, null);
if (opt != null && opt.length() > 0) {
p.getCloudDescriptor().setShardId(opt);
}
- opt = DOMUtil.getAttr(node, "collection", null);
+ opt = DOMUtil.getAttr(node, CORE_COLLECTION, null);
if (opt != null) {
p.getCloudDescriptor().setCollectionName(opt);
}
- opt = DOMUtil.getAttr(node, "roles", null);
+ opt = DOMUtil.getAttr(node, CORE_ROLES, null);
if(opt != null){
p.getCloudDescriptor().setRoles(opt);
}
}
- opt = DOMUtil.getAttr(node, "properties", null);
+ opt = DOMUtil.getAttr(node, CORE_PROPERTIES, null);
if (opt != null) {
p.setPropertiesName(opt);
}
- opt = DOMUtil.getAttr(node, CoreAdminParams.DATA_DIR, null);
+ opt = DOMUtil.getAttr(node, CORE_DATADIR, null);
if (opt != null) {
p.setDataDir(opt);
}
@@ -1154,7 +1166,7 @@ public class CoreContainer
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
- String name = DOMUtil.getAttr(node, "name", null);
+ String name = DOMUtil.getAttr(node, CORE_NAME, null);
if (origCoreName.equals(name)) {
coreNode = node;
if (coreName.equals(origCoreName)) {
@@ -1168,7 +1180,7 @@ public class CoreContainer
// see if we match with substitution
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
- String name = DOMUtil.getAttr(node, "name", null);
+ String name = DOMUtil.getAttr(node, CORE_NAME, null);
if (origCoreName.equals(DOMUtil.substituteProperty(name,
loader.getCoreProperties()))) {
coreNode = node;
@@ -1181,28 +1193,28 @@ public class CoreContainer
}
}
- coreAttribs.put("name", coreName);
+ coreAttribs.put(CORE_NAME, coreName);
String instanceDir = dcore.getInstanceDir();
- addCoreProperty(coreAttribs, coreNode, "instanceDir", instanceDir, null);
+ addCoreProperty(coreAttribs, coreNode, CORE_INSTDIR, instanceDir, null);
// write config
String configName = dcore.getConfigName();
- addCoreProperty(coreAttribs, coreNode, "conf", configName, dcore.getDefaultConfigName());
+ addCoreProperty(coreAttribs, coreNode, CORE_CONFIG, configName, dcore.getDefaultConfigName());
// write schema
String schema = dcore.getSchemaName();
- addCoreProperty(coreAttribs, coreNode, "schema", schema, dcore.getDefaultSchemaName());
+ addCoreProperty(coreAttribs, coreNode, CORE_SCHEMA, schema, dcore.getDefaultSchemaName());
String dataDir = dcore.dataDir;
- addCoreProperty(coreAttribs, coreNode, "dataDir", dataDir, null);
+ addCoreProperty(coreAttribs, coreNode, CORE_DATADIR, dataDir, null);
CloudDescriptor cd = dcore.getCloudDescriptor();
String shard = null;
if (cd != null) {
shard = cd.getShardId();
}
- addCoreProperty(coreAttribs, coreNode, "shard", shard, null);
+ addCoreProperty(coreAttribs, coreNode, CORE_SHARD, shard, null);
String collection = null;
// only write out the collection name if it's not the default (the
@@ -1212,12 +1224,12 @@ public class CoreContainer
collection = cd.getCollectionName();
}
- addCoreProperty(coreAttribs, coreNode, "collection", collection, dcore.name);
+ addCoreProperty(coreAttribs, coreNode, CORE_COLLECTION, collection, dcore.name);
// we don't try and preserve sys prop defs in these
String opt = dcore.getPropertiesName();
if (opt != null) {
- coreAttribs.put("properties", opt);
+ coreAttribs.put(CORE_PROPERTIES, opt);
}
SolrCoreXMLDef solrCoreXMLDef = new SolrCoreXMLDef();