mirror of https://github.com/apache/lucene.git
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:
parent
2dfb0a02a8
commit
588ed73b94
|
@ -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")) {
|
||||
|
|
Loading…
Reference in New Issue