Skip to content

Apache Lucene open-source search software

LUCENE-3023: reenabled lost infostream output

Simon Willnauer7e91c2bbde06
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")