fix IW infoStream to tell us when an NRT reader incRef/decRefs its segments

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1714017 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2015-11-12 10:57:06 +00:00
parent eb0da10bb4
commit 456e17a8e4
2 changed files with 7 additions and 2 deletions

View File

@ -693,7 +693,7 @@ final class IndexFileDeleter implements Closeable {
if (!refCounts.containsKey(fileName)) {
rc = new RefCount(fileName);
// We should never incRef a file we are already wanting to delete:
assert deletable == null || deletable.contains(fileName) == false: "file \"" + fileName + "\" cannot be incRef'd: it's already pending delete";
assert deletable.contains(fileName) == false: "file \"" + fileName + "\" cannot be incRef'd: it's already pending delete";
refCounts.put(fileName, rc);
} else {
rc = refCounts.get(fileName);

View File

@ -4704,17 +4704,22 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
maybeMerge(config.getMergePolicy(), MergeTrigger.SEGMENT_FLUSH, UNBOUNDED_MAX_MERGE_SEGMENTS);
}
}
}
synchronized void incRefDeleter(SegmentInfos segmentInfos) throws IOException {
ensureOpen();
deleter.incRef(segmentInfos, false);
if (infoStream.isEnabled("IW")) {
infoStream.message("IW", "incRefDeleter for NRT reader version=" + segmentInfos.getVersion() + " segments=" + segString(segmentInfos));
}
}
synchronized void decRefDeleter(SegmentInfos segmentInfos) throws IOException {
ensureOpen();
deleter.decRef(segmentInfos);
if (infoStream.isEnabled("IW")) {
infoStream.message("IW", "decRefDeleter for NRT reader version=" + segmentInfos.getVersion() + " segments=" + segString(segmentInfos));
}
}
private boolean processEvents(boolean triggerMerge, boolean forcePurge) throws IOException {