You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2016/01/24 17:53:42 UTC
[9/9] lucene-solr git commit: LUCENE-6745: fix IndexInput consumers
to not share an instance while cloning from another thread
LUCENE-6745: fix IndexInput consumers to not share an instance while cloning from another thread
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/74e5f1c6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/74e5f1c6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/74e5f1c6
Branch: refs/heads/master
Commit: 74e5f1c6ae45aad2bf2580e10e0712fe35ac0a0b
Parents: bc3e643
Author: Michael McCandless <ma...@mikemccandless.com>
Authored: Sun Jan 24 06:26:41 2016 -0500
Committer: Dawid Weiss <da...@carrotsearch.com>
Committed: Sun Jan 24 17:53:13 2016 +0100
----------------------------------------------------------------------
.../apache/lucene/codecs/memory/DirectDocValuesProducer.java | 4 +++-
.../apache/lucene/codecs/memory/MemoryDocValuesProducer.java | 7 ++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74e5f1c6/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectDocValuesProducer.java
----------------------------------------------------------------------
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectDocValuesProducer.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectDocValuesProducer.java
index 67c51a0..090f0b7 100644
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectDocValuesProducer.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectDocValuesProducer.java
@@ -278,7 +278,7 @@ class DirectDocValuesProducer extends DocValuesProducer {
@Override
public void checkIntegrity() throws IOException {
- CodecUtil.checksumEntireFile(data);
+ CodecUtil.checksumEntireFile(data.clone());
}
@Override
@@ -297,6 +297,7 @@ class DirectDocValuesProducer extends DocValuesProducer {
private NumericRawValues loadNumeric(NumericEntry entry) throws IOException {
NumericRawValues ret = new NumericRawValues();
+ IndexInput data = this.data.clone();
data.seek(entry.offset + entry.missingBytes);
switch (entry.byteWidth) {
case 1:
@@ -394,6 +395,7 @@ class DirectDocValuesProducer extends DocValuesProducer {
}
private BinaryRawValues loadBinary(BinaryEntry entry) throws IOException {
+ IndexInput data = this.data.clone();
data.seek(entry.offset);
final byte[] bytes = new byte[entry.numBytes];
data.readBytes(bytes, 0, entry.numBytes);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74e5f1c6/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesProducer.java
----------------------------------------------------------------------
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesProducer.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesProducer.java
index fe769a6..f0f776d 100644
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesProducer.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesProducer.java
@@ -308,7 +308,7 @@ class MemoryDocValuesProducer extends DocValuesProducer {
@Override
public void checkIntegrity() throws IOException {
- CodecUtil.checksumEntireFile(data);
+ CodecUtil.checksumEntireFile(data.clone());
}
@Override
@@ -323,6 +323,7 @@ class MemoryDocValuesProducer extends DocValuesProducer {
private NumericDocValues loadNumeric(FieldInfo field) throws IOException {
NumericEntry entry = numerics.get(field.name);
+ IndexInput data = this.data.clone();
data.seek(entry.offset + entry.missingBytes);
switch (entry.format) {
case TABLE_COMPRESSED:
@@ -438,6 +439,7 @@ class MemoryDocValuesProducer extends DocValuesProducer {
private BytesAndAddresses loadBinary(FieldInfo field) throws IOException {
BytesAndAddresses bytesAndAddresses = new BytesAndAddresses();
BinaryEntry entry = binaries.get(field.name);
+ IndexInput data = this.data.clone();
data.seek(entry.offset);
PagedBytes bytes = new PagedBytes(16);
bytes.copy(data, entry.numBytes);
@@ -465,6 +467,7 @@ class MemoryDocValuesProducer extends DocValuesProducer {
synchronized(this) {
instance = fstInstances.get(field.name);
if (instance == null) {
+ IndexInput data = this.data.clone();
data.seek(entry.offset);
instance = new FST<>(data, PositiveIntOutputs.getSingleton());
if (!merging) {
@@ -545,6 +548,7 @@ class MemoryDocValuesProducer extends DocValuesProducer {
synchronized (this) {
MonotonicBlockPackedReader res = addresses.get(field.name);
if (res == null) {
+ IndexInput data = this.data.clone();
data.seek(entry.addressOffset);
res = MonotonicBlockPackedReader.of(data, entry.packedIntsVersion, entry.blockSize, entry.valueCount, false);
if (!merging) {
@@ -617,6 +621,7 @@ class MemoryDocValuesProducer extends DocValuesProducer {
synchronized(this) {
instance = fstInstances.get(field.name);
if (instance == null) {
+ IndexInput data = this.data.clone();
data.seek(entry.offset);
instance = new FST<>(data, PositiveIntOutputs.getSingleton());
if (!merging) {