Update Rest status for DecommissioningFailedException#5283
Update Rest status for DecommissioningFailedException#5283dblock merged 11 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5283 +/- ##
============================================
+ Coverage 70.91% 71.11% +0.20%
- Complexity 58075 58203 +128
============================================
Files 4711 4711
Lines 277534 277535 +1
Branches 40169 40169
============================================
+ Hits 196802 197374 +572
+ Misses 64582 64046 -536
+ Partials 16150 16115 -35 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Did we ship the decommission feature (is this an API change)? Otherwise we can put a skip-changelog on it. |
dblock
left a comment
There was a problem hiding this comment.
Checking for .status(), especially by casting the exception, doesn't actually check that the end user is getting a 400. It's pretty obvious that DecommissioningFailedException will always have a status of BAD_REQUEST. I think you should write an actual REST test that makes an API call and gets a 400.
|
|
||
| @Override | ||
| public RestStatus status() { | ||
| return RestStatus.BAD_REQUEST; |
There was a problem hiding this comment.
Here https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/cluster/decommission/DecommissionService.java#L271 it seems its not a bad request due to which the exception is thrown. Should we use a different exception over here?
There was a problem hiding this comment.
Hmm right. Will fix this in #5093 PR and would rather throw NodeClosedException
There was a problem hiding this comment.
Lets break down to use specific exceptions and use 400/403 as needed in those relevant cases
There was a problem hiding this comment.
This PR just attempts to change the status code for DecommissioningFailedException and here we are making it 400. Once case which Anshu mentioned where we could rather throw NodeClosedException will be fixed in a subsequent PR.
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
Yes, decommission has 3 new APIs and is part of 2.4. We are still incrementally enhancing it. In this, we need to add a change log to this PR? |
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Well, 2.4 has shipped, and that feature is not experimental, or is it? Now you're changing the API in a backwards incompatible way, so I think this cannot go into 2.5 but I am not sure since before it would fail with a 500 which is generic. Either way it does need a CHANGELOG entry in the right version as part of this PR. |
We have labelled it |
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
|
@dblock @Bukhtawar can we merge this? |
dblock
left a comment
There was a problem hiding this comment.
Let's sweat the small stuff in the CHANGELOG, pls.
| - Fix 'org.apache.hc.core5.http.ParseException: Invalid protocol version' under JDK 16+ ([#4827](https://github.com/opensearch-project/OpenSearch/pull/4827)) | ||
| - Fixed compression support for h2c protocol ([#4944](https://github.com/opensearch-project/OpenSearch/pull/4944)) | ||
| - Reject bulk requests with invalid actions ([#5299](https://github.com/opensearch-project/OpenSearch/issues/5299)) | ||
| - Update Rest status for DecommissioningFailedException([#5283](https://github.com/opensearch-project/OpenSearch/pull/5283)) |
There was a problem hiding this comment.
So this is not a fix, but a change. Move above and say "Changed htto code for ... from 500 to 400" similar to what we did for NotXContentException
Also add a space before ( like for all other lines, please.
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
|
Marked for backport 2.x since the feature is experimental in 2.4. |
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-5283-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c7ba2538e837507d0decc77aaba2fa21745fdac1
# Push it to GitHub
git push --set-upstream origin backport/backport-5283-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.xThen, create a pull request where the |
|
@imRishN Needs manual backport pls :( |
…ject#5283) Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
|
Created backport PR |
Signed-off-by: Rishab Nahata rnnahata@amazon.com
Description
This PR aims to update the RestStatus for
DecommissioningFailedExceptiontoBadRequestIssues Resolved
#5075
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.