Skip to content

Commit

Permalink
Return 409 Conflict HTTP status instead of 500 on failure to concurre…
Browse files Browse the repository at this point in the history
…ntly execute snapshots (#8986)

Signed-off-by: Mani <[email protected]>

Return 409 Conflict HTTP status instead of 500 on failure to concurrently execute snapshots

Signed-off-by: Mani <[email protected]>

another

Signed-off-by: Mani <[email protected]>
Signed-off-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
  • Loading branch information
baba-devv and dblock authored Aug 14, 2023
1 parent 0d5dbde commit 8e57a66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Removed blocking wait in TransportGetSnapshotsAction which was exhausting generic threadpool ([#8377](https://github.com/opensearch-project/OpenSearch/pull/8377))
- [Remote Store] Add Segment download stats to remotestore stats API ([#8718](https://github.com/opensearch-project/OpenSearch/pull/8718))
- [Remote Store] Add remote segment transfer stats on NodesStats API ([#9168](https://github.com/opensearch-project/OpenSearch/pull/9168))
- Return 409 Conflict HTTP status instead of 503 on failure to concurrently execute snapshots ([#8986](https://github.com/opensearch-project/OpenSearch/pull/5855))

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public ConcurrentSnapshotExecutionException(StreamInput in) throws IOException {

@Override
public RestStatus status() {
return RestStatus.SERVICE_UNAVAILABLE;
return RestStatus.CONFLICT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import org.opensearch.search.SearchParseException;
import org.opensearch.search.SearchShardTarget;
import org.opensearch.search.internal.ShardSearchContextId;
import org.opensearch.snapshots.ConcurrentSnapshotExecutionException;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.transport.RemoteTransportException;

Expand Down Expand Up @@ -119,6 +120,9 @@ public void testStatus() {

exception = new RemoteTransportException("test", new IllegalStateException("foobar"));
assertThat(exception.status(), equalTo(RestStatus.INTERNAL_SERVER_ERROR));

exception = new ConcurrentSnapshotExecutionException("testRepo", "testSnap", "test");
assertSame(exception.status(), RestStatus.CONFLICT);
}

public void testGuessRootCause() {
Expand Down

0 comments on commit 8e57a66

Please sign in to comment.