You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by so...@apache.org on 2025/11/26 19:10:03 UTC
(lucene) branch main updated: Revert "Speed up slow LegacyBaseDocValuesFormatTestCase tests (fixes #1544) (#15448)"
This is an automated email from the ASF dual-hosted git repository.
sokolov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new c6856c871b9 Revert "Speed up slow LegacyBaseDocValuesFormatTestCase tests (fixes #1544) (#15448)"
c6856c871b9 is described below
commit c6856c871b9eb510948408c0e5e0e7424a40adcf
Author: Michael Sokolov <so...@amazon.com>
AuthorDate: Wed Nov 26 14:09:50 2025 -0500
Revert "Speed up slow LegacyBaseDocValuesFormatTestCase tests (fixes #1544) (#15448)"
This reverts commit a7270d59c586e6845a0e4810bf0fc3a073c5e497.
---
.../BaseLucene80DocValuesFormatTestCase.java | 35 ++++++----------------
.../lucene90/TestLucene90DocValuesFormat.java | 4 +--
.../index/LegacyBaseDocValuesFormatTestCase.java | 14 ++-------
3 files changed, 13 insertions(+), 40 deletions(-)
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/BaseLucene80DocValuesFormatTestCase.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/BaseLucene80DocValuesFormatTestCase.java
index 312623f8a1b..376b72d79a0 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/BaseLucene80DocValuesFormatTestCase.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene80/BaseLucene80DocValuesFormatTestCase.java
@@ -66,7 +66,6 @@ import org.apache.lucene.tests.analysis.MockAnalyzer;
import org.apache.lucene.tests.codecs.asserting.AssertingCodec;
import org.apache.lucene.tests.index.LegacyBaseDocValuesFormatTestCase;
import org.apache.lucene.tests.index.RandomIndexWriter;
-import org.apache.lucene.tests.store.BaseDirectoryWrapper;
import org.apache.lucene.tests.util.TestUtil;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder;
@@ -658,11 +657,11 @@ public abstract class BaseLucene80DocValuesFormatTestCase
@Nightly
public void testNumericFieldJumpTables() throws Exception {
// IndexedDISI block skipping only activated if target >= current+2, so we need at least 5
- // blocks to trigger consecutive block skips
+ // blocks to
+ // trigger consecutive block skips
final int maxDoc = atLeast(5 * 65536);
- long start = System.nanoTime();
- BaseDirectoryWrapper dir = newDirectory();
- dir.setCheckIndexOnClose(false);
+
+ Directory dir = newDirectory();
IndexWriter iw = createFastIndexWriter(dir, maxDoc);
Field idField = newStringField("id", "", Field.Store.NO);
@@ -686,20 +685,11 @@ public abstract class BaseLucene80DocValuesFormatTestCase
iw.forceMerge(1, true); // Single segment to force large enough structures
iw.commit();
iw.close();
- if (VERBOSE) {
- System.out.println("index created " + (System.nanoTime() - start) / 1e9 + " s");
- }
- start = System.nanoTime();
- assertDVIterate(dir, 16);
- if (VERBOSE) {
- System.out.println("assertDVIterate " + (System.nanoTime() - start) / 1e9 + " s");
- }
- start = System.nanoTime();
+
+ assertDVIterate(dir);
assertDVAdvance(
dir, rarely() ? 1 : 7); // 1 is heavy (~20 s), so we do it rarely. 7 is a lot faster (8 s)
- if (VERBOSE) {
- System.out.println("assertDVAdvance " + (System.nanoTime() - start) / 1e9 + " s");
- }
+
dir.close();
}
@@ -833,7 +823,7 @@ public abstract class BaseLucene80DocValuesFormatTestCase
writer.close();
// compare
- assertDVIterate(dir, 1);
+ assertDVIterate(dir);
assertDVAdvance(
dir, 1); // Tests all jump-lengths from 1 to maxDoc (quite slow ~= 1 minute for 200K docs)
@@ -848,7 +838,7 @@ public abstract class BaseLucene80DocValuesFormatTestCase
LeafReader r = context.reader();
StoredFields storedFields = r.storedFields();
- for (int jump = jumpStep; jump < r.maxDoc(); jump += jumpStep * random().nextInt(1, 10)) {
+ for (int jump = jumpStep; jump < r.maxDoc(); jump += jumpStep) {
// Create a new instance each time to ensure jumps from the beginning
NumericDocValues docValues = DocValues.getNumeric(r, "dv");
for (int docID = 0; docID < r.maxDoc(); docID += jump) {
@@ -871,13 +861,6 @@ public abstract class BaseLucene80DocValuesFormatTestCase
Long.parseLong(storedValue),
docValues.longValue());
}
- if (random().nextInt(10) == 3) {
- // sometimes skip more
- int skip = (r.maxDoc() - docID) / 3;
- if (skip > 0) {
- docID += random().nextInt(skip);
- }
- }
}
}
}
diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90DocValuesFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90DocValuesFormat.java
index ea51b30b3da..489ee868139 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90DocValuesFormat.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90DocValuesFormat.java
@@ -601,7 +601,7 @@ public class TestLucene90DocValuesFormat extends BaseCompressingDocValuesFormatT
iw.commit();
iw.close();
- assertDVIterate(dir, 4);
+ assertDVIterate(dir);
assertDVAdvance(
dir, rarely() ? 1 : 7); // 1 is heavy (~20 s), so we do it rarely. 7 is a lot faster (8 s)
@@ -740,7 +740,7 @@ public class TestLucene90DocValuesFormat extends BaseCompressingDocValuesFormatT
writer.close();
// compare
- assertDVIterate(dir, 4);
+ assertDVIterate(dir);
assertDVAdvance(
dir, 1); // Tests all jump-lengths from 1 to maxDoc (quite slow ~= 1 minute for 200K docs)
diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/LegacyBaseDocValuesFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/LegacyBaseDocValuesFormatTestCase.java
index 2c15fa0f558..78e36dcd1fc 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/LegacyBaseDocValuesFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/LegacyBaseDocValuesFormatTestCase.java
@@ -1386,13 +1386,12 @@ public abstract class LegacyBaseDocValuesFormatTestCase extends BaseIndexFileFor
writer.close();
// compare
- int skip = minDocs < 1000 ? 0 : minDocs < 10000 ? 1 : 2;
- assertDVIterate(dir, skip);
+ assertDVIterate(dir);
dir.close();
}
// Asserts equality of stored value vs. DocValue by iterating DocValues one at a time
- protected void assertDVIterate(Directory dir, int skip) throws IOException {
+ protected void assertDVIterate(Directory dir) throws IOException {
DirectoryReader ir = maybeWrapWithMergingReader(DirectoryReader.open(dir));
TestUtil.checkReader(ir);
for (LeafReaderContext context : ir.leaves()) {
@@ -1409,15 +1408,6 @@ public abstract class LegacyBaseDocValuesFormatTestCase extends BaseIndexFileFor
assertEquals(Long.parseLong(storedValue), docValues.longValue());
docValues.nextDoc();
}
- if (random().nextInt(10) == 3) {
- // Sometimes skip ahead. We used to exhaustively check every doc, but it is too
- // time-consuming
- int skipAmount = skip * (r.maxDoc() - i) / 10;
- if (skipAmount > 0) {
- i += random().nextInt(skipAmount);
- docValues.advance(i + 1);
- }
- }
}
assertEquals(DocIdSetIterator.NO_MORE_DOCS, docValues.docID());
}