From 9f9c2f74b3adb380ca26ab054e3bbbb1161c3074 Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Sat, 26 Mar 2016 06:25:53 -0400 Subject: [PATCH] the scratch BytesRef must be private to each offline reader --- lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java b/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java index e075cedbfc2..33f72e4e9e1 100644 --- a/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java +++ b/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java @@ -735,8 +735,6 @@ public class BKDWriter implements Closeable { // TODO: this is sort of sneaky way to get the final OfflinePointWriter from OfflineSorter: IndexOutput[] lastWriter = new IndexOutput[1]; - final BytesRef scratch = new BytesRef(new byte[bytesPerDoc]); - OfflineSorter sorter = new OfflineSorter(tempDir, tempFileNamePrefix + "_bkd" + dim, cmp, OfflineSorter.BufferSize.megabytes(Math.max(1, (long) maxMBSortInHeap)), OfflineSorter.MAX_TEMPFILES) { /** We write/read fixed-byte-width file that {@link OfflinePointReader} can read. */ @@ -756,6 +754,7 @@ public class BKDWriter implements Closeable { @Override protected ByteSequencesReader getReader(ChecksumIndexInput in, String name) throws IOException { return new ByteSequencesReader(in, name) { + final BytesRef scratch = new BytesRef(new byte[bytesPerDoc]); @Override public BytesRef next() throws IOException { if (in.getFilePointer() >= end) {