[Upgrade] Lucene-9.2.0-snapshot-ba8c3a8 (#3416)

Upgrades to latest snapshot of lucene 9.2.0 in preparation for GA release.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
Nick Knize 2022-05-20 16:29:51 -05:00 committed by GitHub
parent acf7da78f9
commit 5358502107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 85 additions and 46 deletions

View File

@ -19,7 +19,6 @@ com.carrotsearch.randomizedtesting.annotations.Seed @ Don't commit hardcoded see
com.carrotsearch.randomizedtesting.annotations.Repeat @ Don't commit hardcoded repeats com.carrotsearch.randomizedtesting.annotations.Repeat @ Don't commit hardcoded repeats
org.apache.lucene.codecs.Codec#setDefault(org.apache.lucene.codecs.Codec) @ Use the SuppressCodecs("*") annotation instead org.apache.lucene.codecs.Codec#setDefault(org.apache.lucene.codecs.Codec) @ Use the SuppressCodecs("*") annotation instead
org.apache.lucene.tests.util.LuceneTestCase$Slow @ Don't write slow tests
org.junit.Ignore @ Use AwaitsFix instead org.junit.Ignore @ Use AwaitsFix instead
org.apache.lucene.tests.util.LuceneTestCase$Nightly @ We don't run nightly tests at this point! org.apache.lucene.tests.util.LuceneTestCase$Nightly @ We don't run nightly tests at this point!
com.carrotsearch.randomizedtesting.annotations.Nightly @ We don't run nightly tests at this point! com.carrotsearch.randomizedtesting.annotations.Nightly @ We don't run nightly tests at this point!

View File

@ -1,5 +1,5 @@
opensearch = 3.0.0 opensearch = 3.0.0
lucene = 9.2.0-snapshot-f4f1f70 lucene = 9.2.0-snapshot-ba8c3a8
bundled_jdk_vendor = adoptium bundled_jdk_vendor = adoptium
bundled_jdk = 17.0.3+7 bundled_jdk = 17.0.3+7

View File

@ -40,7 +40,6 @@ import org.opensearch.test.OpenSearchTestCase;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URI;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.AccessDeniedException; import java.nio.file.AccessDeniedException;
@ -172,10 +171,8 @@ public class IOUtilsTests extends OpenSearchTestCase {
for (int i = 0; i < numberOfLocations; i++) { for (int i = 0; i < numberOfLocations; i++) {
if (exception && randomBoolean()) { if (exception && randomBoolean()) {
final Path location = createTempDir(); final Path location = createTempDir();
final FileSystem fs = new AccessDeniedWhileDeletingFileSystem(location.getFileSystem()).getFileSystem( final FilterFileSystemProvider ffsp = new AccessDeniedWhileDeletingFileSystem(location.getFileSystem());
URI.create("file:///") final Path wrapped = ffsp.wrapPath(location);
);
final Path wrapped = new FilterPath(location, fs);
locations[i] = wrapped.resolve(randomAlphaOfLength(8)); locations[i] = wrapped.resolve(randomAlphaOfLength(8));
Files.createDirectory(locations[i]); Files.createDirectory(locations[i]);
locationsThrowingException.add(locations[i]); locationsThrowingException.add(locations[i]);
@ -256,8 +253,8 @@ public class IOUtilsTests extends OpenSearchTestCase {
public void testFsyncAccessDeniedOpeningDirectory() throws Exception { public void testFsyncAccessDeniedOpeningDirectory() throws Exception {
final Path path = createTempDir().toRealPath(); final Path path = createTempDir().toRealPath();
final FileSystem fs = new AccessDeniedWhileOpeningDirectoryFileSystem(path.getFileSystem()).getFileSystem(URI.create("file:///")); final FilterFileSystemProvider ffsp = new AccessDeniedWhileOpeningDirectoryFileSystem(path.getFileSystem());
final Path wrapped = new FilterPath(path, fs); final Path wrapped = ffsp.wrapPath(path);
if (Constants.WINDOWS) { if (Constants.WINDOWS) {
// no exception, we early return and do not even try to open the directory // no exception, we early return and do not even try to open the directory
IOUtils.fsync(wrapped, true); IOUtils.fsync(wrapped, true);

View File

@ -0,0 +1 @@
fe5e4cf94d26bbe1d982808f34fa132bba5565e3

View File

@ -1 +0,0 @@
f2a8008e74589f77f1d3da305cf58c88ee01d1c1

View File

@ -0,0 +1 @@
9fc73c790c037e817635fcc30ea0891e6acd2fac

View File

@ -1 +0,0 @@
f9569365e80897f1a9161254d5d2f44a44f95db8

View File

@ -0,0 +1 @@
058ffd84388f9ffcf0bfdd7f43a6e832836a2927

View File

@ -1 +0,0 @@
35c14b39ff522dd6665e74a873035827b865075e

View File

@ -0,0 +1 @@
fb166f35ba04a7687b3073afb9972f6669ac722e

View File

@ -1 +0,0 @@
a84218a1ea0d5c52d6591d417061518b8a8be4e4

View File

@ -0,0 +1 @@
abf9eb24601ec11ce5b61e4753b41444a869b29d

View File

@ -1 +0,0 @@
057bbd20b15899844b23d2cf034a167b4fe581f0

View File

@ -0,0 +1 @@
b310130fe9e0f31ce4218cda921309b1143f3541

View File

@ -1 +0,0 @@
6a9a8d49e87b6999560a131e16234e46f21e6b42

View File

@ -0,0 +1 @@
ad8783255cdcb6e7ab23a505123716ad979f3484

View File

@ -1 +0,0 @@
fcad3608779e0b3ab8703903b9d28cdc32767d60

View File

@ -0,0 +1 @@
75f8fbb94a303d04c5dc2b25436300a463003dd6

View File

@ -1 +0,0 @@
bd28479bdf3c076bc89a0d30864188d444410267

View File

@ -0,0 +1 @@
b2aa0739c95f1f715f407087dbcf96c5c21f4cc7

View File

@ -1 +0,0 @@
1f7c4b91c8ef9f65e85c5190080b3f796076f355

View File

@ -0,0 +1 @@
e4a2f89c03e98e0fc211bba2c090047a007eb442

View File

@ -1 +0,0 @@
e3ee195405dc0cb249fe2eb3f3a6a848c4686645

View File

@ -0,0 +1 @@
06df30c240dfb970002c104d44370ae58b7cb60a

View File

@ -1 +0,0 @@
f1cb45d20f7f23c420c56a94e9153e96bfdd6e1f

View File

@ -0,0 +1 @@
1991e0f0f71c3c99ba726fcfa372f7ba7c75bcf0

View File

@ -1 +0,0 @@
29052ac8f5255c8df2bb1d3d0da94e112c181679

View File

@ -0,0 +1 @@
cac793b5cfbccf5c310d51bc78cf97ce3befceac

View File

@ -1 +0,0 @@
d710569c00d561c70d8290de4c4c15fe9735f94f

View File

@ -0,0 +1 @@
79344146c032fda532def9771de589c4798117e5

View File

@ -1 +0,0 @@
0f3081b32664d8ca6318e69dd054befb5f9a334b

View File

@ -0,0 +1 @@
1d5f1c88786bcdfc50466f963ef07cbd9c6c7827

View File

@ -1 +0,0 @@
81b63e23b87c054c140ff6a1e2e6696ca750d51c

View File

@ -0,0 +1 @@
adba90f90cf6815eeb9009c1a42d7c86f916d9da

View File

@ -1 +0,0 @@
0cdea200c1890b877d26ce58b7d797f122bb8328

View File

@ -0,0 +1 @@
d0f38091eee45a118173c9201677ebafa9ed9e89

View File

@ -1 +0,0 @@
50d8395e3afc502f267cb308399ab783edfabec0

View File

@ -0,0 +1 @@
05e2ca9fc81e8b73f746c5ec40321d6d90e3bcdd

View File

@ -1 +0,0 @@
815b394c8be5cbb9673011953da38d39a843b0fa

View File

@ -0,0 +1 @@
c4ebbf7fd05e2889624b4dd9afb3f7b22aad94f3

View File

@ -1 +0,0 @@
7bb7c539172dc3513d4f34e7f29d2cd3a0352361

View File

@ -0,0 +1 @@
08836d9dee5a2e9e92b538023285de3d620abd4b

View File

@ -1 +0,0 @@
7bc2f2e37f866e3b376f083e4b7cc89a8cb45fd0

View File

@ -0,0 +1 @@
d492d0c7b4bb76c3de7cfc1b4fe224ef9e9e7056

View File

@ -1 +0,0 @@
a5f79bb1f8337dbe6fc50fc5abd46d4eaaf4d433

View File

@ -0,0 +1 @@
71b5b0cfb5b5809c4a86e947b1f4d9202d6f1b75

View File

@ -1 +0,0 @@
9e74f66171ea215e8c4936588381c0950c290c80

View File

@ -125,7 +125,7 @@ import java.util.Map;
* @opensearch.internal * @opensearch.internal
*/ */
public class Lucene { public class Lucene {
public static final String LATEST_CODEC = "Lucene91"; public static final String LATEST_CODEC = "Lucene92";
public static final String SOFT_DELETES_FIELD = "__soft_deletes"; public static final String SOFT_DELETES_FIELD = "__soft_deletes";

View File

@ -34,8 +34,8 @@ package org.opensearch.index.codec;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.lucene91.Lucene91Codec; import org.apache.lucene.codecs.lucene92.Lucene92Codec;
import org.apache.lucene.codecs.lucene91.Lucene91Codec.Mode; import org.apache.lucene.codecs.lucene92.Lucene92Codec.Mode;
import org.opensearch.common.Nullable; import org.opensearch.common.Nullable;
import org.opensearch.common.collect.MapBuilder; import org.opensearch.common.collect.MapBuilder;
import org.opensearch.index.mapper.MapperService; import org.opensearch.index.mapper.MapperService;
@ -62,8 +62,8 @@ public class CodecService {
public CodecService(@Nullable MapperService mapperService, Logger logger) { public CodecService(@Nullable MapperService mapperService, Logger logger) {
final MapBuilder<String, Codec> codecs = MapBuilder.<String, Codec>newMapBuilder(); final MapBuilder<String, Codec> codecs = MapBuilder.<String, Codec>newMapBuilder();
if (mapperService == null) { if (mapperService == null) {
codecs.put(DEFAULT_CODEC, new Lucene91Codec()); codecs.put(DEFAULT_CODEC, new Lucene92Codec());
codecs.put(BEST_COMPRESSION_CODEC, new Lucene91Codec(Mode.BEST_COMPRESSION)); codecs.put(BEST_COMPRESSION_CODEC, new Lucene92Codec(Mode.BEST_COMPRESSION));
} else { } else {
codecs.put(DEFAULT_CODEC, new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger)); codecs.put(DEFAULT_CODEC, new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger));
codecs.put(BEST_COMPRESSION_CODEC, new PerFieldMappingPostingFormatCodec(Mode.BEST_COMPRESSION, mapperService, logger)); codecs.put(BEST_COMPRESSION_CODEC, new PerFieldMappingPostingFormatCodec(Mode.BEST_COMPRESSION, mapperService, logger));

View File

@ -36,7 +36,7 @@ import org.apache.logging.log4j.Logger;
import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.DocValuesFormat; import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.PostingsFormat; import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.lucene91.Lucene91Codec; import org.apache.lucene.codecs.lucene92.Lucene92Codec;
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat; import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat;
import org.opensearch.common.lucene.Lucene; import org.opensearch.common.lucene.Lucene;
import org.opensearch.index.mapper.CompletionFieldMapper; import org.opensearch.index.mapper.CompletionFieldMapper;
@ -53,7 +53,7 @@ import org.opensearch.index.mapper.MapperService;
* *
* @opensearch.internal * @opensearch.internal
*/ */
public class PerFieldMappingPostingFormatCodec extends Lucene91Codec { public class PerFieldMappingPostingFormatCodec extends Lucene92Codec {
private final Logger logger; private final Logger logger;
private final MapperService mapperService; private final MapperService mapperService;
private final DocValuesFormat dvFormat = new Lucene90DocValuesFormat(); private final DocValuesFormat dvFormat = new Lucene90DocValuesFormat();

View File

@ -112,4 +112,8 @@ final class GlobalOrdinalMapping extends SortedSetDocValues {
return values.cost(); return values.cost();
} }
@Override
public long docValueCount() {
return values.docValueCount();
}
} }

View File

@ -229,5 +229,10 @@ public class MultiOrdinals extends Ordinals {
public BytesRef lookupOrd(long ord) { public BytesRef lookupOrd(long ord) {
return values.lookupOrd(ord); return values.lookupOrd(ord);
} }
@Override
public long docValueCount() {
return currentEndOffset - currentOffset;
}
} }
} }

View File

@ -310,6 +310,11 @@ public enum MissingValues {
return true; return true;
} }
@Override
public long docValueCount() {
return values.docValueCount();
}
@Override @Override
public String toString() { public String toString() {
return "anon AbstractSortedDocValues of [" + super.toString() + "]"; return "anon AbstractSortedDocValues of [" + super.toString() + "]";
@ -340,6 +345,11 @@ public enum MissingValues {
return 1 + values.getValueCount(); return 1 + values.getValueCount();
} }
@Override
public long docValueCount() {
return values.docValueCount();
}
@Override @Override
public long nextOrd() throws IOException { public long nextOrd() throws IOException {
if (hasOrds) { if (hasOrds) {

View File

@ -34,7 +34,7 @@ package org.opensearch.index.codec;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.lucene91.Lucene91Codec; import org.apache.lucene.codecs.lucene92.Lucene92Codec;
import org.apache.lucene.codecs.lucene90.Lucene90StoredFieldsFormat; import org.apache.lucene.codecs.lucene90.Lucene90StoredFieldsFormat;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.DirectoryReader;
@ -65,21 +65,21 @@ public class CodecTests extends OpenSearchTestCase {
public void testResolveDefaultCodecs() throws Exception { public void testResolveDefaultCodecs() throws Exception {
CodecService codecService = createCodecService(); CodecService codecService = createCodecService();
assertThat(codecService.codec("default"), instanceOf(PerFieldMappingPostingFormatCodec.class)); assertThat(codecService.codec("default"), instanceOf(PerFieldMappingPostingFormatCodec.class));
assertThat(codecService.codec("default"), instanceOf(Lucene91Codec.class)); assertThat(codecService.codec("default"), instanceOf(Lucene92Codec.class));
} }
public void testDefault() throws Exception { public void testDefault() throws Exception {
Codec codec = createCodecService().codec("default"); Codec codec = createCodecService().codec("default");
assertStoredFieldsCompressionEquals(Lucene91Codec.Mode.BEST_SPEED, codec); assertStoredFieldsCompressionEquals(Lucene92Codec.Mode.BEST_SPEED, codec);
} }
public void testBestCompression() throws Exception { public void testBestCompression() throws Exception {
Codec codec = createCodecService().codec("best_compression"); Codec codec = createCodecService().codec("best_compression");
assertStoredFieldsCompressionEquals(Lucene91Codec.Mode.BEST_COMPRESSION, codec); assertStoredFieldsCompressionEquals(Lucene92Codec.Mode.BEST_COMPRESSION, codec);
} }
// write some docs with it, inspect .si to see this was the used compression // write some docs with it, inspect .si to see this was the used compression
private void assertStoredFieldsCompressionEquals(Lucene91Codec.Mode expected, Codec actual) throws Exception { private void assertStoredFieldsCompressionEquals(Lucene92Codec.Mode expected, Codec actual) throws Exception {
Directory dir = newDirectory(); Directory dir = newDirectory();
IndexWriterConfig iwc = newIndexWriterConfig(null); IndexWriterConfig iwc = newIndexWriterConfig(null);
iwc.setCodec(actual); iwc.setCodec(actual);
@ -91,7 +91,7 @@ public class CodecTests extends OpenSearchTestCase {
SegmentReader sr = (SegmentReader) ir.leaves().get(0).reader(); SegmentReader sr = (SegmentReader) ir.leaves().get(0).reader();
String v = sr.getSegmentInfo().info.getAttribute(Lucene90StoredFieldsFormat.MODE_KEY); String v = sr.getSegmentInfo().info.getAttribute(Lucene90StoredFieldsFormat.MODE_KEY);
assertNotNull(v); assertNotNull(v);
assertEquals(expected, Lucene91Codec.Mode.valueOf(v)); assertEquals(expected, Lucene92Codec.Mode.valueOf(v));
ir.close(); ir.close();
dir.close(); dir.close();
} }

View File

@ -32,7 +32,7 @@
package org.opensearch.index.engine; package org.opensearch.index.engine;
import org.apache.lucene.codecs.PostingsFormat; import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.lucene91.Lucene91Codec; import org.apache.lucene.codecs.lucene92.Lucene92Codec;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriter;
@ -70,7 +70,7 @@ public class CompletionStatsCacheTests extends OpenSearchTestCase {
public void testCompletionStatsCache() throws IOException, InterruptedException { public void testCompletionStatsCache() throws IOException, InterruptedException {
final IndexWriterConfig indexWriterConfig = newIndexWriterConfig(); final IndexWriterConfig indexWriterConfig = newIndexWriterConfig();
final PostingsFormat postingsFormat = new Completion90PostingsFormat(); final PostingsFormat postingsFormat = new Completion90PostingsFormat();
indexWriterConfig.setCodec(new Lucene91Codec() { indexWriterConfig.setCodec(new Lucene92Codec() {
@Override @Override
public PostingsFormat getPostingsFormatForField(String field) { public PostingsFormat getPostingsFormatForField(String field) {
return postingsFormat; // all fields are suggest fields return postingsFormat; // all fields are suggest fields

View File

@ -763,6 +763,11 @@ public class MultiValueModeTests extends OpenSearchTestCase {
public long getValueCount() { public long getValueCount() {
return 1 << 20; return 1 << 20;
} }
@Override
public long docValueCount() {
return array[doc].length;
}
}; };
verifySortedSet(multiValues, numDocs); verifySortedSet(multiValues, numDocs);
final FixedBitSet rootDocs = randomRootDocs(numDocs); final FixedBitSet rootDocs = randomRootDocs(numDocs);

View File

@ -83,6 +83,10 @@ public class BinaryRangeAggregatorTests extends OpenSearchTestCase {
return terms.length; return terms.length;
} }
@Override
public long docValueCount() {
return ords.length;
}
} }
private void doTestSortedSetRangeLeafCollector(int maxNumValuesPerDoc) throws Exception { private void doTestSortedSetRangeLeafCollector(int maxNumValuesPerDoc) throws Exception {

View File

@ -98,6 +98,10 @@ public class IncludeExcludeTests extends OpenSearchTestCase {
return 1; return 1;
} }
@Override
public long docValueCount() {
return 1;
}
}; };
IncludeExclude inexcl = new IncludeExclude(new TreeSet<>(Collections.singleton(new BytesRef("foo"))), null); IncludeExclude inexcl = new IncludeExclude(new TreeSet<>(Collections.singleton(new BytesRef("foo"))), null);
OrdinalsFilter filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW); OrdinalsFilter filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);

View File

@ -155,6 +155,11 @@ public class MissingValuesTests extends OpenSearchTestCase {
return NO_MORE_ORDS; return NO_MORE_ORDS;
} }
} }
@Override
public long docValueCount() {
return ords[doc].length;
}
}; };
final BytesRef existingMissing = RandomPicks.randomFrom(random(), values); final BytesRef existingMissing = RandomPicks.randomFrom(random(), values);
@ -257,6 +262,11 @@ public class MissingValuesTests extends OpenSearchTestCase {
return values[Math.toIntExact(ord)]; return values[Math.toIntExact(ord)];
} }
@Override
public long docValueCount() {
throw new UnsupportedOperationException();
}
@Override @Override
public long getValueCount() { public long getValueCount() {
return values.length; return values.length;

View File

@ -221,6 +221,7 @@ public abstract class AnalysisFactoryTestCase extends OpenSearchTestCase {
.put("spanishpluralstem", Void.class) .put("spanishpluralstem", Void.class)
// LUCENE-10352 // LUCENE-10352
.put("daitchmokotoffsoundex", Void.class) .put("daitchmokotoffsoundex", Void.class)
.put("persianstem", Void.class)
.immutableMap(); .immutableMap();
static final Map<String, Class<?>> KNOWN_CHARFILTERS = new MapBuilder<String, Class<?>>() static final Map<String, Class<?>> KNOWN_CHARFILTERS = new MapBuilder<String, Class<?>>()