You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2013/04/02 02:54:03 UTC
svn commit: r1463342 - in /lucene/dev/branches/branch_4x: ./ dev-tools/
lucene/ lucene/analysis/
lucene/analysis/icu/src/java/org/apache/lucene/collation/ lucene/backwards/
lucene/benchmark/ lucene/classification/ lucene/classification/src/
lucene/code...
Author: erick
Date: Tue Apr 2 00:54:00 2013
New Revision: 1463342
URL: http://svn.apache.org/r1463342
Log:
Fix for SOLR-4615, pull solr.properties out prior to deciding on the new mechanism
Added:
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolrXml.java
- copied unchanged from r1463316, lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXml.java
lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/solr-stress-new.xml
- copied unchanged from r1463316, lucene/dev/trunk/solr/core/src/test-files/solr/solr-stress-new.xml
lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/solr-stress-old.xml
- copied unchanged from r1463316, lucene/dev/trunk/solr/core/src/test-files/solr/solr-stress-old.xml
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
- copied unchanged from r1463316, lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
Removed:
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlBackCompat.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrProperties.java
lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/solr-shardhandler.properties
lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/solr-stress.xml
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrDiscoveryProperties.java
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/lucene/BUILD.txt (props changed)
lucene/dev/branches/branch_4x/lucene/CHANGES.txt (props changed)
lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt (props changed)
lucene/dev/branches/branch_4x/lucene/LICENSE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/MIGRATE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/README.txt (props changed)
lucene/dev/branches/branch_4x/lucene/SYSTEM_REQUIREMENTS.txt (props changed)
lucene/dev/branches/branch_4x/lucene/analysis/ (props changed)
lucene/dev/branches/branch_4x/lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationKeyFilterFactory.java (props changed)
lucene/dev/branches/branch_4x/lucene/backwards/ (props changed)
lucene/dev/branches/branch_4x/lucene/benchmark/ (props changed)
lucene/dev/branches/branch_4x/lucene/build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/classification/ (props changed)
lucene/dev/branches/branch_4x/lucene/classification/build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/classification/ivy.xml (props changed)
lucene/dev/branches/branch_4x/lucene/classification/src/ (props changed)
lucene/dev/branches/branch_4x/lucene/codecs/ (props changed)
lucene/dev/branches/branch_4x/lucene/common-build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.cfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.nocfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.cfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.nocfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSort.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSortDocValues.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSortRandom.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTotalHitCountCollector.java (props changed)
lucene/dev/branches/branch_4x/lucene/demo/ (props changed)
lucene/dev/branches/branch_4x/lucene/facet/ (props changed)
lucene/dev/branches/branch_4x/lucene/grouping/ (props changed)
lucene/dev/branches/branch_4x/lucene/highlighter/ (props changed)
lucene/dev/branches/branch_4x/lucene/ivy-settings.xml (props changed)
lucene/dev/branches/branch_4x/lucene/join/ (props changed)
lucene/dev/branches/branch_4x/lucene/licenses/ (props changed)
lucene/dev/branches/branch_4x/lucene/memory/ (props changed)
lucene/dev/branches/branch_4x/lucene/misc/ (props changed)
lucene/dev/branches/branch_4x/lucene/module-build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/queries/ (props changed)
lucene/dev/branches/branch_4x/lucene/queryparser/ (props changed)
lucene/dev/branches/branch_4x/lucene/sandbox/ (props changed)
lucene/dev/branches/branch_4x/lucene/site/ (props changed)
lucene/dev/branches/branch_4x/lucene/spatial/ (props changed)
lucene/dev/branches/branch_4x/lucene/suggest/ (props changed)
lucene/dev/branches/branch_4x/lucene/test-framework/ (props changed)
lucene/dev/branches/branch_4x/lucene/tools/ (props changed)
lucene/dev/branches/branch_4x/lucene/tools/junit4/cached-timehints.txt
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/CHANGES.txt (props changed)
lucene/dev/branches/branch_4x/solr/LICENSE.txt (props changed)
lucene/dev/branches/branch_4x/solr/NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/README.txt (props changed)
lucene/dev/branches/branch_4x/solr/SYSTEM_REQUIREMENTS.txt (props changed)
lucene/dev/branches/branch_4x/solr/build.xml (props changed)
lucene/dev/branches/branch_4x/solr/cloud-dev/ (props changed)
lucene/dev/branches/branch_4x/solr/common-build.xml (props changed)
lucene/dev/branches/branch_4x/solr/contrib/ (props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/Config.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreContainer.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestConfig.java (props changed)
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestShardHandlerFactory.java
lucene/dev/branches/branch_4x/solr/example/ (props changed)
lucene/dev/branches/branch_4x/solr/licenses/ (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpclient-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpclient-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpcore-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpcore-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpmime-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpmime-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/scripts/ (props changed)
lucene/dev/branches/branch_4x/solr/site/ (props changed)
lucene/dev/branches/branch_4x/solr/solrj/ (props changed)
lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java
lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java
lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
lucene/dev/branches/branch_4x/solr/test-framework/ (props changed)
lucene/dev/branches/branch_4x/solr/webapp/ (props changed)
Modified: lucene/dev/branches/branch_4x/lucene/tools/junit4/cached-timehints.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/tools/junit4/cached-timehints.txt?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/tools/junit4/cached-timehints.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/tools/junit4/cached-timehints.txt Tue Apr 2 00:54:00 2013
@@ -929,7 +929,7 @@ org.apache.solr.core.TestQuerySenderList
org.apache.solr.core.TestQuerySenderNoQuery=392,616,406,406,413,413,356
org.apache.solr.core.TestSolrDeletionPolicy1=636,736,868,732,627,1449,788
org.apache.solr.core.TestSolrDeletionPolicy2=377,450,376,388,413,459,373
-org.apache.solr.core.TestSolrDiscoveryProperties=1183,1243,5175,1041,1490,2090,1181
+org.apache.solr.core.TestCoreDiscovery=1183,1243,5175,1041,1490,2090,1181
org.apache.solr.core.TestSolrIndexConfig=491,411,360,426,407,414,369
org.apache.solr.core.TestSolrXMLSerializer=29,24,33,39,164,65,46
org.apache.solr.core.TestXIncludeConfig=158,139,147,115,1494,112,318
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java Tue Apr 2 00:54:00 2013
@@ -21,8 +21,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.solr.common.cloud.OnReconnect;
import org.apache.solr.common.cloud.SolrZkClient;
import org.apache.solr.core.ConfigSolr;
-import org.apache.solr.core.ConfigSolrXmlBackCompat;
-import org.apache.solr.core.SolrProperties;
+import org.apache.solr.core.ConfigSolrXml;
import org.apache.solr.core.SolrResourceLoader;
import org.apache.zookeeper.KeeperException;
import org.xml.sax.SAXException;
@@ -177,21 +176,12 @@ public class ZkCLI {
solrHome = loader.getInstanceDir();
File configFile = new File(solrHome, SOLR_XML);
- boolean isXml = true;
- if (! configFile.exists()) {
- configFile = new File(solrHome, SolrProperties.SOLR_PROPERTIES_FILE);
- isXml = false;
- }
InputStream is = new FileInputStream(configFile);
ConfigSolr cfg;
try {
- if (isXml) {
- cfg = new ConfigSolrXmlBackCompat(loader, null, is, null, false);
- } else {
- cfg = new SolrProperties(null, loader, is, null);
- }
+ cfg = new ConfigSolrXml(loader, null, is, null, false, null);
} finally {
IOUtils.closeQuietly(is);
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/Config.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/Config.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/Config.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/Config.java Tue Apr 2 00:54:00 2013
@@ -84,7 +84,7 @@ public class Config {
*/
@Deprecated
public Config(SolrResourceLoader loader, Config cfg) throws TransformerException {
- this(loader, null, ConfigSolrXmlBackCompat.copyDoc(cfg.getDocument()));
+ this(loader, null, ConfigSolrXml.copyDoc(cfg.getDocument()));
}
public Config(SolrResourceLoader loader, String name, InputSource is, String prefix) throws ParserConfigurationException, IOException, SAXException
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java Tue Apr 2 00:54:00 2013
@@ -33,16 +33,16 @@ import java.util.Properties;
* This is already deprecated, it's only intended to exist for while transitioning to properties-based replacement for
* solr.xml
*
- * @since solr 4.2
+ * @since solr 4.3
*/
-@Deprecated
public interface ConfigSolr {
public static enum ConfLevel {
SOLR, SOLR_CORES, SOLR_CORES_CORE, SOLR_LOGGING, SOLR_LOGGING_WATCHER
- }
+ };
- ;
+ public final static String CORE_PROP_FILE = "core.properties";
+ public final static String SOLR_XML_FILE = "solr.xml";
public int getInt(ConfLevel level, String tag, int def);
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=1463342&r1=1463341&r2=1463342&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 Tue Apr 2 00:54:00 2013
@@ -131,11 +131,11 @@ public class CoreContainer
private ShardHandlerFactory shardHandlerFactory;
protected LogWatcher logging = null;
private String zkHost;
+ private int transientCacheSize = Integer.MAX_VALUE;
private String leaderVoteWait = LEADER_VOTE_WAIT;
private int distribUpdateConnTimeout = 0;
private int distribUpdateSoTimeout = 0;
- protected int transientCacheSize = Integer.MAX_VALUE; // Use as a flag too, if transientCacheSize set in solr.xml this will be changed
private int coreLoadThreads;
private CloserThread backgroundCloser = null;
@@ -145,7 +145,7 @@ public class CoreContainer
/**
* Deprecated
- * @deprecated use the single arg constructure with locateSolrHome()
+ * @deprecated use the single arg constructor with locateSolrHome()
* @see SolrResourceLoader#locateSolrHome
*/
@Deprecated
@@ -321,19 +321,14 @@ public class CoreContainer
log.info("looking for solr config file: " + fconf.getAbsolutePath());
cores = new CoreContainer(solrHome);
- if (! fconf.exists()) {
- if (StringUtils.isBlank(containerConfigFilename) || containerConfigFilename.endsWith(".xml")) {
- fconf = new File(solrHome, SolrProperties.SOLR_PROPERTIES_FILE);
- }
- }
- // Either we have a config file or not. If it ends in .properties, assume new-style.
+ // Either we have a config file or not.
if (fconf.exists()) {
cores.load(solrHome, fconf);
} else {
- log.info("no solr.xml or solr.properties file found - using default old-style solr.xml");
+ log.info("no solr.xml found. using default old-style solr.xml");
try {
- cores.load(solrHome, new ByteArrayInputStream(ConfigSolrXmlBackCompat.DEF_SOLR_XML.getBytes("UTF-8")), true, null);
+ cores.load(solrHome, new ByteArrayInputStream(ConfigSolrXml.DEF_SOLR_XML.getBytes("UTF-8")), null);
} catch (Exception e) {
throw new SolrException(ErrorCode.SERVER_ERROR,
"CoreContainer.Initialize failed when trying to load default solr.xml file", e);
@@ -361,7 +356,7 @@ public class CoreContainer
this.configFile = configFile;
InputStream in = new FileInputStream(configFile);
try {
- this.load(dir, in, configFile.getName().endsWith(".xml"), configFile.getName());
+ this.load(dir, in, configFile.getName());
} finally {
IOUtils.closeQuietly(in);
}
@@ -375,7 +370,7 @@ public class CoreContainer
*/
// Let's keep this ugly boolean out of public circulation.
- protected void load(String dir, InputStream is, boolean isXmlFile, String fileName) {
+ protected void load(String dir, InputStream is, String fileName) {
ThreadPoolExecutor coreLoadExecutor = null;
if (null == dir) {
// don't rely on SolrResourceLoader(), determine explicitly first
@@ -389,16 +384,9 @@ public class CoreContainer
ConfigSolr cfg;
// keep orig config for persist to consult
- //TODO 5.0: Remove this confusing junk, the properties file is so fast to read that there's no good reason
- // to add this stuff. Furthermore, it would be good to persist comments when saving.....
try {
- if (isXmlFile) {
- cfg = new ConfigSolrXmlBackCompat(loader, null, is, null, false);
- this.cfg = new ConfigSolrXmlBackCompat(loader, (ConfigSolrXmlBackCompat)cfg);
- } else {
- cfg = new SolrProperties(this, loader, is, fileName);
- this.cfg = new SolrProperties(this, loader, (SolrProperties)cfg);
- }
+ cfg = new ConfigSolrXml(loader, null, is, null, false, this);
+ this.cfg = new ConfigSolrXml(loader, (ConfigSolrXml) cfg, this);
} catch (Exception e) {
throw new SolrException(ErrorCode.SERVER_ERROR, "", e);
}
@@ -479,13 +467,15 @@ public class CoreContainer
host = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "host", null);
leaderVoteWait = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "leaderVoteWait", LEADER_VOTE_WAIT);
-
+
if (shareSchema) {
indexSchemaCache = new ConcurrentHashMap<String,IndexSchema>();
}
adminHandler = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "adminHandler", null);
managementPath = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "managementPath", null);
-
+
+ transientCacheSize = cfg.getInt(ConfigSolr.ConfLevel.SOLR_CORES, "transientCacheSize", Integer.MAX_VALUE);
+
zkClientTimeout = Integer.parseInt(System.getProperty("zkClientTimeout",
Integer.toString(zkClientTimeout)));
initZooKeeper(zkHost, zkClientTimeout);
@@ -886,7 +876,8 @@ public class CoreContainer
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
"Could not find config name for collection:" + collection);
}
- solrLoader = new ZkSolrResourceLoader(instanceDir, zkConfigName, libLoader, SolrProperties.getCoreProperties(instanceDir, dcore), zkController);
+ solrLoader = new ZkSolrResourceLoader(instanceDir, zkConfigName, libLoader,
+ ConfigSolrXml.getCoreProperties(instanceDir, dcore), zkController);
config = getSolrConfigFromZk(zkConfigName, dcore.getConfigName(), solrLoader);
schema = IndexSchemaFactory.buildIndexSchema(dcore.getSchemaName(), config);
return new SolrCore(dcore.getName(), null, config, schema, dcore);
@@ -909,7 +900,7 @@ public class CoreContainer
SolrResourceLoader solrLoader = null;
SolrConfig config = null;
- solrLoader = new SolrResourceLoader(instanceDir, libLoader, SolrProperties.getCoreProperties(instanceDir, dcore));
+ solrLoader = new SolrResourceLoader(instanceDir, libLoader, ConfigSolrXml.getCoreProperties(instanceDir, dcore));
try {
config = new SolrConfig(solrLoader, dcore.getConfigName(), null);
} catch (Exception e) {
@@ -1066,7 +1057,7 @@ public class CoreContainer
cd.getName(), instanceDir.getAbsolutePath());
SolrResourceLoader solrLoader;
if(zkController == null) {
- solrLoader = new SolrResourceLoader(instanceDir.getAbsolutePath(), libLoader, SolrProperties.getCoreProperties(instanceDir.getAbsolutePath(), cd));
+ solrLoader = new SolrResourceLoader(instanceDir.getAbsolutePath(), libLoader, ConfigSolrXml.getCoreProperties(instanceDir.getAbsolutePath(), cd));
} else {
try {
String collection = cd.getCloudDescriptor().getCollectionName();
@@ -1079,7 +1070,7 @@ public class CoreContainer
"Could not find config name for collection:" + collection);
}
solrLoader = new ZkSolrResourceLoader(instanceDir.getAbsolutePath(), zkConfigName, libLoader,
- SolrProperties.getCoreProperties(instanceDir.getAbsolutePath(), cd), zkController);
+ ConfigSolrXml.getCoreProperties(instanceDir.getAbsolutePath(), cd), zkController);
} catch (KeeperException e) {
log.error("", e);
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
@@ -1229,7 +1220,24 @@ public class CoreContainer
public String getAdminPath() {
return adminPath;
}
-
+
+ public String getHostPort() {
+ return hostPort;
+ }
+
+ public String getHostContext() {
+ return hostContext;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public int getZkClientTimeout() {
+ return zkClientTimeout;
+ }
+
+
public void setAdminPath(String adminPath) {
this.adminPath = adminPath;
}
@@ -1308,10 +1316,6 @@ public class CoreContainer
coresAttribs.put("defaultCoreName", defaultCoreName);
}
- if (transientCacheSize != Integer.MAX_VALUE) {
- coresAttribs.put("transientCacheSize", Integer.toString(transientCacheSize));
- }
-
addCoresAttrib(coresAttribs, "hostPort", this.hostPort, DEFAULT_HOST_PORT);
addCoresAttrib(coresAttribs, "zkClientTimeout",
intToString(this.zkClientTimeout),
@@ -1319,6 +1323,10 @@ public class CoreContainer
addCoresAttrib(coresAttribs, "hostContext", this.hostContext, DEFAULT_HOST_CONTEXT);
addCoresAttrib(coresAttribs, "leaderVoteWait", this.leaderVoteWait, LEADER_VOTE_WAIT);
addCoresAttrib(coresAttribs, "coreLoadThreads", Integer.toString(this.coreLoadThreads), Integer.toString(CORE_LOAD_THREADS));
+ if (transientCacheSize != Integer.MAX_VALUE) { // This test
+ // is a consequence of testing. I really hate it.
+ addCoresAttrib(coresAttribs, "transientCacheSize", Integer.toString(this.transientCacheSize), Integer.toString(Integer.MAX_VALUE));
+ }
coreMaps.persistCores(cfg, containerProperties, rootSolrAttribs, coresAttribs, file, configFile, loader);
@@ -1402,8 +1410,6 @@ class CoreMaps {
private final Map<String, CoreDescriptor> dynamicDescriptors = new LinkedHashMap<String, CoreDescriptor>();
- private int transientCacheSize = Integer.MAX_VALUE;
-
private Map<SolrCore, String> coreToOrigName = new ConcurrentHashMap<SolrCore, String>();
private final CoreContainer container;
@@ -1423,7 +1429,7 @@ class CoreMaps {
// Trivial helper method for load, note it implements LRU on transient cores. Also note, if
// there is no setting for max size, nothing is done and all cores go in the regular "cores" list
protected void allocateLazyCores(final ConfigSolr cfg, final SolrResourceLoader loader) {
- transientCacheSize = cfg.getInt(ConfigSolr.ConfLevel.SOLR_CORES, "transientCacheSize", Integer.MAX_VALUE);
+ final int transientCacheSize = cfg.getInt(ConfigSolr.ConfLevel.SOLR_CORES, "transientCacheSize", Integer.MAX_VALUE);
if (transientCacheSize != Integer.MAX_VALUE) {
CoreContainer.log.info("Allocating transient cache for {} transient cores", transientCacheSize);
transientCores = new LinkedHashMap<String, SolrCore>(transientCacheSize, 0.75f, true) {
@@ -1535,7 +1541,7 @@ class CoreMaps {
CoreContainer.log.info("Opening transient core {}", name);
synchronized (locker) {
retCore = transientCores.put(name, core);
- }
+ }
return retCore;
}
@@ -1745,10 +1751,10 @@ class CoreMaps {
//
synchronized (locker) {
if (cfg == null) {
- ConfigSolrXmlBackCompat.initPersistStatic();
+ ConfigSolrXml.initPersistStatic();
persistCores(cfg, cores, loader);
persistCores(cfg, transientCores, loader);
- ConfigSolrXmlBackCompat.addPersistAllCoresStatic(containerProperties, rootSolrAttribs, coresAttribs,
+ ConfigSolrXml.addPersistAllCoresStatic(containerProperties, rootSolrAttribs, coresAttribs,
(file == null ? configFile : file));
} else {
cfg.initPersist();
@@ -1907,7 +1913,7 @@ class CoreMaps {
cfg.addPersistCore(coreName, persistProps, coreAttribs);
} else {
// Another awkward bit for back-compat for SOLR-4196
- ConfigSolrXmlBackCompat.addPersistCore(persistProps, coreAttribs);
+ ConfigSolrXml.addPersistCore(persistProps, coreAttribs);
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java Tue Apr 2 00:54:00 2013
@@ -134,7 +134,11 @@ public class CoreDescriptor {
}
public Properties initImplicitProperties() {
- Properties implicitProperties = new Properties(coreContainer.getContainerProperties());
+
+ Properties implicitProperties = new Properties();
+ if (coreContainer != null && coreContainer.getContainerProperties() != null){
+ implicitProperties.putAll(coreContainer.getContainerProperties());
+ }
implicitProperties.setProperty("solr.core.name", getName());
implicitProperties.setProperty("solr.core.instanceDir", getInstanceDir());
implicitProperties.setProperty("solr.core.dataDir", getDataDir());
@@ -203,6 +207,9 @@ public class CoreDescriptor {
return SolrResourceLoader.normalizeDir(
SolrResourceLoader.normalizeDir(instDir));
}
+
+ if (coreContainer == null) return null;
+
return SolrResourceLoader.normalizeDir(coreContainer.getSolrHome() +
SolrResourceLoader.normalizeDir(instDir));
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java Tue Apr 2 00:54:00 2013
@@ -438,6 +438,18 @@ public class CoreAdminHandler extends Re
if (opts != null)
dcore.setUlogDir(opts);
+ opts = params.get(CoreAdminParams.LOAD_ON_STARTUP);
+ if (opts != null){
+ Boolean value = Boolean.valueOf(opts);
+ dcore.setLoadOnStartup(value);
+ }
+
+ opts = params.get(CoreAdminParams.TRANSIENT);
+ if (opts != null){
+ Boolean value = Boolean.valueOf(opts);
+ dcore.setTransient(value);
+ }
+
CloudDescriptor cd = dcore.getCloudDescriptor();
if (cd != null) {
cd.setParams(req.getParams());
@@ -457,7 +469,7 @@ public class CoreAdminHandler extends Re
opts = params.get(CoreAdminParams.CORE_NODE_NAME);
if (opts != null)
cd.setCoreNodeName(opts);
-
+
Integer numShards = params.getInt(ZkStateReader.NUM_SHARDS_PROP);
if (numShards != null)
cd.setNumShards(numShards);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java Tue Apr 2 00:54:00 2013
@@ -214,11 +214,12 @@ public class OpenCloseCoreStressTest ext
private void makeCores(File home, boolean oldStyle) throws Exception {
File testSrcRoot = new File(SolrTestCaseJ4.TEST_HOME());
+ String srcSolrXml = "solr-stress-new.xml";
+
if (oldStyle) {
- FileUtils.copyFile(new File(testSrcRoot, "solr-stress.xml"), new File(home, "solr.xml"));
- } else {
- FileUtils.copyFile(new File(testSrcRoot, "solr-stress.properties"), new File(home, "solr.properties"));
+ srcSolrXml = "solr-stress-old.xml";
}
+ FileUtils.copyFile(new File(testSrcRoot, srcSolrXml), new File(home, "solr.xml"));
// create directories in groups of 100 until you have enough.
for (int idx = 0; idx < numCores; ++idx) {
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java Tue Apr 2 00:54:00 2013
@@ -193,12 +193,11 @@ public class TestCoreContainer extends S
assertEquals("cores not added?", 3, cores.getCoreNames().size());
final File twoXml = new File(workDir, "2.solr.xml");
- cores.transientCacheSize = 32;
cores.persistFile(twoXml);
assertXmlFile(twoXml, "/solr[@persistent='true']",
- "/solr/cores[@defaultCoreName='collection1' and @transientCacheSize='32']",
+ "/solr/cores[@defaultCoreName='collection1']",
"/solr/cores/core[@name='collection1' and @instanceDir='" + instDir
+ "']", "/solr/cores/core[@name='X' and @instanceDir='" + instDir
+ "' and @dataDir='" + dataX + "']",
@@ -271,7 +270,7 @@ public class TestCoreContainer extends S
FileUtils.deleteDirectory(solrHomeDirectory);
throw e;
}
-
+
//init
System.setProperty("solr.solr.home", solrHomeDirectory.getAbsolutePath());
CoreContainer.Initializer init = new CoreContainer.Initializer();
@@ -293,8 +292,13 @@ public class TestCoreContainer extends S
cores.register(newCore, false);
//assert one registered core
+
assertEquals("There core registered", 1, cores.getCores().size());
-
+
+
+ assertXmlFile(new File(solrHomeDirectory, "solr.xml"),
+ "/solr/cores[@transientCacheSize='32']");
+
newCore.close();
cores.remove("core1");
//assert cero cores
@@ -308,7 +312,7 @@ public class TestCoreContainer extends S
private static final String EMPTY_SOLR_XML ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
"<solr persistent=\"false\">\n" +
- " <cores adminPath=\"/admin/cores\">\n" +
+ " <cores adminPath=\"/admin/cores\" transientCacheSize=\"32\" >\n" +
" </cores>\n" +
"</solr>";
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestShardHandlerFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestShardHandlerFactory.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestShardHandlerFactory.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestShardHandlerFactory.java Tue Apr 2 00:54:00 2013
@@ -38,15 +38,4 @@ public class TestShardHandlerFactory ext
factory.close();
cc.shutdown();
}
-
- public void testProperties() throws Exception {
- CoreContainer cc = new CoreContainer(TEST_HOME());
- cc.load(TEST_HOME(), new File(TEST_HOME(), "solr-shardhandler.properties"));
- ShardHandlerFactory factory = cc.getShardHandlerFactory();
- assertTrue(factory instanceof MockShardHandlerFactory);
- NamedList args = ((MockShardHandlerFactory)factory).args;
- assertEquals("myMagicRequiredValue", args.get("myMagicRequiredParameter"));
- factory.close();
- cc.shutdown();
- }
}
Modified: lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java Tue Apr 2 00:54:00 2013
@@ -57,6 +57,8 @@ public class CoreAdminRequest extends So
private String shardId;
private String roles;
private String coreNodeName;
+ private Boolean loadOnStartup;
+ private Boolean isTransient;
public Create() {
action = CoreAdminAction.CREATE;
@@ -72,7 +74,9 @@ public class CoreAdminRequest extends So
public void setShardId(String shardId) {this.shardId = shardId;}
public void setRoles(String roles) {this.roles = roles;}
public void setCoreNodeName(String coreNodeName) {this.coreNodeName = coreNodeName;}
-
+ public void setIsTransient(Boolean isTransient) { this.isTransient = isTransient; }
+ public void setIsLoadOnStartup(Boolean loadOnStartup) { this.loadOnStartup = loadOnStartup;}
+
public String getInstanceDir() { return instanceDir; }
public String getSchemaName() { return schemaName; }
public String getConfigName() { return configName; }
@@ -82,7 +86,9 @@ public class CoreAdminRequest extends So
public String getShardId() { return shardId; }
public String getRoles() { return roles; }
public String getCoreNodeName() { return coreNodeName; }
-
+ public Boolean getIsLoadOnStartup() { return loadOnStartup; }
+ public Boolean getIsTransient() { return isTransient; }
+
@Override
public SolrParams getParams() {
if( action == null ) {
@@ -123,6 +129,14 @@ public class CoreAdminRequest extends So
if (coreNodeName != null) {
params.set( CoreAdminParams.CORE_NODE_NAME, coreNodeName);
}
+
+ if (isTransient != null) {
+ params.set(CoreAdminParams.TRANSIENT, isTransient);
+ }
+
+ if (loadOnStartup != null) {
+ params.set(CoreAdminParams.LOAD_ON_STARTUP, loadOnStartup);
+ }
return params;
}
@@ -151,11 +165,11 @@ public class CoreAdminRequest extends So
public String getCoreNodeName() {
return coreNodeName;
}
-
+
public void setCoreNodeName(String coreNodeName) {
this.coreNodeName = coreNodeName;
}
-
+
public String getState() {
return state;
}
Modified: lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java Tue Apr 2 00:54:00 2013
@@ -88,6 +88,9 @@ public interface CoreAdminParams
public static final String DELETE_INSTANCE_DIR = "deleteInstanceDir";
+ public static final String LOAD_ON_STARTUP = "loadOnStartup";
+
+ public static final String TRANSIENT = "transient";
public enum CoreAdminAction {
STATUS,
@@ -104,7 +107,9 @@ public interface CoreAdminParams
REQUESTRECOVERY,
REQUESTSYNCSHARD,
CREATEALIAS,
- DELETEALIAS;
+ DELETEALIAS,
+ LOAD_ON_STARTUP,
+ TRANSIENT;
public static CoreAdminAction get( String p )
{
Modified: lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java?rev=1463342&r1=1463341&r2=1463342&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java Tue Apr 2 00:54:00 2013
@@ -83,13 +83,29 @@ public class TestCoreAdmin extends Abstr
req.setInstanceDir(newCoreInstanceDir.getAbsolutePath() + File.separator + "newcore");
req.setDataDir(dataDir.getAbsolutePath());
req.setUlogDir(new File(dataDir, "ulog").getAbsolutePath());
+
+ // These should be the inverse of defaults.
+ req.setIsLoadOnStartup(false);
+ req.setIsTransient(true);
req.process(server);
-
+
+ // Show that the newly-created core has values for load on startup and transient different than defaults due to the
+ // above.
+
+ SolrCore coreProveIt = cores.getCore("collection1");
SolrCore core = cores.getCore("newcore");
+
+ assertTrue(core.getCoreDescriptor().isTransient());
+ assertFalse(coreProveIt.getCoreDescriptor().isTransient());
+
+ assertFalse(core.getCoreDescriptor().isLoadOnStartup());
+ assertTrue(coreProveIt.getCoreDescriptor().isLoadOnStartup());
+
File logDir;
try {
logDir = core.getUpdateHandler().getUpdateLog().getLogDir();
} finally {
+ coreProveIt.close();
core.close();
}
assertEquals(new File(dataDir, "ulog" + File.separator + "tlog").getAbsolutePath(), logDir.getAbsolutePath());