Browse Source

Fix after restore Lucene.pruneUnreferencedFiles() conditional (#81047)

In #68821 we introduced a condition to skip the pruning of 
unreferenced files after the restore of a snapshot for 
searchable snapshot shards. Sadly I managed to mess 
this up in a refactoring (#75308) few months after.

This commit reintroduces the right conditional which is 
to NOT prune Lucene files for searchable snapshot shards.
Tanguy Leroux 3 years ago
parent
commit
8ee05f9d9d

+ 1 - 1
server/src/main/java/org/elasticsearch/repositories/blobstore/FileRestoreContext.java

@@ -175,7 +175,7 @@ public abstract class FileRestoreContext {
 
     private void afterRestore(SnapshotFiles snapshotFiles, Store store, StoreFileMetadata restoredSegmentsFile) {
         try {
-            if (isSearchableSnapshotStore(store.indexSettings().getSettings())) {
+            if (isSearchableSnapshotStore(store.indexSettings().getSettings()) == false) {
                 Lucene.pruneUnreferencedFiles(restoredSegmentsFile.name(), store.directory());
             }
         } catch (IOException e) {