You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/09/05 16:47:02 UTC
svn commit: r1381207 - in /lucene/dev/trunk: ./ lucene/ lucene/core/
lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java
Author: mikemccand
Date: Wed Sep 5 14:47:01 2012
New Revision: 1381207
URL: http://svn.apache.org/viewvc?rev=1381207&view=rev
Log:
test: do our own rough RAM accounting
Modified:
lucene/dev/trunk/ (props changed)
lucene/dev/trunk/lucene/ (props changed)
lucene/dev/trunk/lucene/core/ (props changed)
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java?rev=1381207&r1=1381206&r2=1381207&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java Wed Sep 5 14:47:01 2012
@@ -45,7 +45,6 @@ import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.Constants;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util._TestUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -142,6 +141,9 @@ public class TestPostingsFormat extends
private static List<FieldAndTerm> allTerms;
+ private static long totalPostings;
+ private static long totalPayloadBytes;
+
@BeforeClass
public static void createPostings() throws IOException {
@@ -155,6 +157,8 @@ public class TestPostingsFormat extends
int numMediumTerms = 0;
int numBigTerms = 0;
int numManyPositions = 0;
+ totalPostings = 0;
+ totalPayloadBytes = 0;
while (fieldUpto < numFields) {
String field = _TestUtil.randomSimpleString(random());
if (fields.containsKey(field)) {
@@ -250,6 +254,7 @@ public class TestPostingsFormat extends
int pos = 0;
int offset = 0;
int posSpacing = _TestUtil.nextInt(random(), 1, 100);
+ totalPostings += freq;
for(int posUpto=0;posUpto<freq;posUpto++) {
if (posUpto == 0 && random().nextBoolean()) {
// Sometimes index pos = 0
@@ -275,6 +280,7 @@ public class TestPostingsFormat extends
if (position.payload != null) {
random().nextBytes(position.payload);
+ totalPayloadBytes += position.payload.length;
}
position.startOffset = offset + random().nextInt(5);
@@ -383,7 +389,7 @@ public class TestPostingsFormat extends
// Estimate that flushed segment size will be 25% of
// what we use in RAM:
- long bytes = RamUsageEstimator.sizeOf(fields)/4;
+ long bytes = totalPostings * 8 + totalPayloadBytes;
SegmentWriteState writeState = new SegmentWriteState(null, dir,
segmentInfo, newFieldInfos,