SOLR-6640: Use SegmentInfos.files in unused file check

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1656630 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2015-02-03 06:55:01 +00:00
parent 2dfb0a02a8
commit 588ed73b94
1 changed files with 1 additions and 5 deletions

View File

@ -569,13 +569,9 @@ public class SnapPuller {
}
private boolean hasUnusedFiles(Directory indexDir, IndexCommit commit) throws IOException {
Set<String> currentFiles = new HashSet<>();
String segmentsFileName = commit.getSegmentsFileName();
SegmentInfos infos = SegmentInfos.readCommit(indexDir, segmentsFileName);
for (SegmentCommitInfo info : infos.asList()) {
Set<String> files = info.info.files(); // All files that belong to this segment
currentFiles.addAll(files);
}
Set<String> currentFiles = new HashSet<>(infos.files(indexDir, true));
String[] allFiles = indexDir.listAll();
for (String file : allFiles) {
if (!file.equals(segmentsFileName) && !currentFiles.contains(file) && !file.endsWith(".lock")) {