You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/01/24 00:28:58 UTC

[GitHub] [solr] janhoy opened a new pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

janhoy opened a new pull request #558:
URL: https://github.com/apache/solr/pull/558


   https://issues.apache.org/jira/browse/SOLR-9575
   
   In 8.x this would fail, as you'd  have to pre-initialize your new solr-home with both `solr.xml` and `zoo.cfg`:
   ```bash
   export SOLR_HOME=/tmp/solrhome && mkdir /tmp/solrhome && bin/solr start -c
   ```
   
   This PR will make Solr accept an empty dir, falling back to the defaults of both files as found in `$SOLR_TIP/server/solr/`. Nothing will be copied into the empty dir, we'll simply pull defaults from the install-dir. If user wants to customize they can place the files in `SOLR_HOME` and they will be used as before. To test, check out the PR branch, then:
   
   ```bash
   export SOLR_HOME=/tmp/solrhome
   mkdir /tmp/solrhome
   bin/solr start -c
   grep -E "built-in default|solr.xml|zoo.cfg" server/logs/solr.log 
   # [...] SolrXmlConfig Container configuration not found in solr solrhome, using built-in default
   # [...] SolrXmlConfig Loading container configuration from [...]server/solr/solr.xml
   # [...] SolrZkServer Zookeeper configuration not found in /tmp/solrhome, using built-in default
   # [...] SolrZkServerProps Reading configuration from: [...]server/solr/zoo.cfg
   bin/solr stop
   ```
   
   Then try out the back-compat override var:
   
   ```bash
   SOLR_SOLRXML_REQUIRED=true bin/solr start -f 
   ```


-- 
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] HoustonPutman commented on a change in pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
HoustonPutman commented on a change in pull request #558:
URL: https://github.com/apache/solr/pull/558#discussion_r793762567



##########
File path: solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
##########
@@ -161,14 +162,21 @@ public static NodeConfig fromConfig(Path solrHome, XmlConfigFile config, boolean
   }
 
   public static NodeConfig fromFile(Path solrHome, Path configFile, Properties substituteProps) {
-
-    log.info("Loading container configuration from {}", configFile);
-
     if (!Files.exists(configFile)) {
-      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
-          "solr.xml does not exist in " + configFile.getParent() + " cannot start Solr");
+      if (Boolean.getBoolean("solr.solrxml.required")) {
+        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+            "solr.xml does not exist in " + configFile.getParent() + " cannot start Solr");
+      }
+      log.info("Container configuration not found in SOLR_HOME, using built-in default");

Review comment:
       Maybe use `solr.xml` instead of `Container configuration`?

##########
File path: solr/bin/solr
##########
@@ -2069,8 +2069,11 @@ if [ "$SOLR_MODE" == 'solrcloud' ]; then
     CLOUD_MODE_OPTS+=('-Dbootstrap_confdir=./solr/collection1/conf' '-Dcollection.configName=myconf' '-DnumShards=1')
   fi
 
+  if [ -n "$SOLR_SOLRXML_REQUIRED" ]; then

Review comment:
       Shouldn't this and the one be `== true`, like in the `.cmd` version?




-- 
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] janhoy commented on a change in pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy commented on a change in pull request #558:
URL: https://github.com/apache/solr/pull/558#discussion_r794299684



##########
File path: solr/bin/solr
##########
@@ -2069,8 +2069,11 @@ if [ "$SOLR_MODE" == 'solrcloud' ]; then
     CLOUD_MODE_OPTS+=('-Dbootstrap_confdir=./solr/collection1/conf' '-Dcollection.configName=myconf' '-DnumShards=1')
   fi
 
+  if [ -n "$SOLR_SOLRXML_REQUIRED" ]; then

Review comment:
       Fixed




-- 
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] HoustonPutman commented on a change in pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
HoustonPutman commented on a change in pull request #558:
URL: https://github.com/apache/solr/pull/558#discussion_r793775709



##########
File path: solr/bin/solr
##########
@@ -2069,8 +2069,11 @@ if [ "$SOLR_MODE" == 'solrcloud' ]; then
     CLOUD_MODE_OPTS+=('-Dbootstrap_confdir=./solr/collection1/conf' '-Dcollection.configName=myconf' '-DnumShards=1')
   fi
 
+  if [ -n "$SOLR_SOLRXML_REQUIRED" ]; then

Review comment:
       Same note for a few lines down as well




-- 
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] janhoy commented on a change in pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy commented on a change in pull request #558:
URL: https://github.com/apache/solr/pull/558#discussion_r794302250



