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
This commit is contained in:
Simon Willnauer 2011-04-28 09:24:39 +00:00
parent b94b44bf14
commit 7e91c2bbde
2 changed files with 15 additions and 9 deletions

View File

@ -168,6 +168,8 @@ public class DocumentsWriterPerThread {
private int flushedDocCount; private int flushedDocCount;
DocumentsWriterDeleteQueue deleteQueue; DocumentsWriterDeleteQueue deleteQueue;
DeleteSlice deleteSlice; DeleteSlice deleteSlice;
private final NumberFormat nf = NumberFormat.getInstance();
public DocumentsWriterPerThread(Directory directory, DocumentsWriter parent, public DocumentsWriterPerThread(Directory directory, DocumentsWriter parent,
FieldInfos fieldInfos, IndexingChain indexingChain) { FieldInfos fieldInfos, IndexingChain indexingChain) {
@ -348,7 +350,7 @@ public class DocumentsWriterPerThread {
flushState = new SegmentWriteState(infoStream, directory, segment, fieldInfos, flushState = new SegmentWriteState(infoStream, directory, segment, fieldInfos,
numDocsInRAM, writer.getConfig().getTermIndexInterval(), numDocsInRAM, writer.getConfig().getTermIndexInterval(),
fieldInfos.buildSegmentCodecs(true), pendingDeletes); fieldInfos.buildSegmentCodecs(true), pendingDeletes);
final double startMBUsed = parent.flushControl.netBytes() / 1024. / 1024.;
// Apply delete-by-docID now (delete-byDocID only // Apply delete-by-docID now (delete-byDocID only
// happens when an exception is hit processing that // happens when an exception is hit processing that
// doc, eg if analyzer has some problem w/ the text): // doc, eg if analyzer has some problem w/ the text):
@ -398,8 +400,17 @@ public class DocumentsWriterPerThread {
pendingDeletes = new BufferedDeletes(false); 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(); doAfterFlush();
success = true; success = true;
return new FlushedSegment(newSegment, segmentDeletes, flushState.deletedDocs); return new FlushedSegment(newSegment, segmentDeletes, flushState.deletedDocs);
@ -429,11 +440,9 @@ public class DocumentsWriterPerThread {
} }
void message(String message) { 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 /* Initial chunks size of the shared byte[] blocks used to
store postings data */ store postings data */
final static int BYTE_BLOCK_NOT_MASK = ~BYTE_BLOCK_MASK; 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.);
}
} }

View File

@ -35,6 +35,7 @@ import org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState;
* than the number of active {@link ThreadState}s threads are released and can * than the number of active {@link ThreadState}s threads are released and can
* continue indexing. * continue indexing.
*/ */
//TODO: rename this to DocumentsWriterStallControl (or something like that)?
final class Healthiness { final class Healthiness {
@SuppressWarnings("serial") @SuppressWarnings("serial")