-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add KnnCircuitBreakerException and modify exception message #1688
Add KnnCircuitBreakerException and modify exception message #1688
Conversation
Signed-off-by: Ryan Bogan <[email protected]>
Signed-off-by: Ryan Bogan <[email protected]>
package org.opensearch.knn.index; | ||
|
||
public class KnnCircuitBreakerException extends RuntimeException { | ||
public KnnCircuitBreakerException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth removing the default constructor so the client of this class is forced to add a message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shatejas What do you think about adding a default message in the constructor instead of removing it entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as clients have enough information to understand what went wrong the default message works.
The intent is not to throw without a proper message considering its a custom exception and might be hard for someone to figure out what went wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After trying to implement the default, it doesn't work because it's extending RuntimeException which needs the super to be called first. I'll just remove the default constructor per your original recommendation.
Rolling upgrade failures are happening on other PR's too and are not related to this change. Created an issue here: #1691 |
Signed-off-by: Ryan Bogan <[email protected]>
src/main/java/org/opensearch/knn/index/KnnCircuitBreakerException.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Ryan Bogan <[email protected]>
Signed-off-by: Ryan Bogan <[email protected]>
* Add KnnCircuitBreakerException and modify exception message Signed-off-by: Ryan Bogan <[email protected]> * Add changelog entry and remove star import Signed-off-by: Ryan Bogan <[email protected]> * Remove default exception constructor Signed-off-by: Ryan Bogan <[email protected]> * Add class description and change parameter Signed-off-by: Ryan Bogan <[email protected]> * Fix javadocs Signed-off-by: Ryan Bogan <[email protected]> --------- Signed-off-by: Ryan Bogan <[email protected]> (cherry picked from commit c315862)
…1697) * Add KnnCircuitBreakerException and modify exception message Signed-off-by: Ryan Bogan <[email protected]> * Add changelog entry and remove star import Signed-off-by: Ryan Bogan <[email protected]> * Remove default exception constructor Signed-off-by: Ryan Bogan <[email protected]> * Add class description and change parameter Signed-off-by: Ryan Bogan <[email protected]> * Fix javadocs Signed-off-by: Ryan Bogan <[email protected]> --------- Signed-off-by: Ryan Bogan <[email protected]> (cherry picked from commit c315862) Co-authored-by: Ryan Bogan <[email protected]>
…ch-project#1688) * Add KnnCircuitBreakerException and modify exception message Signed-off-by: Ryan Bogan <[email protected]> * Add changelog entry and remove star import Signed-off-by: Ryan Bogan <[email protected]> * Remove default exception constructor Signed-off-by: Ryan Bogan <[email protected]> * Add class description and change parameter Signed-off-by: Ryan Bogan <[email protected]> * Fix javadocs Signed-off-by: Ryan Bogan <[email protected]> --------- Signed-off-by: Ryan Bogan <[email protected]>
…ch-project#1688) * Add KnnCircuitBreakerException and modify exception message Signed-off-by: Ryan Bogan <[email protected]> * Add changelog entry and remove star import Signed-off-by: Ryan Bogan <[email protected]> * Remove default exception constructor Signed-off-by: Ryan Bogan <[email protected]> * Add class description and change parameter Signed-off-by: Ryan Bogan <[email protected]> * Fix javadocs Signed-off-by: Ryan Bogan <[email protected]> --------- Signed-off-by: Ryan Bogan <[email protected]>
Description
Currently, when the circuit breaker is triggered and the user attempts to bulk index documents, an illegal state exception is thrown with a message that is not entirely accurate. This PR introduces a new type of exception,
KnnCircuitBreakerException
, to be thrown for any action that fails because the circuit breaker is triggered. In addition, it changes the exception message described above to clarify where exactly the exception is being thrown in the indexing process and provide more information about the circuit breaker.Issues Resolved
#1424
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.