##########
File path: solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
##########
@@ -161,14 +162,21 @@ public static NodeConfig fromConfig(Path solrHome, XmlConfigFile config, boolean
   }
 
   public static NodeConfig fromFile(Path solrHome, Path configFile, Properties substituteProps) {
-
-    log.info("Loading container configuration from {}", configFile);
-
     if (!Files.exists(configFile)) {
-      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
-          "solr.xml does not exist in " + configFile.getParent() + " cannot start Solr");
+      if (Boolean.getBoolean("solr.solrxml.required")) {
+        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+            "solr.xml does not exist in " + configFile.getParent() + " cannot start Solr");
+      }
+      log.info("Container configuration not found in SOLR_HOME, using built-in default");

Review comment:
       Agree, container is something different these days :)




-- 
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] janhoy commented on pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy commented on pull request #558:
URL: https://github.com/apache/solr/pull/558#issuecomment-1022734729


   @HoustonPutman I added you as reviewer as you may have some input from the solr-operator and docker perspective.
   
   In particular, do you see any side effects of this? We should perhaps add an explicit upgrade note for people to *remove* solr.xml and zoo.cfg from their /var/solr/data if they have not customized it on purpose, to let future version upgrades utilize new defaults?


-- 
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] janhoy commented on pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy commented on pull request #558:
URL: https://github.com/apache/solr/pull/558#issuecomment-1024004901


   > The only way I can think is to add a flag (e.g. `solr9Compatible`) that lets us know that we can use this new functionality, because we don't parse image tags to determine a Solr version.
   
   Yea, or perhaps a new solr-operator 0.6 could default ot solr9, and instead have a `preSolr9Compatible` config? Or simply start parsing image tag to guess at least the major version? I have a feeling we'll need similar compat breaks for 10.0 as well.


-- 
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] janhoy commented on pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy commented on pull request #558:
URL: https://github.com/apache/solr/pull/558#issuecomment-1022731283


   If no further comments I'll merge this soon.


-- 
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] janhoy commented on a change in pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy commented on a change in pull request #558:
URL: https://github.com/apache/solr/pull/558#discussion_r795065866



##########
File path: solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java
##########
@@ -168,34 +178,29 @@ public void stop() {
 // zoo.cfg (which validates that there is a dataDir)
 class SolrZkServerProps extends QuorumPeerConfig {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  private static final Pattern MISSING_MYID_FILE_PATTERN = Pattern.compile(".*myid file is missing$");
 
   String solrPort; // port that Solr is listening on
   String zkRun;
 
   /**
    * Parse a ZooKeeper configuration file
-   * @param path the patch of the configuration file
+   * @param configPath the patch of the configuration file

Review comment:
       ```suggestion
      * @param configPath the path of the configuration file
   ```




-- 
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] janhoy merged pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy merged pull request #558:
URL: https://github.com/apache/solr/pull/558


   


-- 
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] janhoy commented on pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy commented on pull request #558:
URL: https://github.com/apache/solr/pull/558#issuecomment-1022722443


   > +1 thanks! Furthermore, shouldn't init_var_solr no longer copy these two files?
   
   Already part of the PR: https://github.com/apache/solr/pull/558/files#diff-7e421bf40f7145b7dcb8933fc47be763b4da343e549b7886d134d56a802bbbbdL59


-- 
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] janhoy commented on a change in pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy commented on a change in pull request #558:
URL: https://github.com/apache/solr/pull/558#discussion_r794307508



##########
File path: solr/solr-ref-guide/src/configuring-solr-xml.adoc
##########
@@ -543,7 +553,6 @@ If only `dividend` routing is desired, `hash` may be explicitly set to the empty
 The `<metrics>` element in `solr.xml` allows you to customize the metrics reported by Solr.
 You can define system properties that should not be returned, or define custom suppliers and reporters.
 
-In a default `solr.xml` you will not see any `<metrics>` configuration.

Review comment:
       I removed this line from docs, as obviously there is now a `<metrics>` tag in our default 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] janhoy edited a comment on pull request #558: SOLR-9575 Allow starting with an empty SOLR_HOME

Posted by GitBox <gi...@apache.org>.
janhoy edited a comment on pull request #558:
URL: https://github.com/apache/solr/pull/558#issuecomment-1024004901


   > The only way I can think is to add a flag (e.g. `solr9Compatible`) that lets us know that we can use this new functionality, because we don't parse image tags to determine a Solr version.
   
   Yea, or perhaps a new solr-operator 0.6 could default ot solr9, and instead have a `preSolr9Compatible` config? Or simply start parsing image tag to guess at least the major version? I have a feeling we'll need similar compat breaks for 10.0 as well. And then in 0.7 require minimum solr9, i.e. ask users who require older Solr to use an older solr-operator.


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