print number of active threads states in IW.infoStream, even when flushing due to RAM usage

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1593501 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-05-09 09:26:58 +00:00
parent 557e62bfe4
commit f849e4df71
2 changed files with 12 additions and 6 deletions

View File

@ -89,7 +89,7 @@ class FlushByRamOrCountsPolicy extends FlushPolicy {
final long totalRam = control.activeBytes() + control.getDeleteBytesUsed();
if (totalRam >= limit) {
if (infoStream.isEnabled("FP")) {
infoStream.message("FP", "flush: activeBytes=" + control.activeBytes() + " deleteBytes=" + control.getDeleteBytesUsed() + " vs limit=" + limit);
infoStream.message("FP", "trigger flush: activeBytes=" + control.activeBytes() + " deleteBytes=" + control.getDeleteBytesUsed() + " vs limit=" + limit);
}
markLargestWriterPending(control, state, totalRam);
}
@ -102,8 +102,7 @@ class FlushByRamOrCountsPolicy extends FlushPolicy {
*/
protected void markLargestWriterPending(DocumentsWriterFlushControl control,
ThreadState perThreadState, final long currentBytesPerThread) {
control
.setFlushPending(findLargestNonPendingWriter(control, perThreadState));
control.setFlushPending(findLargestNonPendingWriter(control, perThreadState));
}
/**

View File

@ -113,16 +113,23 @@ abstract class FlushPolicy implements Cloneable {
ThreadState maxRamUsingThreadState = perThreadState;
assert !perThreadState.flushPending : "DWPT should have flushed";
Iterator<ThreadState> activePerThreadsIterator = control.allActiveThreadStates();
int count = 0;
while (activePerThreadsIterator.hasNext()) {
ThreadState next = activePerThreadsIterator.next();
if (!next.flushPending) {
final long nextRam = next.bytesUsed;
if (nextRam > maxRamSoFar && next.dwpt.getNumDocsInRAM() > 0) {
maxRamSoFar = nextRam;
maxRamUsingThreadState = next;
if (nextRam > 0 && next.dwpt.getNumDocsInRAM() > 0) {
count++;
if (nextRam > maxRamSoFar) {
maxRamSoFar = nextRam;
maxRamUsingThreadState = next;
}
}
}
}
if (infoStream.isEnabled("FP")) {
infoStream.message("FP", count + " in-use non-flushing threads states");
}
assert assertMessage("set largest ram consuming thread pending on lower watermark");
return maxRamUsingThreadState;
}