Skip to content

Commit 68a199f

Browse files
Minor Cleanup Dead Code Snapshotting (#57716) (#59569)
* Use consistent cluster state instead in state update * Remove dead loop in tests * Remove some dead exception ctors Just three trivial/random things I found.
1 parent 5f7e7e9 commit 68a199f

File tree

4 files changed

+1
-19
lines changed

4 files changed

+1
-19
lines changed

server/src/main/java/org/elasticsearch/index/snapshots/IndexShardSnapshotException.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ public IndexShardSnapshotException(ShardId shardId, String msg) {
3333
this(shardId, msg, null);
3434
}
3535

36-
public IndexShardSnapshotException(ShardId shardId, Throwable cause) {
37-
super(cause);
38-
setShard(shardId);
39-
}
40-
4136
public IndexShardSnapshotException(ShardId shardId, String msg, Throwable cause) {
4237
super(msg, cause);
4338
setShard(shardId);

server/src/main/java/org/elasticsearch/index/snapshots/IndexShardSnapshotFailedException.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ public IndexShardSnapshotFailedException(ShardId shardId, String msg) {
3232
super(shardId, msg);
3333
}
3434

35-
public IndexShardSnapshotFailedException(ShardId shardId, Throwable cause) {
36-
super(shardId, cause);
37-
}
38-
3935
public IndexShardSnapshotFailedException(ShardId shardId, String msg, Throwable cause) {
4036
super(shardId, msg, cause);
4137
}

server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,7 @@ public ClusterState execute(ClusterState currentState) {
362362
final List<IndexId> indexIds = repositoryData.resolveNewIndices(indices);
363363
final List<String> dataStreams =
364364
indexNameExpressionResolver.dataStreamNames(currentState, request.indicesOptions(), request.indices());
365-
final Version version = minCompatibleVersion(
366-
clusterService.state().nodes().getMinNodeVersion(), repositoryData, null);
365+
final Version version = minCompatibleVersion(currentState.nodes().getMinNodeVersion(), repositoryData, null);
367366
ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards =
368367
shards(currentState, indexIds, useShardGenerations(version), repositoryData);
369368
if (request.partial() == false) {

server/src/test/java/org/elasticsearch/snapshots/SnapshotResiliencyTests.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -615,14 +615,6 @@ public void testBulkSnapshotDeleteWithAbort() {
615615
Collection<SnapshotId> snapshotIds = getRepositoryData(repository).getSnapshotIds();
616616
// No snapshots should be left in the repository
617617
assertThat(snapshotIds, empty());
618-
619-
for (SnapshotId snapshotId : snapshotIds) {
620-
final SnapshotInfo snapshotInfo = repository.getSnapshotInfo(snapshotId);
621-
assertEquals(SnapshotState.SUCCESS, snapshotInfo.state());
622-
assertThat(snapshotInfo.indices(), containsInAnyOrder(index));
623-
assertEquals(shards, snapshotInfo.successfulShards());
624-
assertEquals(0, snapshotInfo.failedShards());
625-
}
626618
}
627619

628620
public void testConcurrentSnapshotRestoreAndDeleteOther() {

0 commit comments

Comments
 (0)