Search in sources :

Example 1 with ConcurrentSnapshotExecutionException

use of org.elasticsearch.snapshots.ConcurrentSnapshotExecutionException in project crate by crate.

the class BlobStoreRepository method deleteSnapshot.

@Override
public void deleteSnapshot(SnapshotId snapshotId, long repositoryStateId, boolean writeShardGens, ActionListener<Void> listener) {
    if (isReadOnly()) {
        listener.onFailure(new RepositoryException(metadata.name(), "cannot delete snapshot from a readonly repository"));
    } else {
        final long latestKnownGen = latestKnownRepoGen.get();
        if (latestKnownGen > repositoryStateId) {
            listener.onFailure(new ConcurrentSnapshotExecutionException(new Snapshot(metadata.name(), snapshotId), "Another concurrent operation moved repo generation to [ " + latestKnownGen + "] but this delete assumed generation [" + repositoryStateId + "]"));
            return;
        }
        try {
            final Map<String, BlobMetadata> rootBlobs = blobContainer().listBlobs();
            final RepositoryData repositoryData = safeRepositoryData(repositoryStateId, rootBlobs);
            // Cache the indices that were found before writing out the new index-N blob so that a stuck master will never
            // delete an index that was created by another master node after writing this index-N blob.
            final Map<String, BlobContainer> foundIndices = blobStore().blobContainer(indicesPath()).children();
            doDeleteShardSnapshots(snapshotId, repositoryStateId, foundIndices, rootBlobs, repositoryData, writeShardGens, listener);
        } catch (Exception ex) {
            listener.onFailure(new RepositoryException(metadata.name(), "failed to delete snapshot [" + snapshotId + "]", ex));
        }
    }
}
Also used : BlobStoreIndexShardSnapshot(org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot) Snapshot(org.elasticsearch.snapshots.Snapshot) BlobMetadata(org.elasticsearch.common.blobstore.BlobMetadata) BlobContainer(org.elasticsearch.common.blobstore.BlobContainer) FsBlobContainer(org.elasticsearch.common.blobstore.fs.FsBlobContainer) ConcurrentSnapshotExecutionException(org.elasticsearch.snapshots.ConcurrentSnapshotExecutionException) RepositoryException(org.elasticsearch.repositories.RepositoryException) IndexShardSnapshotFailedException(org.elasticsearch.index.snapshots.IndexShardSnapshotFailedException) IndexFormatTooNewException(org.apache.lucene.index.IndexFormatTooNewException) InvalidArgumentException(io.crate.exceptions.InvalidArgumentException) SnapshotException(org.elasticsearch.snapshots.SnapshotException) IOException(java.io.IOException) SnapshotMissingException(org.elasticsearch.snapshots.SnapshotMissingException) NoSuchFileException(java.nio.file.NoSuchFileException) ConcurrentSnapshotExecutionException(org.elasticsearch.snapshots.ConcurrentSnapshotExecutionException) CorruptIndexException(org.apache.lucene.index.CorruptIndexException) IndexShardRestoreFailedException(org.elasticsearch.index.snapshots.IndexShardRestoreFailedException) RepositoryException(org.elasticsearch.repositories.RepositoryException) NotXContentException(org.elasticsearch.common.compress.NotXContentException) IndexShardSnapshotException(org.elasticsearch.index.snapshots.IndexShardSnapshotException) RepositoryVerificationException(org.elasticsearch.repositories.RepositoryVerificationException) IndexFormatTooOldException(org.apache.lucene.index.IndexFormatTooOldException) RepositoryData(org.elasticsearch.repositories.RepositoryData)

Aggregations

InvalidArgumentException (io.crate.exceptions.InvalidArgumentException)1 IOException (java.io.IOException)1 NoSuchFileException (java.nio.file.NoSuchFileException)1 CorruptIndexException (org.apache.lucene.index.CorruptIndexException)1 IndexFormatTooNewException (org.apache.lucene.index.IndexFormatTooNewException)1 IndexFormatTooOldException (org.apache.lucene.index.IndexFormatTooOldException)1 BlobContainer (org.elasticsearch.common.blobstore.BlobContainer)1 BlobMetadata (org.elasticsearch.common.blobstore.BlobMetadata)1 FsBlobContainer (org.elasticsearch.common.blobstore.fs.FsBlobContainer)1 NotXContentException (org.elasticsearch.common.compress.NotXContentException)1 IndexShardRestoreFailedException (org.elasticsearch.index.snapshots.IndexShardRestoreFailedException)1 IndexShardSnapshotException (org.elasticsearch.index.snapshots.IndexShardSnapshotException)1 IndexShardSnapshotFailedException (org.elasticsearch.index.snapshots.IndexShardSnapshotFailedException)1 BlobStoreIndexShardSnapshot (org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot)1 RepositoryData (org.elasticsearch.repositories.RepositoryData)1 RepositoryException (org.elasticsearch.repositories.RepositoryException)1 RepositoryVerificationException (org.elasticsearch.repositories.RepositoryVerificationException)1 ConcurrentSnapshotExecutionException (org.elasticsearch.snapshots.ConcurrentSnapshotExecutionException)1 Snapshot (org.elasticsearch.snapshots.Snapshot)1 SnapshotException (org.elasticsearch.snapshots.SnapshotException)1