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-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 Other Changes
---------------------- ----------------------
* SOLR-14656: Autoscaling framework removed (Ishan Chattopadhyaya, noble, Ilan Ginzburg) * 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"; String systemInfoUrl = solrUrl+"admin/info/system";
CloseableHttpClient httpClient = getHttpClient(); CloseableHttpClient httpClient = getHttpClient();
String solrHome = null; String coreRootDirectory = null; //usually same as solr home, but not always
try { try {
Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2, true); Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2, true);
if ("solrcloud".equals(systemInfo.get("mode"))) { if ("solrcloud".equals(systemInfo.get("mode"))) {
@ -1675,9 +1675,11 @@ public class SolrCLI implements CLIO {
} }
// convert raw JSON into user-friendly output // convert raw JSON into user-friendly output
solrHome = (String)systemInfo.get("solr_home"); coreRootDirectory = (String)systemInfo.get("core_root");
if (solrHome == null)
solrHome = configsetsDir.getParentFile().getAbsolutePath(); //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 { } finally {
closeHttpClient(httpClient); closeHttpClient(httpClient);
@ -1689,7 +1691,7 @@ public class SolrCLI implements CLIO {
"' already exists!\nChecked core existence using Core API command:\n"+coreStatusUrl); "' 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"); File confDir = new File(configSetDir,"conf");
if (!coreInstanceDir.isDirectory()) { if (!coreInstanceDir.isDirectory()) {
coreInstanceDir.mkdirs(); coreInstanceDir.mkdirs();