Skip to content

Commit 579c21f

Browse files
committed
rename to SnapshotDeletionsPending
1 parent 9a73ba7 commit 579c21f

File tree

9 files changed

+62
-64
lines changed

9 files changed

+62
-64
lines changed

server/src/main/java/org/elasticsearch/cluster/ClusterModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ public static List<Entry> getNamedWriteables() {
125125
SnapshotDeletionsInProgress::readDiffFrom);
126126
registerClusterCustom(entries, RepositoryCleanupInProgress.TYPE, RepositoryCleanupInProgress::new,
127127
RepositoryCleanupInProgress::readDiffFrom);
128-
registerClusterCustom(entries, SnapshotDeletionsInPending.TYPE, SnapshotDeletionsInPending::new,
129-
SnapshotDeletionsInPending::readDiffFrom);
128+
registerClusterCustom(entries, SnapshotDeletionsPending.TYPE, SnapshotDeletionsPending::new,
129+
SnapshotDeletionsPending::readDiffFrom);
130130
// Metadata
131131
registerMetadataCustom(entries, RepositoriesMetadata.TYPE, RepositoriesMetadata::new, RepositoriesMetadata::readDiffFrom);
132132
registerMetadataCustom(entries, IngestMetadata.TYPE, IngestMetadata::new, IngestMetadata::readDiffFrom);

