You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/09/20 01:08:01 UTC

[GitHub] [lucene-solr] arafalov opened a new pull request #1894: SOLR-14878: Expose solr.xml's coreRootDirectory property via the System Settings API

arafalov opened a new pull request #1894:
URL: https://github.com/apache/lucene-solr/pull/1894


   # Description
   
   Even if coreRootDirectory was set in solr.xml, external applications could not access it through the API. It was not exposed. This means it is not possible to run a command such as *bin/solr create_core -c test* as the code that pre-populates the core directory is doing it in the wrong place (if at all).
   
   # Solution
   Expose the property if it is defined and is different from solr_home
   
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [X] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [X] I have created a Jira issue and added the issue ID to my pull request title.
   - [X] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [X] I have developed this patch against the `master` branch.
   - [X] I have run `./gradlew check`.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] arafalov merged pull request #1894: SOLR-14878: Expose solr.xml's coreRootDirectory property via the System Settings API

Posted by GitBox <gi...@apache.org>.
arafalov merged pull request #1894:
URL: https://github.com/apache/lucene-solr/pull/1894


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] arafalov commented on a change in pull request #1894: SOLR-14878: Expose solr.xml's coreRootDirectory property via the System Settings API

Posted by GitBox <gi...@apache.org>.
arafalov commented on a change in pull request #1894:
URL: https://github.com/apache/lucene-solr/pull/1894#discussion_r492270332



