mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
The delete response is always acknowledged. No need to handle anything else.
This commit is contained in:
parent
e01b999ef0
commit
0860d1dc74
@ -116,11 +116,6 @@ public class SnapshotHistoryItem implements Writeable, ToXContentObject {
|
|||||||
return new SnapshotHistoryItem(timestamp, policyId, repository, snapshotName, DELETE_OPERATION, true, null, null);
|
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,
|
public static SnapshotHistoryItem deletionFailureRecord(long timestamp, String snapshotName, String policyId, String repository,
|
||||||
Exception exception) throws IOException {
|
Exception exception) throws IOException {
|
||||||
String exceptionString = exceptionToString(exception);
|
String exceptionString = exceptionToString(exception);
|
||||||
|
@ -383,14 +383,9 @@ public class SnapshotRetentionTask implements SchedulerEngine.Listener {
|
|||||||
// i.e are newer or equal to SnapshotsService#MULTI_DELETE_VERSION
|
// i.e are newer or equal to SnapshotsService#MULTI_DELETE_VERSION
|
||||||
deleteSnapshot(policyId, repo, info.snapshotId(), slmStats, ActionListener.wrap(acknowledgedResponse -> {
|
deleteSnapshot(policyId, repo, info.snapshotId(), slmStats, ActionListener.wrap(acknowledgedResponse -> {
|
||||||
deleted.incrementAndGet();
|
deleted.incrementAndGet();
|
||||||
if (acknowledgedResponse.isAcknowledged()) {
|
assert acknowledgedResponse.isAcknowledged();
|
||||||
historyStore.putAsync(SnapshotHistoryItem.deletionSuccessRecord(Instant.now().toEpochMilli(),
|
historyStore.putAsync(SnapshotHistoryItem.deletionSuccessRecord(Instant.now().toEpochMilli(),
|
||||||
info.snapshotId().getName(), policyId, repo));
|
info.snapshotId().getName(), policyId, repo));
|
||||||
} else {
|
|
||||||
SnapshotHistoryItem.deletionPossibleSuccessRecord(Instant.now().toEpochMilli(),
|
|
||||||
info.snapshotId().getName(), policyId, repo,
|
|
||||||
"deletion request issued successfully, no acknowledgement received");
|
|
||||||
}
|
|
||||||
}, e -> {
|
}, e -> {
|
||||||
failed.incrementAndGet();
|
failed.incrementAndGet();
|
||||||
try {
|
try {
|
||||||
|
@ -473,7 +473,6 @@ public class SnapshotRetentionTaskTests extends ESTestCase {
|
|||||||
threadPool);
|
threadPool);
|
||||||
|
|
||||||
AtomicBoolean onFailureCalled = new AtomicBoolean(false);
|
AtomicBoolean onFailureCalled = new AtomicBoolean(false);
|
||||||
AtomicReference<Exception> errHandlerCalled = new AtomicReference<>(null);
|
|
||||||
task.deleteSnapshot("policy", "foo", new SnapshotId("name", "uuid"),
|
task.deleteSnapshot("policy", "foo", new SnapshotId("name", "uuid"),
|
||||||
new SnapshotLifecycleStats(0, 0, 0, 0, new HashMap<>()), new ActionListener<AcknowledgedResponse>() {
|
new SnapshotLifecycleStats(0, 0, 0, 0, new HashMap<>()), new ActionListener<AcknowledgedResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user