You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "pvcnt (via GitHub)" <gi...@apache.org> on 2023/09/04 13:21:52 UTC

[GitHub] [solr] pvcnt opened a new pull request, #1891: SOLR-16959: Make CoresContainer class configurable

pvcnt opened a new pull request, #1891:
URL: https://github.com/apache/solr/pull/1891

   https://issues.apache.org/jira/browse/SOLR-16959
   
   <!--
   _(If you are a project committer then you may remove some/all of the following template.)_
   
   Before creating a pull request, please file an issue in the ASF Jira system for Solr:
   
   * https://issues.apache.org/jira/projects/SOLR
   
   For something minor (i.e. that wouldn't be worth putting in release notes), you can skip JIRA. 
   To create a Jira issue, you will need to create an account there first.
   
   The title of the PR should reference the Jira issue number in the form:
   
   * SOLR-####: <short description of problem or changes>
   
   SOLR must be fully capitalized. A short description helps people scanning pull requests for items they can work on.
   
   Properly referencing the issue in the title ensures that Jira is correctly updated with code review comments and commits. -->
   
   
   # Description
   
   Please provide a short description of the changes you're making with this pull request.
   
   # Solution
   
   Please provide a short description of the approach taken to implement your solution.
   
   # Tests
   
   Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [ ] 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.
   - [ ] I have created a Jira issue and added the issue ID to my pull request title.
   - [ ] 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)
   - [ ] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

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


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


[GitHub] [solr] dsmiley commented on pull request #1891: SOLR-16959: Make CoresLocator class configurable

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on PR #1891:
URL: https://github.com/apache/solr/pull/1891#issuecomment-1724787866

   Can you please add a CHANGES.txt note in the 9.4 section, probably in the "Improvements" section?  A brief sentence would do like "Make the internal CoresLocator implementation configurable in solr.xml"


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

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


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


[GitHub] [solr] murblanc commented on a diff in pull request #1891: SOLR-16959: Make CoresContainer class configurable

Posted by "murblanc (via GitHub)" <gi...@apache.org>.
murblanc commented on code in PR #1891:
URL: https://github.com/apache/solr/pull/1891#discussion_r1314992428


