Make IndexFileDeleter.lastFiles a List<String> instead of List<Collection<String>>

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1521258 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2013-09-09 19:30:51 +00:00
parent 19f9181c74
commit 61d684fe7f
1 changed files with 7 additions and 10 deletions

View File

@ -92,7 +92,7 @@ final class IndexFileDeleter implements Closeable {
/* Holds files we had incref'd from the previous /* Holds files we had incref'd from the previous
* non-commit checkpoint: */ * non-commit checkpoint: */
private List<Collection<String>> lastFiles = new ArrayList<Collection<String>>(); private final List<String> lastFiles = new ArrayList<String>();
/* Commits that the IndexDeletionPolicy have decided to delete: */ /* Commits that the IndexDeletionPolicy have decided to delete: */
private List<CommitPoint> commitsToDelete = new ArrayList<CommitPoint>(); private List<CommitPoint> commitsToDelete = new ArrayList<CommitPoint>();
@ -361,14 +361,13 @@ final class IndexFileDeleter implements Closeable {
refresh(null); refresh(null);
} }
@Override
public void close() throws IOException { public void close() throws IOException {
// DecRef old files from the last checkpoint, if any: // DecRef old files from the last checkpoint, if any:
assert locked(); assert locked();
int size = lastFiles.size();
if (size > 0) { if (!lastFiles.isEmpty()) {
for(int i=0;i<size;i++) { decRef(lastFiles);
decRef(lastFiles.get(i));
}
lastFiles.clear(); lastFiles.clear();
} }
@ -459,13 +458,11 @@ final class IndexFileDeleter implements Closeable {
deleteCommits(); deleteCommits();
} else { } else {
// DecRef old files from the last checkpoint, if any: // DecRef old files from the last checkpoint, if any:
for (Collection<String> lastFile : lastFiles) { decRef(lastFiles);
decRef(lastFile);
}
lastFiles.clear(); lastFiles.clear();
// Save files so we can decr on next checkpoint/commit: // Save files so we can decr on next checkpoint/commit:
lastFiles.add(segmentInfos.files(directory, false)); lastFiles.addAll(segmentInfos.files(directory, false));
} }
if (infoStream.isEnabled("IFD")) { if (infoStream.isEnabled("IFD")) {
long t1 = System.nanoTime(); long t1 = System.nanoTime();