mirror of https://github.com/apache/lucene.git
Introduce IORunnable to fix test failure TestIndexWriterOnDiskFull.testAddIndexOnDiskFull (#13172)
This commit is contained in:
parent
e3a34bfe56
commit
6ee19c022c
|
@ -33,6 +33,7 @@ import org.apache.lucene.index.PointValues.IntersectVisitor;
|
||||||
import org.apache.lucene.index.PointValues.Relation;
|
import org.apache.lucene.index.PointValues.Relation;
|
||||||
import org.apache.lucene.index.SegmentWriteState;
|
import org.apache.lucene.index.SegmentWriteState;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
|
import org.apache.lucene.util.IORunnable;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.bkd.BKDConfig;
|
import org.apache.lucene.util.bkd.BKDConfig;
|
||||||
import org.apache.lucene.util.bkd.BKDWriter;
|
import org.apache.lucene.util.bkd.BKDWriter;
|
||||||
|
@ -143,7 +144,7 @@ public class Lucene86PointsWriter extends PointsWriter {
|
||||||
values.size())) {
|
values.size())) {
|
||||||
|
|
||||||
if (values instanceof MutablePointTree) {
|
if (values instanceof MutablePointTree) {
|
||||||
Runnable finalizer =
|
IORunnable finalizer =
|
||||||
writer.writeField(
|
writer.writeField(
|
||||||
metaOut, indexOut, dataOut, fieldInfo.name, (MutablePointTree) values);
|
metaOut, indexOut, dataOut, fieldInfo.name, (MutablePointTree) values);
|
||||||
if (finalizer != null) {
|
if (finalizer != null) {
|
||||||
|
@ -172,7 +173,7 @@ public class Lucene86PointsWriter extends PointsWriter {
|
||||||
});
|
});
|
||||||
|
|
||||||
// We could have 0 points on merge since all docs with dimensional fields may be deleted:
|
// We could have 0 points on merge since all docs with dimensional fields may be deleted:
|
||||||
Runnable finalizer = writer.finish(metaOut, indexOut, dataOut);
|
IORunnable finalizer = writer.finish(metaOut, indexOut, dataOut);
|
||||||
if (finalizer != null) {
|
if (finalizer != null) {
|
||||||
metaOut.writeInt(fieldInfo.number);
|
metaOut.writeInt(fieldInfo.number);
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
|
@ -267,7 +268,7 @@ public class Lucene86PointsWriter extends PointsWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Runnable finalizer = writer.merge(metaOut, indexOut, dataOut, docMaps, pointValues);
|
IORunnable finalizer = writer.merge(metaOut, indexOut, dataOut, docMaps, pointValues);
|
||||||
if (finalizer != null) {
|
if (finalizer != null) {
|
||||||
metaOut.writeInt(fieldInfo.number);
|
metaOut.writeInt(fieldInfo.number);
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.lucene.index.PointValues.IntersectVisitor;
|
||||||
import org.apache.lucene.index.PointValues.Relation;
|
import org.apache.lucene.index.PointValues.Relation;
|
||||||
import org.apache.lucene.index.SegmentWriteState;
|
import org.apache.lucene.index.SegmentWriteState;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
|
import org.apache.lucene.util.IORunnable;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.bkd.BKDConfig;
|
import org.apache.lucene.util.bkd.BKDConfig;
|
||||||
import org.apache.lucene.util.bkd.BKDWriter;
|
import org.apache.lucene.util.bkd.BKDWriter;
|
||||||
|
@ -137,7 +138,7 @@ public class Lucene90PointsWriter extends PointsWriter {
|
||||||
values.size())) {
|
values.size())) {
|
||||||
|
|
||||||
if (values instanceof MutablePointTree) {
|
if (values instanceof MutablePointTree) {
|
||||||
Runnable finalizer =
|
IORunnable finalizer =
|
||||||
writer.writeField(
|
writer.writeField(
|
||||||
metaOut, indexOut, dataOut, fieldInfo.name, (MutablePointTree) values);
|
metaOut, indexOut, dataOut, fieldInfo.name, (MutablePointTree) values);
|
||||||
if (finalizer != null) {
|
if (finalizer != null) {
|
||||||
|
@ -166,7 +167,7 @@ public class Lucene90PointsWriter extends PointsWriter {
|
||||||
});
|
});
|
||||||
|
|
||||||
// We could have 0 points on merge since all docs with dimensional fields may be deleted:
|
// We could have 0 points on merge since all docs with dimensional fields may be deleted:
|
||||||
Runnable finalizer = writer.finish(metaOut, indexOut, dataOut);
|
IORunnable finalizer = writer.finish(metaOut, indexOut, dataOut);
|
||||||
if (finalizer != null) {
|
if (finalizer != null) {
|
||||||
metaOut.writeInt(fieldInfo.number);
|
metaOut.writeInt(fieldInfo.number);
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
|
@ -261,7 +262,7 @@ public class Lucene90PointsWriter extends PointsWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Runnable finalizer = writer.merge(metaOut, indexOut, dataOut, docMaps, pointValues);
|
IORunnable finalizer = writer.merge(metaOut, indexOut, dataOut, docMaps, pointValues);
|
||||||
if (finalizer != null) {
|
if (finalizer != null) {
|
||||||
metaOut.writeInt(fieldInfo.number);
|
metaOut.writeInt(fieldInfo.number);
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.lucene.util;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Runnable that may throw an IOException
|
||||||
|
*
|
||||||
|
* @see java.lang.Runnable
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IORunnable {
|
||||||
|
public abstract void run() throws IOException;
|
||||||
|
}
|
|
@ -18,7 +18,6 @@ package org.apache.lucene.util.bkd;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UncheckedIOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -40,6 +39,7 @@ import org.apache.lucene.util.ArrayUtil.ByteArrayComparator;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.BytesRefBuilder;
|
import org.apache.lucene.util.BytesRefBuilder;
|
||||||
import org.apache.lucene.util.FixedBitSet;
|
import org.apache.lucene.util.FixedBitSet;
|
||||||
|
import org.apache.lucene.util.IORunnable;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.NumericUtils;
|
import org.apache.lucene.util.NumericUtils;
|
||||||
import org.apache.lucene.util.PriorityQueue;
|
import org.apache.lucene.util.PriorityQueue;
|
||||||
|
@ -423,7 +423,7 @@ public class BKDWriter implements Closeable {
|
||||||
* before writing them to disk. This method does not use transient disk in order to reorder
|
* before writing them to disk. This method does not use transient disk in order to reorder
|
||||||
* points.
|
* points.
|
||||||
*/
|
*/
|
||||||
public Runnable writeField(
|
public IORunnable writeField(
|
||||||
IndexOutput metaOut,
|
IndexOutput metaOut,
|
||||||
IndexOutput indexOut,
|
IndexOutput indexOut,
|
||||||
IndexOutput dataOut,
|
IndexOutput dataOut,
|
||||||
|
@ -492,7 +492,7 @@ public class BKDWriter implements Closeable {
|
||||||
|
|
||||||
/* In the 2+D case, we recursively pick the split dimension, compute the
|
/* In the 2+D case, we recursively pick the split dimension, compute the
|
||||||
* median value and partition other values around it. */
|
* median value and partition other values around it. */
|
||||||
private Runnable writeFieldNDims(
|
private IORunnable writeFieldNDims(
|
||||||
IndexOutput metaOut,
|
IndexOutput metaOut,
|
||||||
IndexOutput indexOut,
|
IndexOutput indexOut,
|
||||||
IndexOutput dataOut,
|
IndexOutput dataOut,
|
||||||
|
@ -556,7 +556,7 @@ public class BKDWriter implements Closeable {
|
||||||
|
|
||||||
/* In the 1D case, we can simply sort points in ascending order and use the
|
/* In the 1D case, we can simply sort points in ascending order and use the
|
||||||
* same writing logic as we use at merge time. */
|
* same writing logic as we use at merge time. */
|
||||||
private Runnable writeField1Dim(
|
private IORunnable writeField1Dim(
|
||||||
IndexOutput metaOut,
|
IndexOutput metaOut,
|
||||||
IndexOutput indexOut,
|
IndexOutput indexOut,
|
||||||
IndexOutput dataOut,
|
IndexOutput dataOut,
|
||||||
|
@ -595,7 +595,7 @@ public class BKDWriter implements Closeable {
|
||||||
* already sorted values and currently only works when numDims==1. This returns -1 if all
|
* already sorted values and currently only works when numDims==1. This returns -1 if all
|
||||||
* documents containing dimensional values were deleted.
|
* documents containing dimensional values were deleted.
|
||||||
*/
|
*/
|
||||||
public Runnable merge(
|
public IORunnable merge(
|
||||||
IndexOutput metaOut,
|
IndexOutput metaOut,
|
||||||
IndexOutput indexOut,
|
IndexOutput indexOut,
|
||||||
IndexOutput dataOut,
|
IndexOutput dataOut,
|
||||||
|
@ -723,7 +723,7 @@ public class BKDWriter implements Closeable {
|
||||||
assert (lastDocID = docID) >= 0; // only assign when asserts are enabled
|
assert (lastDocID = docID) >= 0; // only assign when asserts are enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
public Runnable finish() throws IOException {
|
public IORunnable finish() throws IOException {
|
||||||
if (leafCount > 0) {
|
if (leafCount > 0) {
|
||||||
writeLeafBlock(leafCardinality);
|
writeLeafBlock(leafCardinality);
|
||||||
leafCardinality = 0;
|
leafCardinality = 0;
|
||||||
|
@ -763,11 +763,7 @@ public class BKDWriter implements Closeable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return () -> {
|
return () -> {
|
||||||
try {
|
writeIndex(metaOut, indexOut, config.maxPointsInLeafNode, leafNodes, dataStartFP);
|
||||||
writeIndex(metaOut, indexOut, config.maxPointsInLeafNode, leafNodes, dataStartFP);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new UncheckedIOException(e);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,7 +875,7 @@ public class BKDWriter implements Closeable {
|
||||||
* Writes the BKD tree to the provided {@link IndexOutput}s and returns a {@link Runnable} that
|
* Writes the BKD tree to the provided {@link IndexOutput}s and returns a {@link Runnable} that
|
||||||
* writes the index of the tree if at least one point has been added, or {@code null} otherwise.
|
* writes the index of the tree if at least one point has been added, or {@code null} otherwise.
|
||||||
*/
|
*/
|
||||||
public Runnable finish(IndexOutput metaOut, IndexOutput indexOut, IndexOutput dataOut)
|
public IORunnable finish(IndexOutput metaOut, IndexOutput indexOut, IndexOutput dataOut)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// System.out.println("\nBKDTreeWriter.finish pointCount=" + pointCount + " out=" + out + "
|
// System.out.println("\nBKDTreeWriter.finish pointCount=" + pointCount + " out=" + out + "
|
||||||
// heapWriter=" + heapPointWriter);
|
// heapWriter=" + heapPointWriter);
|
||||||
|
@ -974,7 +970,7 @@ public class BKDWriter implements Closeable {
|
||||||
return makeWriter(metaOut, indexOut, splitDimensionValues, leafBlockFPs, dataStartFP);
|
return makeWriter(metaOut, indexOut, splitDimensionValues, leafBlockFPs, dataStartFP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Runnable makeWriter(
|
private IORunnable makeWriter(
|
||||||
IndexOutput metaOut,
|
IndexOutput metaOut,
|
||||||
IndexOutput indexOut,
|
IndexOutput indexOut,
|
||||||
byte[] splitDimensionValues,
|
byte[] splitDimensionValues,
|
||||||
|
@ -1006,11 +1002,7 @@ public class BKDWriter implements Closeable {
|
||||||
|
|
||||||
return () -> {
|
return () -> {
|
||||||
// Write index:
|
// Write index:
|
||||||
try {
|
writeIndex(metaOut, indexOut, config.maxPointsInLeafNode, leafNodes, dataStartFP);
|
||||||
writeIndex(metaOut, indexOut, config.maxPointsInLeafNode, leafNodes, dataStartFP);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new UncheckedIOException(e);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.lucene.store.IndexInput;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
import org.apache.lucene.tests.util.LuceneTestCase;
|
import org.apache.lucene.tests.util.LuceneTestCase;
|
||||||
import org.apache.lucene.tests.util.LuceneTestCase.Monster;
|
import org.apache.lucene.tests.util.LuceneTestCase.Monster;
|
||||||
|
import org.apache.lucene.util.IORunnable;
|
||||||
import org.apache.lucene.util.NumericUtils;
|
import org.apache.lucene.util.NumericUtils;
|
||||||
|
|
||||||
// e.g. run like this: ant test -Dtestcase=Test4BBKDPoints -Dtests.nightly=true -Dtests.verbose=true
|
// e.g. run like this: ant test -Dtestcase=Test4BBKDPoints -Dtests.nightly=true -Dtests.verbose=true
|
||||||
|
@ -66,7 +67,7 @@ public class Test4BBKDPoints extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IndexOutput out = dir.createOutput("1d.bkd", IOContext.DEFAULT);
|
IndexOutput out = dir.createOutput("1d.bkd", IOContext.DEFAULT);
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
long indexFP = out.getFilePointer();
|
long indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -115,7 +116,7 @@ public class Test4BBKDPoints extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IndexOutput out = dir.createOutput("2d.bkd", IOContext.DEFAULT);
|
IndexOutput out = dir.createOutput("2d.bkd", IOContext.DEFAULT);
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
long indexFP = out.getFilePointer();
|
long indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
out.close();
|
out.close();
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.apache.lucene.tests.store.MockDirectoryWrapper;
|
||||||
import org.apache.lucene.tests.util.LuceneTestCase;
|
import org.apache.lucene.tests.util.LuceneTestCase;
|
||||||
import org.apache.lucene.tests.util.TestUtil;
|
import org.apache.lucene.tests.util.TestUtil;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
import org.apache.lucene.util.IORunnable;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.NumericUtils;
|
import org.apache.lucene.util.NumericUtils;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
|
|
||||||
long indexFP;
|
long indexFP;
|
||||||
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
indexFP = out.getFilePointer();
|
indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +134,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
|
|
||||||
long indexFP;
|
long indexFP;
|
||||||
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
indexFP = out.getFilePointer();
|
indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
}
|
}
|
||||||
|
@ -228,7 +229,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
|
|
||||||
long indexFP;
|
long indexFP;
|
||||||
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
indexFP = out.getFilePointer();
|
indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
}
|
}
|
||||||
|
@ -735,7 +736,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
final int curDocIDBase = lastDocIDBase;
|
final int curDocIDBase = lastDocIDBase;
|
||||||
docMaps.add(docID1 -> curDocIDBase + docID1);
|
docMaps.add(docID1 -> curDocIDBase + docID1);
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
toMerge.add(out.getFilePointer());
|
toMerge.add(out.getFilePointer());
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
valuesInThisSeg = TestUtil.nextInt(random(), numValues / 10, numValues / 2);
|
valuesInThisSeg = TestUtil.nextInt(random(), numValues / 10, numValues / 2);
|
||||||
|
@ -760,7 +761,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
|
|
||||||
if (toMerge != null) {
|
if (toMerge != null) {
|
||||||
if (segCount > 0) {
|
if (segCount > 0) {
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
toMerge.add(out.getFilePointer());
|
toMerge.add(out.getFilePointer());
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
final int curDocIDBase = lastDocIDBase;
|
final int curDocIDBase = lastDocIDBase;
|
||||||
|
@ -783,14 +784,14 @@ public class TestBKD extends LuceneTestCase {
|
||||||
readers.add(getPointValues(in));
|
readers.add(getPointValues(in));
|
||||||
}
|
}
|
||||||
out = dir.createOutput("bkd2", IOContext.DEFAULT);
|
out = dir.createOutput("bkd2", IOContext.DEFAULT);
|
||||||
Runnable finalizer = w.merge(out, out, out, docMaps, readers);
|
IORunnable finalizer = w.merge(out, out, out, docMaps, readers);
|
||||||
indexFP = out.getFilePointer();
|
indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
out.close();
|
out.close();
|
||||||
in.close();
|
in.close();
|
||||||
in = dir.openInput("bkd2", IOContext.DEFAULT);
|
in = dir.openInput("bkd2", IOContext.DEFAULT);
|
||||||
} else {
|
} else {
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
indexFP = out.getFilePointer();
|
indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -1204,7 +1205,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT);
|
IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT);
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
long fp = out.getFilePointer();
|
long fp = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -1270,7 +1271,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
final long indexFP;
|
final long indexFP;
|
||||||
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
indexFP = out.getFilePointer();
|
indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
w.close();
|
w.close();
|
||||||
|
@ -1332,7 +1333,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT);
|
IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT);
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
long fp = out.getFilePointer();
|
long fp = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -1399,7 +1400,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT);
|
IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT);
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
long fp = out.getFilePointer();
|
long fp = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -1467,7 +1468,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
final long indexFP;
|
final long indexFP;
|
||||||
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
try (IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT)) {
|
||||||
Runnable finalizer = w.finish(out, out, out);
|
IORunnable finalizer = w.finish(out, out, out);
|
||||||
indexFP = out.getFilePointer();
|
indexFP = out.getFilePointer();
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
w.close();
|
w.close();
|
||||||
|
|
|
@ -53,6 +53,7 @@ import org.apache.lucene.tests.codecs.bloom.TestBloomFilteredLucenePostings;
|
||||||
import org.apache.lucene.tests.codecs.mockrandom.MockRandomPostingsFormat;
|
import org.apache.lucene.tests.codecs.mockrandom.MockRandomPostingsFormat;
|
||||||
import org.apache.lucene.tests.util.LuceneTestCase;
|
import org.apache.lucene.tests.util.LuceneTestCase;
|
||||||
import org.apache.lucene.tests.util.TestUtil;
|
import org.apache.lucene.tests.util.TestUtil;
|
||||||
|
import org.apache.lucene.util.IORunnable;
|
||||||
import org.apache.lucene.util.bkd.BKDConfig;
|
import org.apache.lucene.util.bkd.BKDConfig;
|
||||||
import org.apache.lucene.util.bkd.BKDWriter;
|
import org.apache.lucene.util.bkd.BKDWriter;
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ public class RandomCodec extends AssertingCodec {
|
||||||
|
|
||||||
// We could have 0 points on merge since all docs with dimensional fields may be
|
// We could have 0 points on merge since all docs with dimensional fields may be
|
||||||
// deleted:
|
// deleted:
|
||||||
Runnable finalizer = writer.finish(metaOut, indexOut, dataOut);
|
IORunnable finalizer = writer.finish(metaOut, indexOut, dataOut);
|
||||||
if (finalizer != null) {
|
if (finalizer != null) {
|
||||||
metaOut.writeInt(fieldInfo.number);
|
metaOut.writeInt(fieldInfo.number);
|
||||||
finalizer.run();
|
finalizer.run();
|
||||||
|
|
Loading…
Reference in New Issue