mirror of https://github.com/apache/lucene.git
LUCENE-1020: close each SegmentReader after we've finished testing that segment
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@593819 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
439ba586fc
commit
8b450203fe
|
@ -141,6 +141,8 @@ public class CheckIndex {
|
||||||
System.out.println(" " + (1+i) + " of " + numSegments + ": name=" + info.name + " docCount=" + info.docCount);
|
System.out.println(" " + (1+i) + " of " + numSegments + ": name=" + info.name + " docCount=" + info.docCount);
|
||||||
int toLoseDocCount = info.docCount;
|
int toLoseDocCount = info.docCount;
|
||||||
|
|
||||||
|
SegmentReader reader = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(" compound=" + info.getUseCompoundFile());
|
System.out.println(" compound=" + info.getUseCompoundFile());
|
||||||
System.out.println(" numFiles=" + info.files().size());
|
System.out.println(" numFiles=" + info.files().size());
|
||||||
|
@ -157,7 +159,7 @@ public class CheckIndex {
|
||||||
else
|
else
|
||||||
System.out.println(" has deletions [delFileName=" + delFileName + "]");
|
System.out.println(" has deletions [delFileName=" + delFileName + "]");
|
||||||
System.out.print(" test: open reader.........");
|
System.out.print(" test: open reader.........");
|
||||||
SegmentReader reader = SegmentReader.get(info);
|
reader = SegmentReader.get(info);
|
||||||
final int numDocs = reader.numDocs();
|
final int numDocs = reader.numDocs();
|
||||||
toLoseDocCount = numDocs;
|
toLoseDocCount = numDocs;
|
||||||
if (reader.hasDeletions())
|
if (reader.hasDeletions())
|
||||||
|
@ -258,6 +260,9 @@ public class CheckIndex {
|
||||||
numBadSegments++;
|
numBadSegments++;
|
||||||
changed = true;
|
changed = true;
|
||||||
continue;
|
continue;
|
||||||
|
} finally {
|
||||||
|
if (reader != null)
|
||||||
|
reader.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keeper
|
// Keeper
|
||||||
|
|
Loading…
Reference in New Issue