-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Removed NOT_FOUND for empty results. #6544
Removed NOT_FOUND for empty results. #6544
Conversation
Gradle Check (Jenkins) Run Completed with:
|
@@ -57,7 +56,6 @@ public List<DeletePitInfo> getDeletePitResults() { | |||
*/ | |||
@Override | |||
public RestStatus status() { | |||
if (deletePitResults.isEmpty()) return NOT_FOUND; |
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.
So what would be the payload returned from the method? Empty list of PITs?
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.
The server returns 200 StatusCode with { "pits": [] } as the body when there are no PITs to delete.
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.
Please add the test cases
Also, please fix DCO check, it is failing |
Gradle Check (Jenkins) Run Completed with:
|
Wht is the criteria to merge this PR. All the feedback providers must approve this PR? |
Yes |
@reta @harshjain2 : Anything pending for merge ? |
@dreamer-89 @reta I have addressed all the feedback provided on the PR. Nothing pending from my side on this PR. |
I also approved, @Arpit-Bandejiya your concerns were cleared out? |
CHANGELOG.md
Outdated
@@ -73,6 +73,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
- Add GeoTile and GeoHash Grid aggregations on GeoShapes. ([#5589](https://github.com/opensearch-project/OpenSearch/pull/5589)) | |||
- Disallow multiple data paths for search nodes ([#6427](https://github.com/opensearch-project/OpenSearch/pull/6427)) | |||
- [Segment Replication] Allocation and rebalancing based on average primary shard count per index ([#6422](https://github.com/opensearch-project/OpenSearch/pull/6422)) | |||
- Removed NOT_FOUND for empty results. ([#6544](https://github.com/opensearch-project/OpenSearch/pull/6544)) |
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.
Check out the contributing doc for more details, but this entry isn't super helpful as a release note because it doesn't provide any context about what this change means. I'd suggest something like "Return success on DeletePits when nothing is deleted" or "Return success on DeletePits when no PITs exist".
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.
Done.
@@ -138,5 +138,7 @@ | |||
- match: {pits.0.successful: true } | |||
|
|||
- do: | |||
catch: missing | |||
delete_all_pits: { } | |||
delete_all_pits: {} |
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.
Does this change the behavior of deleting a single PIT or a list of PITs? Should there be a test for those cases as well?
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.
@andrross I don't think it will result in any change in the behaviour of deleting a single PIT or a list of PITs using DELETE localhost:9200/_search/point_in_time/
API.
Request Delete PIT with empty array results in validation exception.
DELETE localhost:9200/_search/point_in_time/
Request Body
{
"pit_id": []
}
Response
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: no pit ids specified;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: no pit ids specified;"
},
"status": 400
}
Request with incorrect pits results in failure with failure message associated with every pit id
DELETE localhost:9200/_search/point_in_time/
Request Body
{
"pit_id": [
"o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAEWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA",
"o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAIWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA"
]
}
Response
{
"pits": [
{
"successful": false,
"pit_id": "o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAEWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA"
},
{
"successful": false,
"pit_id": "o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAIWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA"
}
]
}
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.
@andrross Should there be a test for those cases as well?
Few tests cases already exist for the DELETE PIT(s). But I couldn't find test case for the use case where empty pit array is passed in the body.
DELETE localhost:9200/_search/point_in_time/
Request Body:
{
"pit_id": []
}
I believe this should be tracked through a separate issue.
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
@harshjain2 Can you rebase and fix the conflicts? |
Signed-off-by: Harsh Jain <harshjai@amazon.com>
Signed-off-by: Harsh Jain <harshjai@amazon.com>
Signed-off-by: Harsh Jain <harshjai@amazon.com> Signed-off-by: Harsh Jain <harshjai@amazon.com>
Signed-off-by: Harsh Jain <harshjai@amazon.com>
Signed-off-by: Harsh Jain <harshjai@amazon.com>
Signed-off-by: Harsh Jain <harshjai@amazon.com>
Signed-off-by: Harsh Jain <harshjai@amazon.com>
Signed-off-by: Harsh Jain <harshjai@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
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-6544-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 67a9b439db79f2782a3fd071004e3ff02c59ba13
# Push it to GitHub
git push --set-upstream origin backport/backport-6544-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x Then, create a pull request where the |
@harshjain2 the backport to 2.x failed :( could you please do a manual one? thank you |
Backport PR to 2.x : #6614 |
* Removed NOT_FOUND for empty results. Signed-off-by: Harsh Jain <harshjai@amazon.com> * Fixed failing tests. Signed-off-by: Harsh Jain <harshjai@amazon.com> * Removed unnecessary semi-colon. Signed-off-by: Harsh Jain <harshjai@amazon.com> Signed-off-by: Harsh Jain <harshjai@amazon.com> * Added change log. Signed-off-by: Harsh Jain <harshjai@amazon.com> * Fixed formatting issues Signed-off-by: Harsh Jain <harshjai@amazon.com> * Backported to 2.x branch Signed-off-by: Harsh Jain <harshjai@amazon.com> * Removed duplicate entry as this entry is present under [Unrelease 2.x]. Signed-off-by: Harsh Jain <harshjai@amazon.com> * Updated changelog to make it more meaningful. Signed-off-by: Harsh Jain <harshjai@amazon.com> --------- Signed-off-by: Harsh Jain <harshjai@amazon.com> Co-authored-by: Harsh Jain <harshjai@amazon.com> (cherry picked from commit 67a9b43)
* Removed NOT_FOUND for empty results. Signed-off-by: Harsh Jain <harshjai@amazon.com> * Fixed failing tests. Signed-off-by: Harsh Jain <harshjai@amazon.com> * Removed unnecessary semi-colon. Signed-off-by: Harsh Jain <harshjai@amazon.com> Signed-off-by: Harsh Jain <harshjai@amazon.com> * Added change log. Signed-off-by: Harsh Jain <harshjai@amazon.com> * Fixed formatting issues Signed-off-by: Harsh Jain <harshjai@amazon.com> * Backported to 2.x branch Signed-off-by: Harsh Jain <harshjai@amazon.com> * Removed duplicate entry as this entry is present under [Unrelease 2.x]. Signed-off-by: Harsh Jain <harshjai@amazon.com> * Updated changelog to make it more meaningful. Signed-off-by: Harsh Jain <harshjai@amazon.com> --------- Signed-off-by: Harsh Jain <harshjai@amazon.com> Co-authored-by: Harsh Jain <harshjai@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com>
Description
Fix for the issue due to which 404 was returned when no PITs were present.
Issues Resolved
#5938
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.