From 7e91c2bbde069dc9a5222d718d3e737489181c25 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 28 Apr 2011 09:24:39 +0000 Subject: [PATCH] LUCENE-3023: reenabled lost infostream output git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/realtime_search@1097380 13f79535-47bb-0310-9956-ffa450edef68 --- .../index/DocumentsWriterPerThread.java | 23 +++++++++++-------- .../org/apache/lucene/index/Healthiness.java | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java b/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java index 65cdc2dc97d..4ffb1e0ccf7 100644 --- a/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java +++ b/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java @@ -168,6 +168,8 @@ public class DocumentsWriterPerThread { private int flushedDocCount; DocumentsWriterDeleteQueue deleteQueue; DeleteSlice deleteSlice; + private final NumberFormat nf = NumberFormat.getInstance(); + public DocumentsWriterPerThread(Directory directory, DocumentsWriter parent, FieldInfos fieldInfos, IndexingChain indexingChain) { @@ -348,7 +350,7 @@ public class DocumentsWriterPerThread { flushState = new SegmentWriteState(infoStream, directory, segment, fieldInfos, numDocsInRAM, writer.getConfig().getTermIndexInterval(), fieldInfos.buildSegmentCodecs(true), pendingDeletes); - + final double startMBUsed = parent.flushControl.netBytes() / 1024. / 1024.; // Apply delete-by-docID now (delete-byDocID only // happens when an exception is hit processing that // doc, eg if analyzer has some problem w/ the text): @@ -398,8 +400,17 @@ public class DocumentsWriterPerThread { pendingDeletes = new BufferedDeletes(false); } + if (infoStream != null) { + final double newSegmentSizeNoStore = newSegment.sizeInBytes(false)/1024./1024.; + final double newSegmentSize = newSegment.sizeInBytes(true)/1024./1024.; + message("flushed: segment=" + newSegment + + " ramUsed=" + nf.format(startMBUsed) + " MB" + + " newFlushedSize=" + nf.format(newSegmentSize) + " MB" + + " (" + nf.format(newSegmentSizeNoStore) + " MB w/o doc stores)" + + " docs/MB=" + nf.format(flushedDocCount / newSegmentSize) + + " new/old=" + nf.format(100.0 * newSegmentSizeNoStore / startMBUsed) + "%"); + } doAfterFlush(); - success = true; return new FlushedSegment(newSegment, segmentDeletes, flushState.deletedDocs); @@ -429,11 +440,9 @@ public class DocumentsWriterPerThread { } void message(String message) { - writer.message("DW: " + message); + writer.message("DWPT: " + message); } - NumberFormat nf = NumberFormat.getInstance(); - /* Initial chunks size of the shared byte[] blocks used to store postings data */ final static int BYTE_BLOCK_NOT_MASK = ~BYTE_BLOCK_MASK; @@ -484,8 +493,4 @@ public class DocumentsWriterPerThread { } }; - - String toMB(long v) { - return nf.format(v/1024./1024.); - } } diff --git a/lucene/src/java/org/apache/lucene/index/Healthiness.java b/lucene/src/java/org/apache/lucene/index/Healthiness.java index c302dbb76d8..dcb9868ab0d 100644 --- a/lucene/src/java/org/apache/lucene/index/Healthiness.java +++ b/lucene/src/java/org/apache/lucene/index/Healthiness.java @@ -35,6 +35,7 @@ import org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState; * than the number of active {@link ThreadState}s threads are released and can * continue indexing. */ +//TODO: rename this to DocumentsWriterStallControl (or something like that)? final class Healthiness { @SuppressWarnings("serial")