##########
solr/core/src/java/org/apache/solr/core/CoresLocator.java:
##########
@@ -72,4 +73,26 @@ public interface CoresLocator {
    * @return a list of all CoreDescriptors found
    */
   public List<CoreDescriptor> discover(CoreContainer cc);
+
+  /**
+   * Returns a new instance of {@link CoresLocator}, depending on provided config.
+   *
+   * @param nodeConfig Solr configuration.
+   */
+  static CoresLocator instantiate(NodeConfig nodeConfig) {
+    final String coresLocatorClass = nodeConfig.getCoresLocatorClass();
+    if (coresLocatorClass != null) {
+      try {
+        Class<? extends CoresLocator> clazz =
+            nodeConfig.getSolrResourceLoader().findClass(coresLocatorClass, CoresLocator.class);
+        Constructor<? extends CoresLocator> constructor = clazz.getConstructor(NodeConfig.class);
+        return constructor.newInstance(nodeConfig);
+      } catch (Exception e) {
+        throw new RuntimeException(
+            "create CoresLocator instance failed, coresLocatorClass=" + coresLocatorClass, e);
+      }
+    } else {
+      return new CorePropertiesLocator(nodeConfig.getCoreRootDirectory());

Review Comment:
   Maybe add a constructor taking single param `NodeConfig nodeConfig` to `CorePropertiesLocator` so that it can be configured and instantiated like other `CoresLocator` implementations?



##########
solr/core/src/java/org/apache/solr/core/NodeConfig.java:
##########
@@ -154,6 +155,7 @@ private NodeConfig(
       Set<Path> allowPaths,
       List<String> allowUrls,
       String configSetServiceClass,
+      String coresLocatorClass,

Review Comment:
   Minor/personal taste: I'd add this closer to existing `coreRootDirectory` given the two relate to `CoreLocator` implementation configuration.
   
   And I wish(ed) the order of attribute processing in `SolrXmlConfig` was the same as the order here, but it doesn't seem to be the case.



##########
solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc:
##########
@@ -99,6 +99,18 @@ For example, `<str name="configSetService">com.myorg.CustomConfigSetService</str
 +
 If this attribute isn't set, Solr uses the default `configSetService`, with zookeeper aware of `org.apache.solr.cloud.ZkConfigSetService`, without zookeeper aware of `org.apache.solr.core.FileSystemConfigSetService`.
 
+`coresLocator`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `org.apache.solr.core.CoresPropertiesLocator`
+|===
++
+This attribute does not need to be set.
++
+If used, this attribute should be set to the FQN (Fully qualified name) of a class that inherits from `CoresLocator`, and you must provide a constructor with one parameter which the type is `org.apache.solr.core.NodeConfig`.

Review Comment:
   I'd say "implements" rather than "inherits from" given `CoresLocator` is an interface.
   
   Also wording "and you must provide a constructor with one parameter which the type is `org.apache.solr.core.NodeConfig`" --> " and that provides a constructor with one parameter of type `org.apache.solr.core.NodeConfig`"



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

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


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


[GitHub] [solr] dsmiley merged pull request #1891: SOLR-16959: Make CoresLocator class configurable

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley merged PR #1891:
URL: https://github.com/apache/solr/pull/1891


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

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


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


[GitHub] [solr] pvcnt commented on a diff in pull request #1891: SOLR-16959: Make CoresContainer class configurable

Posted by "pvcnt (via GitHub)" <gi...@apache.org>.
pvcnt commented on code in PR #1891:
URL: https://github.com/apache/solr/pull/1891#discussion_r1315064356


##########
solr/core/src/java/org/apache/solr/core/NodeConfig.java:
##########
@@ -154,6 +155,7 @@ private NodeConfig(
       Set<Path> allowPaths,
       List<String> allowUrls,
       String configSetServiceClass,
+      String coresLocatorClass,

Review Comment:
   Agreed, fixed.



##########
solr/core/src/java/org/apache/solr/core/CoresLocator.java:
##########
@@ -72,4 +73,26 @@ public interface CoresLocator {
    * @return a list of all CoreDescriptors found
    */
   public List<CoreDescriptor> discover(CoreContainer cc);
+
+  /**
+   * Returns a new instance of {@link CoresLocator}, depending on provided config.
+   *
+   * @param nodeConfig Solr configuration.
+   */
+  static CoresLocator instantiate(NodeConfig nodeConfig) {
+    final String coresLocatorClass = nodeConfig.getCoresLocatorClass();
+    if (coresLocatorClass != null) {
+      try {
+        Class<? extends CoresLocator> clazz =
+            nodeConfig.getSolrResourceLoader().findClass(coresLocatorClass, CoresLocator.class);
+        Constructor<? extends CoresLocator> constructor = clazz.getConstructor(NodeConfig.class);
+        return constructor.newInstance(nodeConfig);
+      } catch (Exception e) {
+        throw new RuntimeException(
+            "create CoresLocator instance failed, coresLocatorClass=" + coresLocatorClass, e);
+      }
+    } else {
+      return new CorePropertiesLocator(nodeConfig.getCoreRootDirectory());

Review Comment:
   Fixed.



##########
solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc:
##########
@@ -99,6 +99,18 @@ For example, `<str name="configSetService">com.myorg.CustomConfigSetService</str
 +
 If this attribute isn't set, Solr uses the default `configSetService`, with zookeeper aware of `org.apache.solr.cloud.ZkConfigSetService`, without zookeeper aware of `org.apache.solr.core.FileSystemConfigSetService`.
 
+`coresLocator`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `org.apache.solr.core.CoresPropertiesLocator`
+|===
++
+This attribute does not need to be set.
++
+If used, this attribute should be set to the FQN (Fully qualified name) of a class that inherits from `CoresLocator`, and you must provide a constructor with one parameter which the type is `org.apache.solr.core.NodeConfig`.

Review Comment:
   Fixed. And fixed the same typo in another section (I copy/pasted from...).



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

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


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


[GitHub] [solr] pvcnt commented on pull request #1891: SOLR-16959: Make CoresLocator class configurable

Posted by "pvcnt (via GitHub)" <gi...@apache.org>.
pvcnt commented on PR #1891:
URL: https://github.com/apache/solr/pull/1891#issuecomment-1724927378

   @dsmiley That's done.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

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


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