Skip to content

Commit 30555c8

Browse files
committed
Remove failures from the GetSnapshotConstructor
1 parent a368781 commit 30555c8

File tree

5 files changed

+4
-28
lines changed

5 files changed

+4
-28
lines changed

qa/smoke-test-http/src/javaRestTest/java/org/elasticsearch/http/snapshots/RestGetSnapshotsIT.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.http.snapshots;
1111

1212
import org.apache.http.client.methods.HttpGet;
13-
import org.elasticsearch.ElasticsearchException;
1413
import org.elasticsearch.action.ActionFuture;
1514
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
1615
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
@@ -37,7 +36,6 @@
3736
import java.io.InputStream;
3837
import java.util.ArrayList;
3938
import java.util.Collection;
40-
import java.util.HashMap;
4139
import java.util.HashSet;
4240
import java.util.List;
4341
import java.util.Map;
@@ -516,10 +514,9 @@ private static GetSnapshotsResponse sortedWithLimit(
516514
true,
517515
(args) -> new GetSnapshotsResponse(
518516
(List<SnapshotInfo>) args[0],
519-
(Map<String, ElasticsearchException>) args[1],
520-
(String) args[2],
521-
args[3] == null ? UNKNOWN_COUNT : (int) args[3],
522-
args[4] == null ? UNKNOWN_COUNT : (int) args[4]
517+
(String) args[1],
518+
args[2] == null ? UNKNOWN_COUNT : (int) args[2],
519+
args[3] == null ? UNKNOWN_COUNT : (int) args[3]
523520
)
524521
);
525522

@@ -529,11 +526,6 @@ private static GetSnapshotsResponse sortedWithLimit(
529526
(p, c) -> SnapshotInfoUtils.snapshotInfoFromXContent(p),
530527
new ParseField("snapshots")
531528
);
532-
GET_SNAPSHOT_PARSER.declareObject(
533-
ConstructingObjectParser.optionalConstructorArg(),
534-
(p, c) -> p.map(HashMap::new, ElasticsearchException::fromXContent),
535-
new ParseField("failures")
536-
);
537529
GET_SNAPSHOT_PARSER.declareStringOrNull(ConstructingObjectParser.optionalConstructorArg(), new ParseField("next"));
538530
GET_SNAPSHOT_PARSER.declareIntOrNull(ConstructingObjectParser.optionalConstructorArg(), UNKNOWN_COUNT, new ParseField("total"));
539531
GET_SNAPSHOT_PARSER.declareIntOrNull(ConstructingObjectParser.optionalConstructorArg(), UNKNOWN_COUNT, new ParseField("remaining"));

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
package org.elasticsearch.action.admin.cluster.snapshots.get;
1111

12-
import org.elasticsearch.ElasticsearchException;
1312
import org.elasticsearch.action.ActionResponse;
1413
import org.elasticsearch.common.Strings;
1514
import org.elasticsearch.common.collect.Iterators;
@@ -40,13 +39,7 @@ public class GetSnapshotsResponse extends ActionResponse implements ChunkedToXCo
4039

4140
private final int remaining;
4241

43-
public GetSnapshotsResponse(
44-
List<SnapshotInfo> snapshots,
45-
Map<String, ElasticsearchException> failures,
46-
@Nullable String next,
47-
final int total,
48-
final int remaining
49-
) {
42+
public GetSnapshotsResponse(List<SnapshotInfo> snapshots, @Nullable String next, final int total, final int remaining) {
5043
this.snapshots = List.copyOf(snapshots);
5144
this.next = next;
5245
this.total = total;

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/TransportGetSnapshotsAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ private GetSnapshotsResponse buildResponse() {
521521
}
522522
return new GetSnapshotsResponse(
523523
snapshotInfos,
524-
null,
525524
remaining > 0 ? sortBy.encodeAfterQueryParam(snapshotInfos.get(snapshotInfos.size() - 1)) : null,
526525
totalCount.get(),
527526
remaining

server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponseTests.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
package org.elasticsearch.action.admin.cluster.snapshots.get;
1111

12-
import org.elasticsearch.ElasticsearchException;
1312
import org.elasticsearch.TransportVersion;
1413
import org.elasticsearch.common.UUIDs;
1514
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
@@ -31,10 +30,8 @@
3130
import java.util.Arrays;
3231
import java.util.Base64;
3332
import java.util.Collections;
34-
import java.util.HashMap;
3533
import java.util.HashSet;
3634
import java.util.List;
37-
import java.util.Map;
3835
import java.util.Set;
3936

4037
public class GetSnapshotsResponseTests extends ESTestCase {
@@ -91,7 +88,6 @@ private List<SnapshotInfo> createSnapshotInfos(String repoName) {
9188

9289
private GetSnapshotsResponse createTestInstance() {
9390
Set<String> repositories = new HashSet<>();
94-
Map<String, ElasticsearchException> failures = new HashMap<>();
9591
List<SnapshotInfo> responses = new ArrayList<>();
9692

9793
for (int i = 0; i < randomIntBetween(0, 5); i++) {
@@ -103,12 +99,10 @@ private GetSnapshotsResponse createTestInstance() {
10399
for (int i = 0; i < randomIntBetween(0, 5); i++) {
104100
String repository = randomValueOtherThanMany(repositories::contains, () -> randomAlphaOfLength(10));
105101
repositories.add(repository);
106-
failures.put(repository, new ElasticsearchException(randomAlphaOfLength(10)));
107102
}
108103

109104
return new GetSnapshotsResponse(
110105
responses,
111-
failures,
112106
randomBoolean()
113107
? Base64.getUrlEncoder()
114108
.encodeToString(

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/WaitForSnapshotStepTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ public void testSlmPolicyExecutedAfterStep() {
164164
SnapshotState.SUCCESS
165165
)
166166
),
167-
Map.of(),
168167
null,
169168
0,
170169
0
@@ -202,7 +201,6 @@ public void testIndexNotBackedUpYet() {
202201
SnapshotState.SUCCESS
203202
)
204203
),
205-
Map.of(),
206204
null,
207205
0,
208206
0

0 commit comments

Comments
 (0)