server/src/main/java/org/elasticsearch/cluster/SnapshotDeletionsInPending.java renamed to server/src/main/java/org/elasticsearch/cluster/SnapshotDeletionsPending.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
/**
3333
* Represents snapshots marked as to be deleted and pending deletion.
3434
*/
35-
public class SnapshotDeletionsInPending extends AbstractNamedDiffable<Custom> implements Custom {
35+
public class SnapshotDeletionsPending extends AbstractNamedDiffable<Custom> implements Custom {
3636

37-
public static final SnapshotDeletionsInPending EMPTY = new SnapshotDeletionsInPending(Collections.emptySortedSet());
37+
public static final SnapshotDeletionsPending EMPTY = new SnapshotDeletionsPending(Collections.emptySortedSet());
3838
public static final String TYPE = "snapshot_deletions_pending";
3939

4040
public static final int MAX_PENDING_DELETIONS = 500;
@@ -44,12 +44,12 @@ public class SnapshotDeletionsInPending extends AbstractNamedDiffable<Custom> im
4444
*/
4545
private final SortedSet<Entry> entries;
4646

47-
private SnapshotDeletionsInPending(SortedSet<Entry> entries) {
47+
private SnapshotDeletionsPending(SortedSet<Entry> entries) {
4848
this.entries = unmodifiableSortedSet(Objects.requireNonNull(entries));
4949
assert entries.size() <= MAX_PENDING_DELETIONS : entries.size() + " > " + MAX_PENDING_DELETIONS;
5050
}
5151

52-
public SnapshotDeletionsInPending(StreamInput in) throws IOException {
52+
public SnapshotDeletionsPending(StreamInput in) throws IOException {
5353
this(new TreeSet<>(in.readSet(Entry::new)));
5454
}
5555

@@ -90,7 +90,7 @@ public Version getMinimalSupportedVersion() {
9090
return Version.CURRENT.minimumCompatibilityVersion();
9191
}
9292

93-
public SnapshotDeletionsInPending withRemovedSnapshots(Set<SnapshotId> snapshotIds) {
93+
public SnapshotDeletionsPending withRemovedSnapshots(Set<SnapshotId> snapshotIds) {
9494
if (snapshotIds == null || snapshotIds.isEmpty()) {
9595
return this;
9696
}
@@ -104,13 +104,13 @@ public SnapshotDeletionsInPending withRemovedSnapshots(Set<SnapshotId> snapshotI
104104
} else if (updatedEntries.isEmpty()) {
105105
return EMPTY;
106106
} else {
107-
return new SnapshotDeletionsInPending(updatedEntries);
107+
return new SnapshotDeletionsPending(updatedEntries);
108108
}
109109
}
110110

111111
@Override
112112
public String toString() {
113-
final StringBuilder builder = new StringBuilder("SnapshotDeletionsInPending[");
113+
final StringBuilder builder = new StringBuilder("SnapshotDeletionsPending[");
114114
boolean prepend = true;
115115

116116
final Iterator<Entry> iterator = entries.stream().iterator();
@@ -216,8 +216,8 @@ public static final class Builder {
216216
private final SortedSet<Entry> entries = new TreeSet<>();
217217
private final Consumer<Entry> consumer;
218218

219-
public Builder(SnapshotDeletionsInPending snapshotDeletionsInPending, Consumer<Entry> onLimitExceeded) {
220-
entries.addAll(snapshotDeletionsInPending.entries);
219+
public Builder(SnapshotDeletionsPending snapshotDeletionsPending, Consumer<Entry> onLimitExceeded) {
220+
entries.addAll(snapshotDeletionsPending.entries);
221221
this.consumer = onLimitExceeded;
222222
}
223223

@@ -237,9 +237,9 @@ public Builder add(String repositoryName, String repositoryUuid, SnapshotId snap
237237
return this;
238238
}
239239

240-
public SnapshotDeletionsInPending build() {
240+
public SnapshotDeletionsPending build() {
241241
ensureLimit();
242-
return entries.isEmpty() == false ? new SnapshotDeletionsInPending(entries) : EMPTY;
242+
return entries.isEmpty() == false ? new SnapshotDeletionsPending(entries) : EMPTY;
243243
}
244244
}
245245

server/src/main/java/org/elasticsearch/cluster/metadata/MetadataDeleteIndexService.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.elasticsearch.cluster.AckedClusterStateUpdateTask;
1818
import org.elasticsearch.cluster.ClusterState;
1919
import org.elasticsearch.cluster.RestoreInProgress;
20-
import org.elasticsearch.cluster.SnapshotDeletionsInPending;
20+
import org.elasticsearch.cluster.SnapshotDeletionsPending;
2121
import org.elasticsearch.cluster.block.ClusterBlocks;
2222
import org.elasticsearch.cluster.routing.RoutingTable;
2323
import org.elasticsearch.cluster.routing.allocation.AllocationService;
@@ -149,31 +149,31 @@ public ClusterState deleteIndices(ClusterState currentState, Set<Index> indices)
149149
}
150150

151151
// update snapshot(s) marked as to delete
152-
final SnapshotDeletionsInPending deletionsInPending = currentState.custom(
153-
SnapshotDeletionsInPending.TYPE,
154-
SnapshotDeletionsInPending.EMPTY
152+
final SnapshotDeletionsPending deletionsInPending = currentState.custom(
153+
SnapshotDeletionsPending.TYPE,
154+
SnapshotDeletionsPending.EMPTY
155155
);
156-
final SnapshotDeletionsInPending updatedPendingDeletes = updateSnapshotDeletionsPending(deletionsInPending, indicesToDelete, meta);
156+
final SnapshotDeletionsPending updatedPendingDeletes = updateSnapshotDeletionsPending(deletionsInPending, indicesToDelete, meta);
157157
if (updatedPendingDeletes != deletionsInPending) {
158158
if (customBuilder == null) {
159159
customBuilder = ImmutableOpenMap.builder(currentState.getCustoms());
160160
}
161-
customBuilder.put(SnapshotDeletionsInPending.TYPE, updatedPendingDeletes);
161+
customBuilder.put(SnapshotDeletionsPending.TYPE, updatedPendingDeletes);
162162
}
163163
if (customBuilder != null) {
164164
builder.customs(customBuilder.build());
165165
}
166166
return allocationService.reroute(builder.build(), "deleted indices [" + indices + "]");
167167
}
168168

169-
private SnapshotDeletionsInPending updateSnapshotDeletionsPending(
170-
final SnapshotDeletionsInPending pendingDeletions,
169+
private SnapshotDeletionsPending updateSnapshotDeletionsPending(
170+
final SnapshotDeletionsPending pendingDeletions,
171171
final Set<Index> indicesToDelete,
172172
final Metadata metadata
173173
) {
174174
if (indicesToDelete.isEmpty() == false) {
175175
final long timestamp = Instant.now().toEpochMilli();
176-
SnapshotDeletionsInPending.Builder builder = null;
176+
SnapshotDeletionsPending.Builder builder = null;
177177
boolean changed = false;
178178

179179
for (Index indexToDelete : indicesToDelete) {
@@ -215,13 +215,13 @@ private SnapshotDeletionsInPending updateSnapshotDeletionsPending(
215215
}
216216
if (canDeleteSnapshot) {
217217
if (builder == null) {
218-
builder = new SnapshotDeletionsInPending.Builder(
218+
builder = new SnapshotDeletionsPending.Builder(
219219
pendingDeletions,
220220
evicted -> logger.warn(
221221
() -> new ParameterizedMessage(
222222
"maximum number of snapshots [{}] awaiting deletion has been reached in "
223223
+ "cluster state before snapshot [{}] deleted on [{}] in repository [{}/{}] could be deleted",
224-
SnapshotDeletionsInPending.MAX_PENDING_DELETIONS,
224+
SnapshotDeletionsPending.MAX_PENDING_DELETIONS,
225225
evicted.getSnapshotId(),
226226
Instant.ofEpochMilli(evicted.getCreationTime()).atZone(ZoneOffset.UTC),
227227
evicted.getRepositoryName(),

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
import org.elasticsearch.cluster.ClusterState;
3636
import org.elasticsearch.cluster.ClusterStateUpdateTask;
3737
import org.elasticsearch.cluster.RepositoryCleanupInProgress;
38-
import org.elasticsearch.cluster.SnapshotDeletionsInPending;
3938
import org.elasticsearch.cluster.SnapshotDeletionsInProgress;
39+
import org.elasticsearch.cluster.SnapshotDeletionsPending;
4040
import org.elasticsearch.cluster.SnapshotsInProgress;
4141
import org.elasticsearch.cluster.metadata.IndexMetadata;
4242
import org.elasticsearch.cluster.metadata.Metadata;
@@ -2506,7 +2506,7 @@ private ClusterState updateRepositoryGenerationsIfNecessary(ClusterState state,
25062506
}
25072507
}
25082508
updatedDeletionsInProgress = changedDeletions ? SnapshotDeletionsInProgress.of(deletionEntries) : null;
2509-
final SnapshotDeletionsInPending pendingDeletions = state.custom(SnapshotDeletionsInPending.TYPE);
2509+
final SnapshotDeletionsPending pendingDeletions = state.custom(SnapshotDeletionsPending.TYPE);
25102510
return SnapshotsService.updateWithSnapshots(state, updatedSnapshotsInProgress, updatedDeletionsInProgress, pendingDeletions);
25112511
}
25122512

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import org.elasticsearch.cluster.ClusterStateUpdateTask;
2828
import org.elasticsearch.cluster.RestoreInProgress;
2929
import org.elasticsearch.cluster.RestoreInProgress.ShardRestoreStatus;
30-
import org.elasticsearch.cluster.SnapshotDeletionsInPending;
3130
import org.elasticsearch.cluster.SnapshotDeletionsInProgress;
31+
import org.elasticsearch.cluster.SnapshotDeletionsPending;
3232
import org.elasticsearch.cluster.block.ClusterBlocks;
3333
import org.elasticsearch.cluster.metadata.AliasMetadata;
3434
import org.elasticsearch.cluster.metadata.DataStream;
@@ -1377,7 +1377,7 @@ private void ensureSnapshotNotDeletedOrPendingDeletion(ClusterState currentState
13771377
"cannot restore a snapshot while a snapshot deletion is in-progress [" + deletionsInProgress.getEntries().get(0) + "]"
13781378
);
13791379
}
1380-
SnapshotDeletionsInPending pendingDeletions = currentState.custom(SnapshotDeletionsInPending.TYPE);
1380+
SnapshotDeletionsPending pendingDeletions = currentState.custom(SnapshotDeletionsPending.TYPE);
13811381
if (pendingDeletions != null && pendingDeletions.contains(snapshot.getSnapshotId())) {
13821382
throw new ConcurrentSnapshotExecutionException(
13831383
snapshot,

0 commit comments

Comments
 (0)