Skip to content

Commit 05935ae

Browse files
baba-devvdblock
authored andcommitted
Return 409 Conflict HTTP status instead of 500 on failure to concurrently execute snapshots (opensearch-project#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]> Signed-off-by: Shivansh Arora <[email protected]>
1 parent 5333ee7 commit 05935ae

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5555
- Removed blocking wait in TransportGetSnapshotsAction which was exhausting generic threadpool ([#8377](https://github.com/opensearch-project/OpenSearch/pull/8377))
5656
- [Remote Store] Add Segment download stats to remotestore stats API ([#8718](https://github.com/opensearch-project/OpenSearch/pull/8718))
5757
- [Remote Store] Add remote segment transfer stats on NodesStats API ([#9168](https://github.com/opensearch-project/OpenSearch/pull/9168))
58+
- Return 409 Conflict HTTP status instead of 503 on failure to concurrently execute snapshots ([#8986](https://github.com/opensearch-project/OpenSearch/pull/5855))
5859

5960
### Deprecated
6061

server/src/main/java/org/opensearch/snapshots/ConcurrentSnapshotExecutionException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ public ConcurrentSnapshotExecutionException(StreamInput in) throws IOException {
5858

5959
@Override
6060
public RestStatus status() {
61-
return RestStatus.SERVICE_UNAVAILABLE;
61+
return RestStatus.CONFLICT;
6262
}
6363
}

server/src/test/java/org/opensearch/OpenSearchExceptionTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import org.opensearch.search.SearchParseException;
7272
import org.opensearch.search.SearchShardTarget;
7373
import org.opensearch.search.internal.ShardSearchContextId;
74+
import org.opensearch.snapshots.ConcurrentSnapshotExecutionException;
7475
import org.opensearch.test.OpenSearchTestCase;
7576
import org.opensearch.transport.RemoteTransportException;
7677

@@ -119,6 +120,9 @@ public void testStatus() {
119120

120121
exception = new RemoteTransportException("test", new IllegalStateException("foobar"));
121122
assertThat(exception.status(), equalTo(RestStatus.INTERNAL_SERVER_ERROR));
123+
124+
exception = new ConcurrentSnapshotExecutionException("testRepo", "testSnap", "test");
125+
assertSame(exception.status(), RestStatus.CONFLICT);
122126
}
123127

124128
public void testGuessRootCause() {

0 commit comments

Comments
 (0)