|
@@ -38,6 +38,7 @@ import org.apache.lucene.util.BytesRefBuilder;
|
|
|
import org.apache.lucene.util.IOUtils;
|
|
|
import org.elasticsearch.ElasticsearchParseException;
|
|
|
import org.elasticsearch.ExceptionsHelper;
|
|
|
+import org.elasticsearch.ResourceNotFoundException;
|
|
|
import org.elasticsearch.Version;
|
|
|
import org.elasticsearch.cluster.SnapshotsInProgress;
|
|
|
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
|
@@ -412,8 +413,8 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|
|
"its index folder.", metadata.name(), indexId), ioe);
|
|
|
}
|
|
|
}
|
|
|
- } catch (IOException ex) {
|
|
|
- throw new RepositoryException(metadata.name(), "failed to update snapshot in repository", ex);
|
|
|
+ } catch (IOException | ResourceNotFoundException ex) {
|
|
|
+ throw new RepositoryException(metadata.name(), "failed to delete snapshot [" + snapshotId + "]", ex);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -683,7 +684,9 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|
|
snapshotsBytes = bStream.bytes();
|
|
|
}
|
|
|
// write the index file
|
|
|
- writeAtomic(INDEX_FILE_PREFIX + Long.toString(newGen), snapshotsBytes);
|
|
|
+ final String indexBlob = INDEX_FILE_PREFIX + Long.toString(newGen);
|
|
|
+ logger.debug("Repository [{}] writing new index generational blob [{}]", metadata.name(), indexBlob);
|
|
|
+ writeAtomic(indexBlob, snapshotsBytes);
|
|
|
// delete the N-2 index file if it exists, keep the previous one around as a backup
|
|
|
if (isReadOnly() == false && newGen - 2 >= 0) {
|
|
|
final String oldSnapshotIndexFile = INDEX_FILE_PREFIX + Long.toString(newGen - 2);
|
|
@@ -701,6 +704,7 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|
|
if (snapshotsBlobContainer.blobExists(INDEX_LATEST_BLOB)) {
|
|
|
snapshotsBlobContainer.deleteBlob(INDEX_LATEST_BLOB);
|
|
|
}
|
|
|
+ logger.debug("Repository [{}] updating index.latest with generation [{}]", metadata.name(), newGen);
|
|
|
writeAtomic(INDEX_LATEST_BLOB, genBytes);
|
|
|
}
|
|
|
|