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 2021/05/20 09:48:55 UTC

[GitHub] [solr] asalamon74 opened a new pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

asalamon74 opened a new pull request #135:
URL: https://github.com/apache/solr/pull/135


   <!--
   _(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
   
   You will need to create an account in Jira in order to create an issue.
   
   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
   
   Both FileSystemConfigSetService and ZkConfigSetService only checks the existence of the directory only in checkConfigExists.
   
   # Solution
   
   Create a new method to also check for solrconfig.xml checkConfigExistsWithSolrConfigXml
   
   # Tests
   
   # 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 `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.

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] asalamon74 commented on a change in pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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



##########
File path: solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java
##########
@@ -151,6 +151,19 @@ public boolean checkConfigExists(String configName) throws IOException {
     }
   }
 
+  @Override
+  public boolean checkConfigExistsWithSolrConfigXml(String configName) throws IOException {
+    try {
+      Boolean existsConfig = zkClient.exists(CONFIGS_ZKNODE + "/" + configName, true);
+      if (existsConfig == null || existsConfig.booleanValue() == false) return false;
+      Boolean existsSolrConfigXml = zkClient.exists(CONFIGS_ZKNODE + "/" + configName + "/solrconfig.xml", true);
+      return existsSolrConfigXml;

Review comment:
       Fxied




-- 
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@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] asalamon74 commented on a change in pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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



##########
File path: solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java
##########
@@ -1121,10 +1121,6 @@ public void testDeleteErrors() throws Exception {
     DeleteNoErrorChecking delete = new DeleteNoErrorChecking();
     verifyException(solrClient, delete, NAME);
 
-    // ConfigSet doesn't exist

Review comment:
       I removed the existence check from ConfigSetCmds.deleteConfigSet (as far as I understand, this was the suggestion here: https://issues.apache.org/jira/browse/SOLR-15421?focusedCommentId=17349401&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17349401 )
   
   After that this test fails because it expects a failure. So I changed the test. Removed this part, and add  a similar test to the end of testDelete.
   
   This means that this patch changes the behaviour of the delecteConfigSet commands. If this is bad, we can go back to the first version of this patch with two checkConfigExists methods.




-- 
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@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] dsmiley merged pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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


   


-- 
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@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] dsmiley commented on a change in pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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



##########
File path: solr/core/src/java/org/apache/solr/core/FileSystemConfigSetService.java
##########
@@ -62,7 +62,12 @@ public String configSetName(CoreDescriptor cd) {
   @Override
   public boolean checkConfigExists(String configName) throws IOException {
     Path configSetDirectory = configSetBase.resolve(configName);
-    return Files.isDirectory(configSetDirectory);
+    if (Files.isDirectory(configSetDirectory)) {

Review comment:
       Why the isDirectory check; why not just check for solrconfig.xml?

##########
File path: solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java
##########
@@ -151,6 +151,19 @@ public boolean checkConfigExists(String configName) throws IOException {
     }
   }
 
+  @Override
+  public boolean checkConfigExistsWithSolrConfigXml(String configName) throws IOException {
+    try {
+      Boolean existsConfig = zkClient.exists(CONFIGS_ZKNODE + "/" + configName, true);
+      if (existsConfig == null || existsConfig.booleanValue() == false) return false;
+      Boolean existsSolrConfigXml = zkClient.exists(CONFIGS_ZKNODE + "/" + configName + "/solrconfig.xml", true);
+      return existsSolrConfigXml;

Review comment:
       I'm missing something; why two calls to ZK just to check that a config exists?  If solrconfig.xml is now necessary, then why check the parent?




-- 
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@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] asalamon74 commented on pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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


   Thanks @dsmiley I added the CHANGES.txt entry and also changed the commit message to match it. Feel free to suggest a new text if necessary. 


-- 
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@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] dsmiley commented on a change in pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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



##########
File path: solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java
##########
@@ -1121,10 +1121,6 @@ public void testDeleteErrors() throws Exception {
     DeleteNoErrorChecking delete = new DeleteNoErrorChecking();
     verifyException(solrClient, delete, NAME);
 
-    // ConfigSet doesn't exist

Review comment:
       Why remove?




-- 
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@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] asalamon74 commented on a change in pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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



##########
File path: solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java
##########
@@ -151,6 +151,19 @@ public boolean checkConfigExists(String configName) throws IOException {
     }
   }
 
+  @Override
+  public boolean checkConfigExistsWithSolrConfigXml(String configName) throws IOException {
+    try {
+      Boolean existsConfig = zkClient.exists(CONFIGS_ZKNODE + "/" + configName, true);
+      if (existsConfig == null || existsConfig.booleanValue() == false) return false;
+      Boolean existsSolrConfigXml = zkClient.exists(CONFIGS_ZKNODE + "/" + configName + "/solrconfig.xml", true);
+      return existsSolrConfigXml;

Review comment:
       Good point, 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.

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] asalamon74 commented on a change in pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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



##########
File path: solr/core/src/java/org/apache/solr/core/FileSystemConfigSetService.java
##########
@@ -62,7 +62,12 @@ public String configSetName(CoreDescriptor cd) {
   @Override
   public boolean checkConfigExists(String configName) throws IOException {
     Path configSetDirectory = configSetBase.resolve(configName);
-    return Files.isDirectory(configSetDirectory);
+    if (Files.isDirectory(configSetDirectory)) {

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.

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 #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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



##########
File path: solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java
##########
@@ -151,6 +151,19 @@ public boolean checkConfigExists(String configName) throws IOException {
     }
   }
 
+  @Override
+  public boolean checkConfigExistsWithSolrConfigXml(String configName) throws IOException {
+    try {
+      Boolean existsConfig = zkClient.exists(CONFIGS_ZKNODE + "/" + configName, true);
+      if (existsConfig == null || existsConfig.booleanValue() == false) return false;
+      Boolean existsSolrConfigXml = zkClient.exists(CONFIGS_ZKNODE + "/" + configName + "/solrconfig.xml", true);
+      return existsSolrConfigXml;

Review comment:
       If there is a `existsConfig == null` check above, there should be one here as well, otherwise there will be a NPE.




-- 
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@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] dsmiley commented on a change in pull request #135: SOLR-15421 ConfigSetService.checkConfigExists accepts empty configs

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



##########
File path: solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java
##########
@@ -1121,10 +1121,6 @@ public void testDeleteErrors() throws Exception {
     DeleteNoErrorChecking delete = new DeleteNoErrorChecking();
     verifyException(solrClient, delete, NAME);
 
-    // ConfigSet doesn't exist

Review comment:
       Ah, right. 




-- 
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@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org