##########
File path: solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
##########
@@ -139,8 +140,19 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
-    if (cc != null)
-      rsp.add( "solr_home", cc.getSolrHome());
+    if (cc != null) {
+      String solrHome = cc.getSolrHome();
+      rsp.add("solr_home", solrHome);
+
+      Path coreRootDirectory = cc.getCoreRootDirectory();
+      if (coreRootDirectory != null) {
+        String coreRootDirectoryString = coreRootDirectory.toString();
+        if (!coreRootDirectoryString.equals(solrHome)) {

Review comment:
       Ok, I was on borderline myself. I felt that because this option is barely used, having the same long string sent twice was bit of a waste of bandwidth. But, I guess it does not happen too often.
   
   I can correct both generation and invocation of this option to make it a guaranteed setup. Let's just hope they don't run version 9 tool against version 8 core.
   
   Also, if you don't like the name (the other open point), this is a good time to mention it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] dsmiley commented on a change in pull request #1894: SOLR-14878: Expose solr.xml's coreRootDirectory property via the System Settings API

Posted by GitBox <gi...@apache.org>.
dsmiley commented on a change in pull request #1894:
URL: https://github.com/apache/lucene-solr/pull/1894#discussion_r492274546



##########
File path: solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
##########
@@ -139,8 +140,19 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
-    if (cc != null)
-      rsp.add( "solr_home", cc.getSolrHome());
+    if (cc != null) {
+      String solrHome = cc.getSolrHome();
+      rsp.add("solr_home", solrHome);
+
+      Path coreRootDirectory = cc.getCoreRootDirectory();
+      if (coreRootDirectory != null) {
+        String coreRootDirectoryString = coreRootDirectory.toString();
+        if (!coreRootDirectoryString.equals(solrHome)) {

Review comment:
       The "solr_" part should be skipped IMO.  Everything here is Solr :-)
   
   > Let's just hope they don't run version 9 tool against version 8 core.
   
   Well it's up to them to have a tolerant client.  For the SolrCLI I think it makes sense to check for null in case of a cross-version situation.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] arafalov commented on a change in pull request #1894: SOLR-14878: Expose solr.xml's coreRootDirectory property via the System Settings API

Posted by GitBox <gi...@apache.org>.
arafalov commented on a change in pull request #1894:
URL: https://github.com/apache/lucene-solr/pull/1894#discussion_r492270332



##########
File path: solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
##########
@@ -139,8 +140,19 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
-    if (cc != null)
-      rsp.add( "solr_home", cc.getSolrHome());
+    if (cc != null) {
+      String solrHome = cc.getSolrHome();
+      rsp.add("solr_home", solrHome);
+
+      Path coreRootDirectory = cc.getCoreRootDirectory();
+      if (coreRootDirectory != null) {
+        String coreRootDirectoryString = coreRootDirectory.toString();
+        if (!coreRootDirectoryString.equals(solrHome)) {

Review comment:
       Ok, I was on borderline myself. I felt that because this option is barely used, having the same long string sent twice was bit of a waste of bandwidth. But, I guess it does not happen too often.
   
   I can correct both generation and invocation of this option to make it a guaranteed setup. Let's just hope they don't run version 9 tool against version 8 core.
   
   Also, if you don't like the name (the other open point), this is a good time to mention it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] dsmiley commented on a change in pull request #1894: SOLR-14878: Expose solr.xml's coreRootDirectory property via the System Settings API

Posted by GitBox <gi...@apache.org>.
dsmiley commented on a change in pull request #1894:
URL: https://github.com/apache/lucene-solr/pull/1894#discussion_r492252261



##########
File path: solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
##########
@@ -139,8 +140,19 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
-    if (cc != null)
-      rsp.add( "solr_home", cc.getSolrHome());
+    if (cc != null) {
+      String solrHome = cc.getSolrHome();
+      rsp.add("solr_home", solrHome);
+
+      Path coreRootDirectory = cc.getCoreRootDirectory();
+      if (coreRootDirectory != null) {
+        String coreRootDirectoryString = coreRootDirectory.toString();
+        if (!coreRootDirectoryString.equals(solrHome)) {

Review comment:
       I disagree with this condition.  I think this should always emitted no matter where it is.  It's more helpful on consumers to depend on its existence rather than having it vary in some cases but not others.

##########
File path: solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
##########
@@ -139,8 +140,19 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
-    if (cc != null)
-      rsp.add( "solr_home", cc.getSolrHome());
+    if (cc != null) {
+      String solrHome = cc.getSolrHome();
+      rsp.add("solr_home", solrHome);
+
+      Path coreRootDirectory = cc.getCoreRootDirectory();
+      if (coreRootDirectory != null) {

Review comment:
       coreRootDirectory is always non-null.  I don't like null checks that are unnecessary; it may feel "safe" but slightly obscures code clarity and suggests possibilities that are impossibilities.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] dsmiley commented on a change in pull request #1894: SOLR-14878: Expose solr.xml's coreRootDirectory property via the System Settings API

Posted by GitBox <gi...@apache.org>.
dsmiley commented on a change in pull request #1894:
URL: https://github.com/apache/lucene-solr/pull/1894#discussion_r492252261



##########
File path: solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
##########
@@ -139,8 +140,19 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
-    if (cc != null)
-      rsp.add( "solr_home", cc.getSolrHome());
+    if (cc != null) {
+      String solrHome = cc.getSolrHome();
+      rsp.add("solr_home", solrHome);
+
+      Path coreRootDirectory = cc.getCoreRootDirectory();
+      if (coreRootDirectory != null) {
+        String coreRootDirectoryString = coreRootDirectory.toString();
+        if (!coreRootDirectoryString.equals(solrHome)) {

Review comment:
       I disagree with this condition.  I think this should always emitted no matter where it is.  It's more helpful on consumers to depend on its existence rather than having it vary in some cases but not others.

##########
File path: solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
##########
@@ -139,8 +140,19 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
-    if (cc != null)
-      rsp.add( "solr_home", cc.getSolrHome());
+    if (cc != null) {
+      String solrHome = cc.getSolrHome();
+      rsp.add("solr_home", solrHome);
+
+      Path coreRootDirectory = cc.getCoreRootDirectory();
+      if (coreRootDirectory != null) {

Review comment:
       coreRootDirectory is always non-null.  I don't like null checks that are unnecessary; it may feel "safe" but slightly obscures code clarity and suggests possibilities that are impossibilities.

##########
File path: solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
##########
@@ -139,8 +140,19 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
-    if (cc != null)
-      rsp.add( "solr_home", cc.getSolrHome());
+    if (cc != null) {
+      String solrHome = cc.getSolrHome();
+      rsp.add("solr_home", solrHome);
+
+      Path coreRootDirectory = cc.getCoreRootDirectory();
+      if (coreRootDirectory != null) {
+        String coreRootDirectoryString = coreRootDirectory.toString();
+        if (!coreRootDirectoryString.equals(solrHome)) {

Review comment:
       The "solr_" part should be skipped IMO.  Everything here is Solr :-)
   
   > Let's just hope they don't run version 9 tool against version 8 core.
   
   Well it's up to them to have a tolerant client.  For the SolrCLI I think it makes sense to check for null in case of a cross-version situation.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org