SOLR-14880: Support coreRootDirectory setting when create new cores from command line, in standalone mode

Update to match latest code with shorter name
This commit is contained in:
Alexandre Rafalovitch 2020-09-22 09:02:14 -04:00 committed by GitHub
parent d898edaf93
commit 1611586417
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -50,6 +50,8 @@ Improvements
* SOLR-14878: Report solr.xml's coreRootDirectory property via System Settings API, when set (Alexandre Rafalovitch)
* SOLR-14880: Support coreRootDirectory setting when create new cores from command line, in standalone mode (Alexandre Rafalovitch)
Other Changes
----------------------
* SOLR-14656: Autoscaling framework removed (Ishan Chattopadhyaya, noble, Ilan Ginzburg)

View File

@ -1666,7 +1666,7 @@ public class SolrCLI implements CLIO {
String systemInfoUrl = solrUrl+"admin/info/system";
CloseableHttpClient httpClient = getHttpClient();
String solrHome = null;
String coreRootDirectory = null; //usually same as solr home, but not always
try {
Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2, true);
if ("solrcloud".equals(systemInfo.get("mode"))) {
@ -1675,9 +1675,11 @@ public class SolrCLI implements CLIO {
}
// convert raw JSON into user-friendly output
solrHome = (String)systemInfo.get("solr_home");
if (solrHome == null)
solrHome = configsetsDir.getParentFile().getAbsolutePath();
coreRootDirectory = (String)systemInfo.get("core_root");
//Fall back to solr_home, in case we are running against older server that does not return the property
if (coreRootDirectory == null) coreRootDirectory = (String)systemInfo.get("solr_home");
if (coreRootDirectory == null) coreRootDirectory = configsetsDir.getParentFile().getAbsolutePath();
} finally {
closeHttpClient(httpClient);
@ -1689,7 +1691,7 @@ public class SolrCLI implements CLIO {
"' already exists!\nChecked core existence using Core API command:\n"+coreStatusUrl);
}
File coreInstanceDir = new File(solrHome, coreName);
File coreInstanceDir = new File(coreRootDirectory, coreName);
File confDir = new File(configSetDir,"conf");
if (!coreInstanceDir.isDirectory()) {
coreInstanceDir.mkdirs();