Skip to content

Commit

Permalink
Removed NOT_FOUND for empty results. (opensearch-project#6544)
Browse files Browse the repository at this point in the history
* Removed NOT_FOUND for empty results.

Signed-off-by: Harsh Jain <[email protected]>

* Fixed failing tests.

Signed-off-by: Harsh Jain <[email protected]>

* Removed unnecessary semi-colon.
Signed-off-by: Harsh Jain <[email protected]>

Signed-off-by: Harsh Jain <[email protected]>

* Added change log.
Signed-off-by: Harsh Jain <[email protected]>

* Fixed formatting issues

Signed-off-by: Harsh Jain <[email protected]>

* Backported to 2.x branch

Signed-off-by: Harsh Jain <[email protected]>

* Removed duplicate entry as this entry is present under [Unrelease 2.x].

Signed-off-by: Harsh Jain <[email protected]>

* Updated changelog to make it more meaningful.

Signed-off-by: Harsh Jain <[email protected]>

---------

Signed-off-by: Harsh Jain <[email protected]>
Co-authored-by: Harsh Jain <[email protected]>
  • Loading branch information
harshjain2 and Harsh Jain authored Mar 9, 2023
1 parent acebfed commit 67a9b43
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- 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))
- Add 'base_path' setting to File System Repository ([#6558](https://github.com/opensearch-project/OpenSearch/pull/6558))
- Return success on DeletePits when no PITs exist. ([#6544](https://github.com/opensearch-project/OpenSearch/pull/6544))

### Dependencies
- Bump `org.apache.logging.log4j:log4j-core` from 2.18.0 to 2.20.0 ([#6490](https://github.com/opensearch-project/OpenSearch/pull/6490))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,7 @@
- match: {pits.0.successful: true }

- do:
catch: missing
delete_all_pits: { }
delete_all_pits: {}

- match: {pits: []}
- length: {pits: 0}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.List;

import static org.opensearch.core.xcontent.ConstructingObjectParser.constructorArg;
import static org.opensearch.rest.RestStatus.NOT_FOUND;
import static org.opensearch.rest.RestStatus.OK;

/**
Expand Down Expand Up @@ -57,7 +56,6 @@ public List<DeletePitInfo> getDeletePitResults() {
*/
@Override
public RestStatus status() {
if (deletePitResults.isEmpty()) return NOT_FOUND;
return OK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testDeletePitResponseToXContent() throws IOException {
public void testDeletePitResponseToAndFromXContent() throws IOException {
XContentType xContentType = randomFrom(XContentType.values());
DeletePitResponse originalResponse = createDeletePitResponseTestItem();
;

BytesReference originalBytes = toShuffledXContent(originalResponse, xContentType, ToXContent.EMPTY_PARAMS, randomBoolean());
DeletePitResponse parsedResponse;
try (XContentParser parser = createParser(xContentType.xContent(), originalBytes)) {
Expand Down

0 comments on commit 67a9b43

Please sign in to comment.