Cannot delete snapshot during a restore – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.5

Briefly, this error occurs when an attempt is made to delete a snapshot while it is being restored. Elasticsearch does not allow this operation because it could lead to data inconsistency or loss. To resolve this issue, you can either wait for the restore process to complete before deleting the snapshot, or cancel the ongoing restore operation before proceeding with the deletion. Always ensure to have a backup of your data before performing such operations to prevent any potential data loss.

This guide will help you check for common problems that cause the log ” cannot delete snapshot during a restore ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: snapshot, delete, restore.

Log Context

Log “cannot delete snapshot during a restore” class name is SnapshotsService.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (restoreInProgress != null) {
 // don't allow snapshot deletions while a restore is taking place;
 // otherwise we could end up deleting a snapshot that is being restored
 // and the files the restore depends on would all be gone
 if (restoreInProgress.isEmpty() == false) {
 throw new ConcurrentSnapshotExecutionException(snapshot; "cannot delete snapshot during a restore");
 }
 }
 ClusterState.Builder clusterStateBuilder = ClusterState.builder(currentState);
 SnapshotsInProgress snapshots = currentState.custom(SnapshotsInProgress.TYPE);
 SnapshotsInProgress.Entry snapshotEntry = snapshots != null ? snapshots.snapshot(snapshot) : null;

 

 [ratemypost]