Skip to content

Apache Lucene open-source search software

fix infoStream formatting to always report double precision MB usage

Michael McCandlessfda2483fb668
diff --git a/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java b/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
index 2ef58357b4e..7461ce52fa9 100644
--- a/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
+++ b/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
@@ -592,7 +592,7 @@ final class DocumentsWriter {
threads.add(threadState.consumer);
}
- long startNumBytesUsed = bytesUsed();
+ double startMBUsed = bytesUsed()/1024./1024.;
consumer.flush(threads, flushState);
newSegment.setHasVectors(flushState.hasVectors);
@@ -622,13 +622,13 @@ final class DocumentsWriter {
if (infoStream != null) {
message("flush: segment=" + newSegment);
- final long newSegmentSizeNoStore = newSegment.sizeInBytes(false);
- final long newSegmentSize = newSegment.sizeInBytes(true);
- message(" ramUsed=" + nf.format(startNumBytesUsed / 1024. / 1024.) + " MB" +
- " newFlushedSize=" + nf.format(newSegmentSize / 1024 / 1024) + " MB" +
- " (" + nf.format(newSegmentSizeNoStore / 1024 / 1024) + " MB w/o doc stores)" +
- " docs/MB=" + nf.format(numDocs / (newSegmentSize / 1024. / 1024.)) +
- " new/old=" + nf.format(100.0 * newSegmentSizeNoStore / startNumBytesUsed) + "%");
+ final double newSegmentSizeNoStore = newSegment.sizeInBytes(false)/1024./1024.;
+ final double newSegmentSize = newSegment.sizeInBytes(true)/1024./1024.;
+ message(" ramUsed=" + nf.format(startMBUsed) + " MB" +
+ " newFlushedSize=" + nf.format(newSegmentSize) + " MB" +
+ " (" + nf.format(newSegmentSizeNoStore) + " MB w/o doc stores)" +
+ " docs/MB=" + nf.format(numDocs / newSegmentSize) +
+ " new/old=" + nf.format(100.0 * newSegmentSizeNoStore / startMBUsed) + "%");
}
success = true;