mirror of https://github.com/apache/lucene.git
SOLR-3264: Fix CoreContainer and SolrResourceLoader logging to stop misleading people about SolrCore instanceDir's being the Solr Home Dir
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1305697 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7433d817db
commit
3f32f09c95
|
@ -729,6 +729,10 @@ Bug Fixes
|
||||||
and was fundamentally broken/bizarre.
|
and was fundamentally broken/bizarre.
|
||||||
(hossman, Ahmet Arslan)
|
(hossman, Ahmet Arslan)
|
||||||
|
|
||||||
|
* SOLR-3264: Fix CoreContainer and SolrResourceLoader logging to be more
|
||||||
|
clear about when SolrCores are being created, and stop misleading people
|
||||||
|
about SolrCore instanceDir's being the "Solr Home Dir" (hossman)
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
----------------------
|
----------------------
|
||||||
* SOLR-2922: Upgrade commons-io and commons-lang to 2.1 and 2.6, respectively. (koji)
|
* SOLR-2922: Upgrade commons-io and commons-lang to 2.1 and 2.6, respectively. (koji)
|
||||||
|
|
|
@ -123,8 +123,14 @@ public class CoreContainer
|
||||||
log.info("New CoreContainer " + System.identityHashCode(this));
|
log.info("New CoreContainer " + System.identityHashCode(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated
|
||||||
|
* @deprecated use the single arg constructure with locateSolrHome()
|
||||||
|
* @see SolrResourceLoader#locateSolrHome
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public CoreContainer() {
|
public CoreContainer() {
|
||||||
solrHome = SolrResourceLoader.locateSolrHome();
|
this(SolrResourceLoader.locateSolrHome());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,6 +144,7 @@ public class CoreContainer
|
||||||
*/
|
*/
|
||||||
public CoreContainer(String dir, File configFile) throws ParserConfigurationException, IOException, SAXException
|
public CoreContainer(String dir, File configFile) throws ParserConfigurationException, IOException, SAXException
|
||||||
{
|
{
|
||||||
|
this(dir);
|
||||||
this.load(dir, configFile);
|
this.load(dir, configFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +153,8 @@ public class CoreContainer
|
||||||
* @param loader the CoreContainer resource loader
|
* @param loader the CoreContainer resource loader
|
||||||
*/
|
*/
|
||||||
public CoreContainer(SolrResourceLoader loader) {
|
public CoreContainer(SolrResourceLoader loader) {
|
||||||
|
this(loader.getInstanceDir());
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
this.solrHome = loader.getInstanceDir();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreContainer(String solrHome) {
|
public CoreContainer(String solrHome) {
|
||||||
|
@ -287,7 +294,7 @@ public class CoreContainer
|
||||||
File fconf = new File(solrHome, containerConfigFilename == null ? "solr.xml"
|
File fconf = new File(solrHome, containerConfigFilename == null ? "solr.xml"
|
||||||
: containerConfigFilename);
|
: containerConfigFilename);
|
||||||
log.info("looking for solr.xml: " + fconf.getAbsolutePath());
|
log.info("looking for solr.xml: " + fconf.getAbsolutePath());
|
||||||
cores = new CoreContainer();
|
cores = new CoreContainer(solrHome);
|
||||||
|
|
||||||
if (fconf.exists()) {
|
if (fconf.exists()) {
|
||||||
cores.load(solrHome, fconf);
|
cores.load(solrHome, fconf);
|
||||||
|
@ -355,6 +362,13 @@ public class CoreContainer
|
||||||
*/
|
*/
|
||||||
public void load(String dir, InputSource cfgis)
|
public void load(String dir, InputSource cfgis)
|
||||||
throws ParserConfigurationException, IOException, SAXException {
|
throws ParserConfigurationException, IOException, SAXException {
|
||||||
|
|
||||||
|
if (null == dir) {
|
||||||
|
// don't rely on SolrResourceLoader(), determine explicitly first
|
||||||
|
dir = SolrResourceLoader.locateSolrHome();
|
||||||
|
}
|
||||||
|
log.info("Loading CoreContainer using Solr Home: '{}'", dir);
|
||||||
|
|
||||||
this.loader = new SolrResourceLoader(dir);
|
this.loader = new SolrResourceLoader(dir);
|
||||||
solrHome = loader.getInstanceDir();
|
solrHome = loader.getInstanceDir();
|
||||||
|
|
||||||
|
@ -675,7 +689,8 @@ public class CoreContainer
|
||||||
idir = new File(solrHome, dcore.getInstanceDir());
|
idir = new File(solrHome, dcore.getInstanceDir());
|
||||||
}
|
}
|
||||||
String instanceDir = idir.getPath();
|
String instanceDir = idir.getPath();
|
||||||
|
log.info("Creating SolrCore '{}' using instanceDir: {}",
|
||||||
|
dcore.getName(), instanceDir);
|
||||||
// Initialize the solr config
|
// Initialize the solr config
|
||||||
SolrResourceLoader solrLoader = null;
|
SolrResourceLoader solrLoader = null;
|
||||||
|
|
||||||
|
@ -831,6 +846,9 @@ public class CoreContainer
|
||||||
if (!instanceDir.isAbsolute()) {
|
if (!instanceDir.isAbsolute()) {
|
||||||
instanceDir = new File(getSolrHome(), cd.getInstanceDir());
|
instanceDir = new File(getSolrHome(), cd.getInstanceDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("Reloading SolrCore '{}' using instanceDir: {}",
|
||||||
|
cd.getName(), instanceDir.getAbsolutePath());
|
||||||
|
|
||||||
SolrResourceLoader solrLoader;
|
SolrResourceLoader solrLoader;
|
||||||
if(zkController == null) {
|
if(zkController == null) {
|
||||||
|
@ -956,7 +974,8 @@ public class CoreContainer
|
||||||
* @return a CoreAdminHandler
|
* @return a CoreAdminHandler
|
||||||
*/
|
*/
|
||||||
protected CoreAdminHandler createMultiCoreHandler(final String adminHandlerClass) {
|
protected CoreAdminHandler createMultiCoreHandler(final String adminHandlerClass) {
|
||||||
SolrResourceLoader loader = new SolrResourceLoader(null, libLoader, null);
|
// :TODO: why create a new SolrResourceLoader? why not use this.loader ???
|
||||||
|
SolrResourceLoader loader = new SolrResourceLoader(solrHome, libLoader, null);
|
||||||
Object obj = loader.newAdminHandlerInstance(CoreContainer.this, adminHandlerClass);
|
Object obj = loader.newAdminHandlerInstance(CoreContainer.this, adminHandlerClass);
|
||||||
if ( !(obj instanceof CoreAdminHandler))
|
if ( !(obj instanceof CoreAdminHandler))
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,17 +88,22 @@ public class SolrResourceLoader implements ResourceLoader
|
||||||
* This loader will delegate to the context classloader when possible,
|
* This loader will delegate to the context classloader when possible,
|
||||||
* otherwise it will attempt to resolve resources using any jar files
|
* otherwise it will attempt to resolve resources using any jar files
|
||||||
* found in the "lib/" directory in the specified instance directory.
|
* found in the "lib/" directory in the specified instance directory.
|
||||||
* If the instance directory is not specified (=null), SolrResourceLoader#locateInstanceDir will provide one.
|
* </p>
|
||||||
* <p>
|
*
|
||||||
|
* @param instanceDir - base directory for this resource loader, if null locateSolrHome() will be used.
|
||||||
|
* @see #locateSolrHome
|
||||||
*/
|
*/
|
||||||
public SolrResourceLoader( String instanceDir, ClassLoader parent, Properties coreProperties )
|
public SolrResourceLoader( String instanceDir, ClassLoader parent, Properties coreProperties )
|
||||||
{
|
{
|
||||||
if( instanceDir == null ) {
|
if( instanceDir == null ) {
|
||||||
this.instanceDir = SolrResourceLoader.locateSolrHome();
|
this.instanceDir = SolrResourceLoader.locateSolrHome();
|
||||||
|
log.info("new SolrResourceLoader for deduced Solr Home: '{}'",
|
||||||
|
this.instanceDir);
|
||||||
} else{
|
} else{
|
||||||
this.instanceDir = normalizeDir(instanceDir);
|
this.instanceDir = normalizeDir(instanceDir);
|
||||||
|
log.info("new SolrResourceLoader for directory: '{}'",
|
||||||
|
this.instanceDir);
|
||||||
}
|
}
|
||||||
log.info("Solr home set to '" + this.instanceDir + "'");
|
|
||||||
|
|
||||||
this.classLoader = createClassLoader(null, parent);
|
this.classLoader = createClassLoader(null, parent);
|
||||||
addToClassLoader("./lib/", null);
|
addToClassLoader("./lib/", null);
|
||||||
|
@ -607,6 +612,7 @@ public class SolrResourceLoader implements ResourceLoader
|
||||||
* @see #normalizeDir(String)
|
* @see #normalizeDir(String)
|
||||||
*/
|
*/
|
||||||
public static String locateSolrHome() {
|
public static String locateSolrHome() {
|
||||||
|
|
||||||
String home = null;
|
String home = null;
|
||||||
// Try JNDI
|
// Try JNDI
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue