You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2014/02/13 16:54:48 UTC
svn commit: r1567960 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/CHANGES.txt lucene/core/
lucene/core/src/java/org/apache/lucene/codecs/lucene45/Lucene45DocValuesProducer.java
Author: shaie
Date: Thu Feb 13 15:54:48 2014
New Revision: 1567960
URL: http://svn.apache.org/r1567960
Log:
LUCENE-5443: DocValuesProducer.ramBytesUsed throws ConcurrentModificationException
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene45/Lucene45DocValuesProducer.java
Modified: lucene/dev/branches/branch_4x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/CHANGES.txt?rev=1567960&r1=1567959&r2=1567960&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/CHANGES.txt Thu Feb 13 15:54:48 2014
@@ -198,6 +198,9 @@ Bug fixes
loop. ReferenceManager now throws IllegalStateException if currently managed
resources ref count is 0. (Simon Willnauer)
+* LUCENE-5443: Lucene45DocValuesProducer.ramBytesUsed() may throw
+ ConcurrentModificationException. (Shai Erera, Simon Willnauer)
+
API Changes
* LUCENE-5339: The facet module was simplified/reworked to make the
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene45/Lucene45DocValuesProducer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene45/Lucene45DocValuesProducer.java?rev=1567960&r1=1567959&r2=1567960&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene45/Lucene45DocValuesProducer.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/lucene45/Lucene45DocValuesProducer.java Thu Feb 13 15:54:48 2014
@@ -32,6 +32,7 @@ import java.io.IOException;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.DocValuesProducer;
@@ -54,6 +55,7 @@ import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LongValues;
+import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.packed.BlockPackedReader;
import org.apache.lucene.util.packed.MonotonicBlockPackedReader;
import org.apache.lucene.util.packed.PackedInts;
@@ -65,6 +67,7 @@ public class Lucene45DocValuesProducer e
private final Map<Integer,SortedSetEntry> sortedSets;
private final Map<Integer,NumericEntry> ords;
private final Map<Integer,NumericEntry> ordIndexes;
+ private final AtomicLong ramBytesUsed;
private final IndexInput data;
private final int maxDoc;
private final int version;
@@ -117,6 +120,8 @@ public class Lucene45DocValuesProducer e
IOUtils.closeWhileHandlingException(this.data);
}
}
+
+ ramBytesUsed = new AtomicLong(RamUsageEstimator.shallowSizeOfInstance(getClass()));
}
private void readSortedField(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
@@ -287,14 +292,7 @@ public class Lucene45DocValuesProducer e
@Override
public long ramBytesUsed() {
- long sizeInBytes = 0;
- for(MonotonicBlockPackedReader monotonicBlockPackedReader: addressInstances.values()) {
- sizeInBytes += Integer.SIZE + monotonicBlockPackedReader.ramBytesUsed();
- }
- for(MonotonicBlockPackedReader monotonicBlockPackedReader: ordIndexInstances.values()) {
- sizeInBytes += Integer.SIZE + monotonicBlockPackedReader.ramBytesUsed();
- }
- return sizeInBytes;
+ return ramBytesUsed.get();
}
LongValues getNumeric(NumericEntry entry) throws IOException {
@@ -378,6 +376,7 @@ public class Lucene45DocValuesProducer e
data.seek(bytes.addressesOffset);
addrInstance = new MonotonicBlockPackedReader(data, bytes.packedIntsVersion, bytes.blockSize, bytes.count, false);
addressInstances.put(field.number, addrInstance);
+ ramBytesUsed.addAndGet(addrInstance.ramBytesUsed() + RamUsageEstimator.NUM_BYTES_INT);
}
addresses = addrInstance;
}
@@ -428,6 +427,7 @@ public class Lucene45DocValuesProducer e
}
addrInstance = new MonotonicBlockPackedReader(data, bytes.packedIntsVersion, bytes.blockSize, size, false);
addressInstances.put(field.number, addrInstance);
+ ramBytesUsed.addAndGet(addrInstance.ramBytesUsed() + RamUsageEstimator.NUM_BYTES_INT);
}
addresses = addrInstance;
}
@@ -499,6 +499,7 @@ public class Lucene45DocValuesProducer e
data.seek(entry.offset);
ordIndexInstance = new MonotonicBlockPackedReader(data, entry.packedIntsVersion, entry.blockSize, entry.count, false);
ordIndexInstances.put(field.number, ordIndexInstance);
+ ramBytesUsed.addAndGet(ordIndexInstance.ramBytesUsed() + RamUsageEstimator.NUM_BYTES_INT);
}
ordIndex = ordIndexInstance;
}