Skip to content
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

Merged
merged 5 commits into from
May 13, 2024

Conversation

ryanbogan
Copy link
Member

@ryanbogan ryanbogan commented May 3, 2024

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

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed as per the DCO using --signoff

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.

package org.opensearch.knn.index;

public class KnnCircuitBreakerException extends RuntimeException {
public KnnCircuitBreakerException() {
Copy link
Collaborator

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

Copy link
Member Author

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?

Copy link
Collaborator

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

Copy link
Member Author

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.

@ryanbogan
Copy link
Member Author

Rolling upgrade failures are happening on other PR's too and are not related to this change. Created an issue here: #1691

@ryanbogan ryanbogan requested a review from martin-gaievski May 8, 2024 17:10
Signed-off-by: Ryan Bogan <[email protected]>
@ryanbogan ryanbogan merged commit c315862 into opensearch-project:main May 13, 2024
48 of 50 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 13, 2024
* 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)
ryanbogan added a commit that referenced this pull request May 13, 2024
…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]>
luyuncheng pushed a commit to luyuncheng/k-NN-1 that referenced this pull request May 22, 2024
…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]>
luyuncheng pushed a commit to luyuncheng/k-NN-1 that referenced this pull request May 22, 2024
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants