|
|
@@ -19,15 +19,10 @@
|
|
|
|
|
|
package org.elasticsearch.index.snapshots.blobstore;
|
|
|
|
|
|
-import com.google.common.collect.ImmutableList;
|
|
|
-import com.google.common.collect.ImmutableMap;
|
|
|
import com.google.common.collect.Iterables;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.io.ByteStreams;
|
|
|
-import org.apache.lucene.index.CorruptIndexException;
|
|
|
-import org.apache.lucene.index.IndexFormatTooNewException;
|
|
|
-import org.apache.lucene.index.IndexFormatTooOldException;
|
|
|
-import org.apache.lucene.index.SegmentInfos;
|
|
|
+import org.apache.lucene.index.*;
|
|
|
import org.apache.lucene.store.IOContext;
|
|
|
import org.apache.lucene.store.IndexInput;
|
|
|
import org.apache.lucene.store.IndexOutput;
|
|
|
@@ -902,13 +897,14 @@ public class BlobStoreIndexShardRepository extends AbstractComponent implements
|
|
|
/// now, go over and clean files that are in the store, but were not in the snapshot
|
|
|
try {
|
|
|
for (String storeFile : store.directory().listAll()) {
|
|
|
- if (!Store.isChecksum(storeFile) && !snapshotFiles.containPhysicalIndexFile(storeFile)) {
|
|
|
- try {
|
|
|
- store.deleteQuiet("restore", storeFile);
|
|
|
- store.directory().deleteFile(storeFile);
|
|
|
- } catch (IOException e) {
|
|
|
- logger.warn("[{}] failed to delete file [{}] during snapshot cleanup", snapshotId, storeFile);
|
|
|
- }
|
|
|
+ if (Store.isAutogenerated(storeFile) || snapshotFiles.containPhysicalIndexFile(storeFile)) {
|
|
|
+ continue; //skip write.lock, checksum files and files that exist in the snapshot
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ store.deleteQuiet("restore", storeFile);
|
|
|
+ store.directory().deleteFile(storeFile);
|
|
|
+ } catch (IOException e) {
|
|
|
+ logger.warn("[{}] failed to delete file [{}] during snapshot cleanup", snapshotId, storeFile);
|
|
|
}
|
|
|
}
|
|
|
} catch (IOException e) {
|