mirror of https://github.com/apache/lucene.git
Fixed file cleanup for unit tests
This commit is contained in:
parent
7312d91394
commit
359440a7dc
|
@ -456,8 +456,8 @@ public class DocIdEncodingBenchmark {
|
|||
|
||||
/**
|
||||
* We want to load all the docId sequences completely in memory to avoid including the time
|
||||
* spent in fetching from disk in every iteration unless we can consistently prove otherwise.
|
||||
* <br>
|
||||
* spent in fetching from disk or any other source in every iteration unless we can consistently
|
||||
* prove otherwise. <br>
|
||||
*
|
||||
* @param args : Data about the source of docId sequences depending on the underlying provider
|
||||
* like a file or randomly generated sequences given size.
|
||||
|
|
|
@ -36,7 +36,7 @@ public class TestDocIdEncoding extends LuceneTestCase {
|
|||
super.setUp();
|
||||
}
|
||||
|
||||
public void testBPV21AndAbove() {
|
||||
public void testBPV21AndAbove() throws IOException {
|
||||
|
||||
List<DocIdEncodingBenchmark.DocIdEncoder> encoders =
|
||||
DocIdEncodingBenchmark.DocIdEncoder.SingletonFactory.getAllExcept(Collections.emptyList());
|
||||
|
@ -46,9 +46,11 @@ public class TestDocIdEncoding extends LuceneTestCase {
|
|||
DocIdEncodingBenchmark.DocIdProvider docIdProvider =
|
||||
new DocIdEncodingBenchmark.FixedBPVRandomDocIdProvider();
|
||||
|
||||
Path tempDir = null;
|
||||
|
||||
try {
|
||||
|
||||
Path tempDir = Files.createTempDirectory("DocIdEncoding_testBPV21AndAbove_");
|
||||
tempDir = Files.createTempDirectory("DocIdEncoding_testBPV21AndAbove_");
|
||||
|
||||
for (DocIdEncodingBenchmark.DocIdEncoder encoder : encoders) {
|
||||
|
||||
|
@ -69,10 +71,14 @@ public class TestDocIdEncoding extends LuceneTestCase {
|
|||
encoder.decode(in, 0, sequence.length, scratch);
|
||||
assertArrayEquals(sequence, ArrayUtil.copyOfSubArray(scratch, 0, sequence.length));
|
||||
}
|
||||
} finally {
|
||||
Files.delete(tempDir.resolve(encoderFileName));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
if (tempDir != null) {
|
||||
Files.delete(tempDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ final class DocIdsWriter {
|
|||
private static final byte LEGACY_DELTA_VINT = (byte) 0;
|
||||
|
||||
private static final long BPV_21_MASK = 0x1FFFFFL;
|
||||
|
||||
private static final boolean IS_ARCH_64 = Constants.OS_ARCH.equals("aarch64");
|
||||
|
||||
private final int[] scratch;
|
||||
|
@ -312,8 +311,7 @@ final class DocIdsWriter {
|
|||
// over
|
||||
// org.apache.lucene.benchmark.jmh.DocIdEncodingBenchmark.DocIdEncoder.Bit21With2StepsEncoder
|
||||
// for decoding irrespective of architecture
|
||||
// due to it's better performance in benchmarks over nyc taxis, big5, http_logs and other
|
||||
// popular search workloads.
|
||||
// due to it's better performance in benchmarks like nyc taxis, big5, http_logs.
|
||||
for (; i < count - 8; i += 9) {
|
||||
long l1 = in.readLong();
|
||||
long l2 = in.readLong();
|
||||
|
|
Loading…
Reference in New Issue