浏览代码

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 年之前
父节点
当前提交
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) {
     private void afterRestore(SnapshotFiles snapshotFiles, Store store, StoreFileMetadata restoredSegmentsFile) {
         try {
         try {
-            if (isSearchableSnapshotStore(store.indexSettings().getSettings())) {
+            if (isSearchableSnapshotStore(store.indexSettings().getSettings()) == false) {
                 Lucene.pruneUnreferencedFiles(restoredSegmentsFile.name(), store.directory());
                 Lucene.pruneUnreferencedFiles(restoredSegmentsFile.name(), store.directory());
             }
             }
         } catch (IOException e) {
         } catch (IOException e) {