You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "aparnasuresh85 (via GitHub)" <gi...@apache.org> on 2023/12/06 22:06:31 UTC

[PR] SOLR-17053: Address ClassCastException issue [solr]

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

   https://issues.apache.org/jira/browse/SOLR-17053
   
   <!--
   _(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:17053: If all shards fail, fail the request despite shards.tolerant
   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.
   Address a ClassCastException issue in the event exception in shard response is not of type org.apache.solr.common.SolrException
   
   
   # Solution
   
   Please provide a short description of the approach taken to implement your solution.
   Wrap the exception in shard response into org.apache.solr.common.SolrException and throw the same
   
   
   # Tests
   
   Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
   Tests checked in as part of previous PR here: https://github.com/apache/solr/pull/2102. Did not introduce additional testing with this PR as it is a minor change
   # 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.
   - [x] 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


Re: [PR] SOLR-17053: Address ClassCastException issue [solr]

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


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


Re: [PR] SOLR-17053: Address ClassCastException issue [solr]

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


##########
solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java:
##########
@@ -598,7 +598,7 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
                 boolean allShardsFailed = includesTopIdsPurpose && allResponsesHaveExceptions;
                 // if all shards fail, fail the request despite shards.tolerant
                 if (allShardsFailed) {
-                  throw (SolrException) srsp.getException();
+                  throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, srsp.getException());

Review Comment:
   Can the exception be anything other than a server error? Should we do something like [here](https://github.com/apache/solr/pull/2123/files#diff-d6fc591739d3396fb74758c164b4631785e059923eb370c9867771ccdf639675R583-R588)



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


Re: [PR] SOLR-17053: Address ClassCastException issue [solr]

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


##########
solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java:
##########
@@ -598,7 +598,7 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
                 boolean allShardsFailed = includesTopIdsPurpose && allResponsesHaveExceptions;
                 // if all shards fail, fail the request despite shards.tolerant
                 if (allShardsFailed) {
-                  throw (SolrException) srsp.getException();
+                  throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, srsp.getException());

Review Comment:
   I agree completely @tflobbe ; this is what I mentioned internally :-).  Perhaps create a little utility method here for this pattern used twice.



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


Re: [PR] SOLR-17053: Address ClassCastException issue [solr]

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


##########
solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java:
##########
@@ -663,6 +659,15 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     }
   }
 
+  public static void throwSolrException(Throwable  shardResponseException) throws SolrException {

Review Comment:
   Missed on reviewing the change myself. Updated to private.



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


Re: [PR] SOLR-17053: Address ClassCastException issue [solr]

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


##########
solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java:
##########
@@ -598,7 +598,7 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
                 boolean allShardsFailed = includesTopIdsPurpose && allResponsesHaveExceptions;
                 // if all shards fail, fail the request despite shards.tolerant
                 if (allShardsFailed) {
-                  throw (SolrException) srsp.getException();
+                  throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, srsp.getException());

Review Comment:
   I have addressed this in my recent commit



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


Re: [PR] SOLR-17053: Address ClassCastException issue [solr]

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


##########
solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java:
##########
@@ -663,6 +659,15 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
     }
   }
 
+  public static void throwSolrException(Throwable  shardResponseException) throws SolrException {

Review Comment:
   Any reason to make this `public`?



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