lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romseyg...@apache.org
Subject svn commit: r1566598 - in /lucene/dev/trunk/solr: ./ core/src/java/org/apache/solr/core/ core/src/test/org/apache/solr/core/ test-framework/src/java/org/apache/solr/util/
Date Mon, 10 Feb 2014 12:45:05 GMT
Author: romseygeek
Date: Mon Feb 10 12:45:04 2014
New Revision: 1566598

URL: http://svn.apache.org/r1566598
Log:
SOLR-5704: new cores should be created under coreRootDirectory

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXml.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1566598&r1=1566597&r2=1566598&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Mon Feb 10 12:45:04 2014
@@ -299,6 +299,9 @@ Bug Fixes
 * SOLR-5644: SplitShard does not handle not finding a shard leader well.
   (Mark Miller, Anshum Gupta via shalin)
 
+* SOLR-5704: coreRootDirectory was not respected when creating new cores
+  via CoreAdminHandler (Jesse Sipprell, Alan Woodward)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java?rev=1566598&r1=1566597&r2=1566598&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java Mon Feb 10 12:45:04
2014
@@ -74,8 +74,8 @@ public abstract class ConfigSolr {
     }
   }
 
-  public static ConfigSolr fromString(String xml) {
-    return fromInputStream(null, new ByteArrayInputStream(xml.getBytes(Charsets.UTF_8)));
+  public static ConfigSolr fromString(SolrResourceLoader loader, String xml) {
+    return fromInputStream(loader, new ByteArrayInputStream(xml.getBytes(Charsets.UTF_8)));
   }
 
   public static ConfigSolr fromInputStream(SolrResourceLoader loader, InputStream is) {
@@ -104,6 +104,17 @@ public abstract class ConfigSolr {
   
   public abstract CoresLocator getCoresLocator();
 
+
+  /**
+   * The directory against which relative core instance dirs are resolved.  If none is
+   * specified in the config, uses solr home.
+   *
+   * @return core root directory
+   */
+  public String getCoreRootDirectory() {
+    return get(CfgProp.SOLR_COREROOTDIRECTORY, config.getResourceLoader().getInstanceDir());
+  }
+
   public PluginInfo getShardHandlerFactoryPluginInfo() {
     Node node = config.getNode(getShardHandlerFactoryConfigPath(), false);
     return (node == null) ? null : new PluginInfo(node, "shardHandlerFactory", false, true);

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXml.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXml.java?rev=1566598&r1=1566597&r2=1566598&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXml.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXml.java Mon Feb 10
12:45:04 2014
@@ -40,9 +40,7 @@ public class ConfigSolrXml extends Confi
       checkForIllegalConfig();
       fillPropMap();
       config.substituteProperties();
-      log.info("Config-defined core root directory: {}", get(CfgProp.SOLR_COREROOTDIRECTORY,
""));
-      String coreRoot = get(CfgProp.SOLR_COREROOTDIRECTORY, config.getResourceLoader().getInstanceDir());
-      coresLocator = new CorePropertiesLocator(coreRoot);
+      coresLocator = new CorePropertiesLocator(getCoreRootDirectory());
     }
     catch (IOException e) {
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java?rev=1566598&r1=1566597&r2=1566598&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java Mon Feb 10
12:45:04 2014
@@ -793,6 +793,10 @@ public class CoreContainer {
     return null;
   }
 
+  public String getCoreRootDirectory() {
+    return cfg.getCoreRootDirectory();
+  }
+
   /**
    * Gets a core by name and increase its refcount.
    *

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java?rev=1566598&r1=1566597&r2=1566598&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java Mon Feb 10
12:45:04 2014
@@ -162,7 +162,7 @@ public class CoreDescriptor {
     coreProperties.putAll(defaultProperties);
     coreProperties.put(CORE_NAME, name);
     coreProperties.put(CORE_INSTDIR, instanceDir);
-    coreProperties.put(CORE_ABS_INSTDIR, convertToAbsolute(instanceDir, container.getSolrHome()));
+    coreProperties.put(CORE_ABS_INSTDIR, convertToAbsolute(instanceDir, container.getCoreRootDirectory()));
 
     for (String propname : coreProps.stringPropertyNames()) {
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java?rev=1566598&r1=1566597&r2=1566598&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java Mon
Feb 10 12:45:04 2014
@@ -47,6 +47,7 @@ public class CorePropertiesLocator imple
 
   public CorePropertiesLocator(String coreDiscoveryRoot) {
     this.rootDirectory = new File(coreDiscoveryRoot);
+    logger.info("Config-defined core root directory: {}", this.rootDirectory.getAbsolutePath());
   }
 
   @Override

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java?rev=1566598&r1=1566597&r2=1566598&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java Mon Feb
10 12:45:04 2014
@@ -322,8 +322,8 @@ public class TestCoreContainer extends S
   @Test
   public void testCustomHandlers() throws Exception {
 
-    ConfigSolr config = ConfigSolr.fromString(CUSTOM_HANDLERS_SOLR_XML);
     SolrResourceLoader loader = new SolrResourceLoader("solr/collection1");
+    ConfigSolr config = ConfigSolr.fromString(loader, CUSTOM_HANDLERS_SOLR_XML);
 
     CoreContainer cc = new CoreContainer(loader, config);
     try {

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java?rev=1566598&r1=1566597&r2=1566598&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java Mon
Feb 10 12:45:04 2014
@@ -132,7 +132,7 @@ public class TestHarness extends BaseTes
       this.coreName = coreName;
 
       SolrResourceLoader loader = new SolrResourceLoader(SolrResourceLoader.locateSolrHome());
-      ConfigSolr config = getTestHarnessConfig(coreName, dataDir, solrConfig, indexSchema);
+      ConfigSolr config = getTestHarnessConfig(loader, coreName, dataDir, solrConfig, indexSchema);
       container = new CoreContainer(loader, config);
       container.load();
 
@@ -150,11 +150,19 @@ public class TestHarness extends BaseTes
   /**
    * Create a TestHarness using a specific solr home directory and solr xml
    * @param solrHome the solr home directory
-   * @param solrXml a File pointing to a solr.xml configuration
+   * @param solrXml the text of a solrxml
    */
   public TestHarness(String solrHome, String solrXml) {
-    this(new SolrResourceLoader(solrHome),
-          ConfigSolr.fromString(solrXml));
+    this(new SolrResourceLoader(solrHome), solrXml);
+  }
+
+  /**
+   * Create a TestHarness using a specific solr resource loader and solr xml
+   * @param loader the SolrResourceLoader to use
+   * @param solrXml the text of a solrxml
+   */
+  public TestHarness(SolrResourceLoader loader, String solrXml) {
+    this(loader, ConfigSolr.fromString(loader, solrXml));
   }
 
   /**
@@ -169,7 +177,7 @@ public class TestHarness extends BaseTes
     updater.init(null);
   }
 
-  private static ConfigSolr getTestHarnessConfig(String coreName, String dataDir,
+  private static ConfigSolr getTestHarnessConfig(SolrResourceLoader loader, String coreName,
String dataDir,
                                                  String solrConfig, String schema) {
     String solrxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
         + "<solr persistent=\"false\">\n"
@@ -185,7 +193,7 @@ public class TestHarness extends BaseTes
         + "\" transient=\"false\" loadOnStartup=\"true\""
         + " shard=\"${shard:shard1}\" collection=\"${collection:collection1}\" instanceDir=\""
+ coreName + "/\" />\n"
         + "  </cores>\n" + "</solr>";
-    return ConfigSolr.fromString(solrxml);
+    return ConfigSolr.fromString(loader, solrxml);
   }
   
   public CoreContainer getCoreContainer() {



Mime
View raw message