SOLR-4622: deprecate hardcoded hostContext and hostPort defaults

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1463242 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2013-04-01 18:27:50 +00:00
parent e26f9c49ef
commit 3d184a2452
8 changed files with 40 additions and 10 deletions

View File

@ -68,6 +68,12 @@ Upgrading from Solr 4.2.0
eliminated the dist-war-excl-slf4j target and made dist-excl-slf4j eliminated the dist-war-excl-slf4j target and made dist-excl-slf4j
redundant. redundant.
* SOLR-4622: The hardcoded SolrCloud defaults for 'hostContext="solr"' and
'hostPort="8983"' have been deprecated and will be removed in Solr 5.0.
Existing solr.xml files that do not have these options explicitly specified
should be updated accordingly.
Detailed Change List Detailed Change List
---------------------- ----------------------
@ -155,6 +161,11 @@ Other Changes
* SOLR-4651: Remove dist-excl-slf4j build target. (Shawn Heisey) * SOLR-4651: Remove dist-excl-slf4j build target. (Shawn Heisey)
* SOLR-4622: The hardcoded SolrCloud defaults for 'hostContext="solr"' and
'hostPort="8983"' have been deprecated and will be removed in Solr 5.0.
Existing solr.xml files that do not have these options explicitly specified
should be updated accordingly. (hossman)
================== 4.2.1 ================== ================== 4.2.1 ==================
Versions of Major Components Versions of Major Components

View File

@ -90,7 +90,9 @@ public class CoreContainer
{ {
private static final String LEADER_VOTE_WAIT = "180000"; // 3 minutes private static final String LEADER_VOTE_WAIT = "180000"; // 3 minutes
private static final int CORE_LOAD_THREADS = 3; private static final int CORE_LOAD_THREADS = 3;
/** @deprecated will be remove in Solr 5.0 (SOLR-4622) */
private static final String DEFAULT_HOST_CONTEXT = "solr"; private static final String DEFAULT_HOST_CONTEXT = "solr";
/** @deprecated will be remove in Solr 5.0 (SOLR-4622) */
private static final String DEFAULT_HOST_PORT = "8983"; private static final String DEFAULT_HOST_PORT = "8983";
private static final int DEFAULT_ZK_CLIENT_TIMEOUT = 15000; private static final int DEFAULT_ZK_CLIENT_TIMEOUT = 15000;
public static final String DEFAULT_DEFAULT_CORE_NAME = "collection1"; public static final String DEFAULT_DEFAULT_CORE_NAME = "collection1";
@ -186,6 +188,21 @@ public class CoreContainer
if (zkRun == null && zookeeperHost == null) if (zkRun == null && zookeeperHost == null)
return; // not in zk mode return; // not in zk mode
// BEGIN: SOLR-4622: deprecated hardcoded defaults for hostPort & hostContext
if (null == hostPort) {
// throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
// "'hostPort' must be configured to run SolrCloud");
log.warn("Solr 'hostPort' has not be explicitly configured, using hardcoded default of " + DEFAULT_HOST_PORT + ". This default has been deprecated and will be removed in future versions of Solr, please configure this value explicitly");
hostPort = DEFAULT_HOST_PORT;
}
if (null == hostContext) {
// throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
// "'hostContext' must be configured to run SolrCloud");
log.warn("Solr 'hostContext' has not be explicitly configured, using hardcoded default of " + DEFAULT_HOST_CONTEXT + ". This default has been deprecated and will be removed in future versions of Solr, please configure this value explicitly");
hostContext = DEFAULT_HOST_CONTEXT;
}
// END: SOLR-4622
// zookeeper in quorum mode currently causes a failure when trying to // zookeeper in quorum mode currently causes a failure when trying to
// register log4j mbeans. See SOLR-2369 // register log4j mbeans. See SOLR-2369
// TODO: remove after updating to an slf4j based zookeeper // TODO: remove after updating to an slf4j based zookeeper
@ -454,9 +471,11 @@ public class CoreContainer
distribUpdateConnTimeout = cfg.getInt(ConfigSolr.ConfLevel.SOLR_CORES, "distribUpdateConnTimeout", 0); distribUpdateConnTimeout = cfg.getInt(ConfigSolr.ConfLevel.SOLR_CORES, "distribUpdateConnTimeout", 0);
distribUpdateSoTimeout = cfg.getInt(ConfigSolr.ConfLevel.SOLR_CORES, "distribUpdateSoTimeout", 0); distribUpdateSoTimeout = cfg.getInt(ConfigSolr.ConfLevel.SOLR_CORES, "distribUpdateSoTimeout", 0);
hostPort = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "hostPort", DEFAULT_HOST_PORT); // Note: initZooKeeper will apply hardcoded default if cloud mode
hostPort = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "hostPort", null);
// Note: initZooKeeper will apply hardcoded default if cloud mode
hostContext = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "hostContext", null);
hostContext = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "hostContext", DEFAULT_HOST_CONTEXT);
host = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "host", null); host = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "host", null);
leaderVoteWait = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "leaderVoteWait", LEADER_VOTE_WAIT); leaderVoteWait = cfg.get(ConfigSolr.ConfLevel.SOLR_CORES, "leaderVoteWait", LEADER_VOTE_WAIT);

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<solr sharedLib="lib" persistent="true"> <solr sharedLib="lib" persistent="true">
<cores adminPath="/admin/cores"> <cores adminPath="/admin/cores" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}">
<core default="true" instanceDir="db" name="db"/> <core default="true" instanceDir="db" name="db"/>
<core default="false" instanceDir="rss" name="rss"/> <core default="false" instanceDir="rss" name="rss"/>
<core default="false" instanceDir="mail" name="mail"/> <core default="false" instanceDir="mail" name="mail"/>

View File

@ -28,7 +28,7 @@
adminPath: RequestHandler path to manage cores. adminPath: RequestHandler path to manage cores.
If 'null' (or absent), cores will not be manageable via request handler If 'null' (or absent), cores will not be manageable via request handler
--> -->
<cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:}"> <cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}">
<core name="core0" instanceDir="core0" /> <core name="core0" instanceDir="core0" />
<core name="core1" instanceDir="core1" /> <core name="core1" instanceDir="core1" />
</cores> </cores>

View File

@ -47,7 +47,7 @@
All of the attributes in cores after defaultCoreName only apply when running in SolrCloud mode. All of the attributes in cores after defaultCoreName only apply when running in SolrCloud mode.
You can read more about SolrCloud mode at http://wiki.apache.org/solr/SolrCloud You can read more about SolrCloud mode at http://wiki.apache.org/solr/SolrCloud
--> -->
<cores adminPath="/admin/cores" defaultCoreName="collection1" host="${host:}" hostPort="${jetty.port:}" hostContext="${hostContext:}" zkClientTimeout="${zkClientTimeout:15000}"> <cores adminPath="/admin/cores" defaultCoreName="collection1" host="${host:}" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}" zkClientTimeout="${zkClientTimeout:15000}">
<core name="collection1" instanceDir="collection1" /> <core name="collection1" instanceDir="collection1" />
</cores> </cores>
</solr> </solr>

View File

@ -30,7 +30,7 @@
adminPath: RequestHandler path to manage cores. adminPath: RequestHandler path to manage cores.
If 'null' (or absent), cores will not be manageable via REST If 'null' (or absent), cores will not be manageable via REST
--> -->
<cores adminPath="/admin/cores" defaultCoreName="core0" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:}" zkClientTimeout="8000"> <cores adminPath="/admin/cores" defaultCoreName="core0" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000">
<core name="collection1" instanceDir="." /> <core name="collection1" instanceDir="." />
<core name="core0" instanceDir="${theInstanceDir:./}" dataDir="${dataDir1}" collection="${collection:acollection}"> <core name="core0" instanceDir="${theInstanceDir:./}" dataDir="${dataDir1}" collection="${collection:acollection}">
<property name="version" value="3.5"/> <property name="version" value="3.5"/>

View File

@ -28,7 +28,7 @@
adminPath: RequestHandler path to manage cores. adminPath: RequestHandler path to manage cores.
If 'null' (or absent), cores will not be manageable via request handler If 'null' (or absent), cores will not be manageable via request handler
--> -->
<cores adminPath="/admin/cores" defaultCoreName="collection1" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:}" zkClientTimeout="8000" numShards="${numShards:3}"> <cores adminPath="/admin/cores" defaultCoreName="collection1" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000" numShards="${numShards:3}">
<core name="collection1" instanceDir="collection1" shard="${shard:}" collection="${collection:collection1}" config="${solrconfig:solrconfig.xml}" schema="${schema:schema.xml}"/> <core name="collection1" instanceDir="collection1" shard="${shard:}" collection="${collection:collection1}" config="${solrconfig:solrconfig.xml}" schema="${schema:schema.xml}"/>
</cores> </cores>
</solr> </solr>

View File

@ -194,8 +194,8 @@ public class TestSolrProperties extends AbstractEmbeddedSolrServerTestCase {
exists("/solr/cores[@hostPort='${hostPort:8983}']", document)); exists("/solr/cores[@hostPort='${hostPort:8983}']", document));
assertTrue("\"/solr/cores[@zkClientTimeout='8000']\" doesn't match in:\n" + solrPersistXml, assertTrue("\"/solr/cores[@zkClientTimeout='8000']\" doesn't match in:\n" + solrPersistXml,
exists("/solr/cores[@zkClientTimeout='8000']", document)); exists("/solr/cores[@zkClientTimeout='8000']", document));
assertTrue("\"/solr/cores[@hostContext='solr']\" doesn't match in:\n" + solrPersistXml, assertTrue("\"/solr/cores[@hostContext='${hostContext:solr}']\" doesn't match in:\n" + solrPersistXml,
exists("/solr/cores[@hostContext='solr']", document)); exists("/solr/cores[@hostContext='${hostContext:solr}']", document));
} finally { } finally {
fis.close(); fis.close();