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

Signed-off-by: Mani <singh.mani1231@gmail.com>

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

Signed-off-by: Mani <singh.mani1231@gmail.com>

another
  • Loading branch information
baba-devv committed Jul 29, 2023
1 parent a3aab67 commit e6451d6
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 @@ -48,6 +48,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Remote Segment Store Repository setting moved from `index.remote_store.repository` to `index.remote_store.segment.repository` and `cluster.remote_store.repository` to `cluster.remote_store.segment.repository` respectively for Index and Cluster level settings ([#8719](https://github.com/opensearch-project/OpenSearch/pull/8719))
- [Remote Store] Add support to restore only unassigned shards of an index ([#8792](https://github.com/opensearch-project/OpenSearch/pull/8792))
- Replace the deprecated IndexReader APIs with new storedFields() & termVectors() ([#7792](https://github.com/opensearch-project/OpenSearch/pull/7792))
- Return 409 Conflict HTTP status instead of 500 on failure to concurrently execute snapshots ([#5855](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 e6451d6

Please sign in to comment.