Remove Dead Code in SLM Delete Handling (#56081) (#56098)

The delete response is always acknowledged. No need to handle anything else.
This commit is contained in:
Armin Braun 2020-05-04 12:22:06 +02:00 committed by GitHub
parent e01b999ef0
commit 0860d1dc74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 13 deletions

View File

@ -116,11 +116,6 @@ public class SnapshotHistoryItem implements Writeable, ToXContentObject {
return new SnapshotHistoryItem(timestamp, policyId, repository, snapshotName, DELETE_OPERATION, true, null, null);
}
public static SnapshotHistoryItem deletionPossibleSuccessRecord(long timestamp, String snapshotName, String policyId, String repository,
String details) {
return new SnapshotHistoryItem(timestamp, policyId, repository, snapshotName, DELETE_OPERATION, true, null, details);
}
public static SnapshotHistoryItem deletionFailureRecord(long timestamp, String snapshotName, String policyId, String repository,
Exception exception) throws IOException {
String exceptionString = exceptionToString(exception);

View File

@ -383,14 +383,9 @@ public class SnapshotRetentionTask implements SchedulerEngine.Listener {
// i.e are newer or equal to SnapshotsService#MULTI_DELETE_VERSION
deleteSnapshot(policyId, repo, info.snapshotId(), slmStats, ActionListener.wrap(acknowledgedResponse -> {
deleted.incrementAndGet();
if (acknowledgedResponse.isAcknowledged()) {
historyStore.putAsync(SnapshotHistoryItem.deletionSuccessRecord(Instant.now().toEpochMilli(),
assert acknowledgedResponse.isAcknowledged();
historyStore.putAsync(SnapshotHistoryItem.deletionSuccessRecord(Instant.now().toEpochMilli(),
info.snapshotId().getName(), policyId, repo));
} else {
SnapshotHistoryItem.deletionPossibleSuccessRecord(Instant.now().toEpochMilli(),
info.snapshotId().getName(), policyId, repo,
"deletion request issued successfully, no acknowledgement received");
}
}, e -> {
failed.incrementAndGet();
try {

View File

@ -473,7 +473,6 @@ public class SnapshotRetentionTaskTests extends ESTestCase {
threadPool);
AtomicBoolean onFailureCalled = new AtomicBoolean(false);
AtomicReference<Exception> errHandlerCalled = new AtomicReference<>(null);
task.deleteSnapshot("policy", "foo", new SnapshotId("name", "uuid"),
new SnapshotLifecycleStats(0, 0, 0, 0, new HashMap<>()), new ActionListener<AcknowledgedResponse>() {
@Override