Skip to content

Commit 3eb7a76

Browse files
retamch2
andcommitted
Update Apache Lucene to 9.12.0 (opensearch-project#15333)
* Update Apache Lucene to 9.12.0 Signed-off-by: Andriy Redko <[email protected]> * change to IOContext READONCE in locations where the file is not expected to be read multiple times. Signed-off-by: Marc Handalian <[email protected]> * Use READ IOContext for all non Segment* files when copying node-node Signed-off-by: Marc Handalian <[email protected]> * Fixing more test failures Signed-off-by: Andriy Redko <[email protected]> * Move Composite912Codec under org.opensearch.index.codec.composite.composite912 package Signed-off-by: Andriy Redko <[email protected]> --------- Signed-off-by: Andriy Redko <[email protected]> Signed-off-by: Marc Handalian <[email protected]> Co-authored-by: Marc Handalian <[email protected]> (cherry picked from commit 146b0f7) Signed-off-by: Andriy Redko <[email protected]>
1 parent 1b1c90f commit 3eb7a76

File tree

84 files changed

+236
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+236
-146
lines changed

CHANGELOG.md

+1

buildSrc/version.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
opensearch = 2.18.0
2-
lucene = 9.11.1
2+
lucene = 9.12.0
33

44
bundled_jdk_vendor = adoptium
55
bundled_jdk = 21.0.4+7

libs/core/licenses/lucene-core-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fdb055d569bb20bfce9618fe2b01c29bab7f290c

libs/core/src/main/java/org/opensearch/Version.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public class Version implements Comparable<Version>, ToXContentFragment {
141141
public static final Version V_2_17_0 = new Version(2170099, org.apache.lucene.util.Version.LUCENE_9_11_1);
142142
public static final Version V_2_17_1 = new Version(2170199, org.apache.lucene.util.Version.LUCENE_9_11_1);
143143
public static final Version V_2_17_2 = new Version(2170299, org.apache.lucene.util.Version.LUCENE_9_11_1);
144-
public static final Version V_2_18_0 = new Version(2180099, org.apache.lucene.util.Version.LUCENE_9_11_1);
144+
public static final Version V_2_18_0 = new Version(2180099, org.apache.lucene.util.Version.LUCENE_9_12_0);
145145
public static final Version CURRENT = V_2_18_0;
146146

147147
public static Version fromId(int id) {

modules/lang-expression/licenses/lucene-expressions-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5ba843374a0aab3dfe0b11cb28b251844d85bf5b

plugins/analysis-icu/licenses/lucene-analysis-icu-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a9232b6a4882979118d3281b98dfdb6e0e1cb5ca

plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a3a6950ffc22e76a082e1b3cefb022b9f7870d29

plugins/analysis-nori/licenses/lucene-analysis-nori-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e71f85b72ed3939039ba8897b28b065dd11918b9

plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6baa3ae7ab20d6e644cf0bedb271c50a44c0e259

plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f183e1e8b1eaaa4dec444774a285bb8b66518522

plugins/analysis-stempel/licenses/lucene-analysis-stempel-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b81a609934e65d12ab9d2d84bc2ea6f56a360e57

plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bec069f286b45f20b743c81e84202369cd0467e7

server/licenses/lucene-analysis-common-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4c2503cfaba37249e20ea877555cb52ee89d1ae1

server/licenses/lucene-backward-codecs-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
68fe98c94e9644a584ea1bf525e68d9406fc61ec

server/licenses/lucene-core-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fdb055d569bb20bfce9618fe2b01c29bab7f290c

server/licenses/lucene-grouping-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ccf99f8db57aa97b2c1f95c5cc2a11156a043921

server/licenses/lucene-highlighter-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e93429f66fbcd3b58d81f01223d6ce5688047296

server/licenses/lucene-join-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14c802d6955eaf11107375a2ada8fe8ec53b3e01

server/licenses/lucene-memory-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ffe090339540876b40df792aee51a42af6b3f37f

server/licenses/lucene-misc-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ad17704ee90eb926b6d3105f7027485cdadbecd9

server/licenses/lucene-queries-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3ac2a62b0b55c5725bb65f0c5454f9f8a401cf43

server/licenses/lucene-queryparser-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
55959399373876f4c184944315458dc6b88fbd81

server/licenses/lucene-sandbox-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f65882536d681c11a1cbc920e5679201101e3603

server/licenses/lucene-spatial-extras-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9d00cc7cc2279822ef6740f0677cafacfb439fa8

server/licenses/lucene-spatial3d-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e3092632ca1d4427d3ebb2c866ac89d90f5b61ec

server/licenses/lucene-suggest-9.11.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e1c6636499317ebe498f3490a1ec8b86b8a363dd

server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/ConcurrentSearchTasksIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void testConcurrentSearchTaskTracking() {
110110
Map<Long, List<ThreadResourceInfo>> threadStats = getThreadStats(SearchAction.NAME + "[*]", taskInfo.getTaskId());
111111
// Concurrent search forks each slice of 5 segments to different thread (see please
112112
// https://github.com/apache/lucene/issues/12498)
113-
assertEquals((int) Math.ceil(getSegmentCount(INDEX_NAME) / 5.0) + 1, threadStats.size());
113+
assertEquals((int) Math.ceil(getSegmentCount(INDEX_NAME) / 5.0), threadStats.size());
114114

115115
// assert that all task descriptions have non-zero length
116116
MatcherAssert.assertThat(taskInfo.getDescription().length(), greaterThan(0));

server/src/internalClusterTest/java/org/opensearch/recovery/TruncatedRecoveryIT.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import java.util.Collections;
5959
import java.util.List;
6060
import java.util.concurrent.CountDownLatch;
61+
import java.util.concurrent.TimeUnit;
6162
import java.util.concurrent.atomic.AtomicBoolean;
6263

6364
import static org.opensearch.indices.recovery.RecoverySettings.INDICES_RECOVERY_CHUNK_SIZE_SETTING;
@@ -184,7 +185,7 @@ public void testCancelRecoveryAndResume() throws Exception {
184185
)
185186
.get();
186187

187-
latch.await();
188+
latch.await(5, TimeUnit.MINUTES);
188189

189190
// at this point we got some truncated left overs on the replica on the unlucky node
190191
// now we are allowing the recovery to allocate again and finish to see if we wipe the truncated files

server/src/main/java/org/apache/lucene/misc/search/similarity/LegacyBM25Similarity.java

+1-9
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public LegacyBM25Similarity(float k1, float b) {
7070
* within the range {@code [0..1]}
7171
*/
7272
public LegacyBM25Similarity(float k1, float b, boolean discountOverlaps) {
73+
super(discountOverlaps);
7374
this.bm25Similarity = new BM25Similarity(k1, b, discountOverlaps);
7475
}
7576

@@ -101,15 +102,6 @@ public final float getB() {
101102
return bm25Similarity.getB();
102103
}
103104

104-
/**
105-
* Returns true if overlap tokens are discounted from the document's length.
106-
*
107-
* @see #LegacyBM25Similarity(float, float, boolean)
108-
*/
109-
public boolean getDiscountOverlaps() {
110-
return bm25Similarity.getDiscountOverlaps();
111-
}
112-
113105
@Override
114106
public String toString() {
115107
return bm25Similarity.toString();

server/src/main/java/org/apache/lucene/util/CombinedBitSet.java

+17-9
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,7 @@ public int prevSetBit(int index) {
8787

8888
@Override
8989
public int nextSetBit(int index) {
90-
assert index >= 0 && index < length : "index=" + index + " numBits=" + length();
91-
int next = first.nextSetBit(index);
92-
while (next != DocIdSetIterator.NO_MORE_DOCS && second.get(next) == false) {
93-
if (next == length() - 1) {
94-
return DocIdSetIterator.NO_MORE_DOCS;
95-
}
96-
next = first.nextSetBit(next + 1);
97-
}
98-
return next;
90+
return nextSetBit(index, length() - 1);
9991
}
10092

10193
@Override
@@ -132,4 +124,20 @@ public void clear(int startIndex, int endIndex) {
132124
public boolean getAndSet(int i) {
133125
throw new UnsupportedOperationException("not implemented");
134126
}
127+
128+
@Override
129+
public int nextSetBit(int start, int end) {
130+
assert start >= 0 && start < length() : "start=" + start + " numBits=" + length();
131+
assert end >= start && end < length() : "end=" + end + " numBits=" + length();
132+
133+
int next = first.nextSetBit(start);
134+
while (next != DocIdSetIterator.NO_MORE_DOCS && second.get(next) == false) {
135+
if (next >= end) {
136+
return DocIdSetIterator.NO_MORE_DOCS;
137+
}
138+
next = first.nextSetBit(next + 1);
139+
}
140+
return next;
141+
142+
}
135143
}

server/src/main/java/org/opensearch/common/lucene/Lucene.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
* @opensearch.internal
114114
*/
115115
public class Lucene {
116-
public static final String LATEST_CODEC = "Lucene99";
116+
public static final String LATEST_CODEC = "Lucene912";
117117

118118
public static final String SOFT_DELETES_FIELD = "__soft_deletes";
119119

@@ -287,7 +287,7 @@ public static void checkSegmentInfoIntegrity(final Directory directory) throws I
287287

288288
@Override
289289
protected Object doBody(String segmentFileName) throws IOException {
290-
try (IndexInput input = directory.openInput(segmentFileName, IOContext.READ)) {
290+
try (IndexInput input = directory.openInput(segmentFileName, IOContext.READONCE)) {
291291
CodecUtil.checksumEntireFile(input);
292292
}
293293
return null;

server/src/main/java/org/opensearch/index/codec/CodecService.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
import org.apache.logging.log4j.Logger;
3636
import org.apache.lucene.codecs.Codec;
37-
import org.apache.lucene.codecs.lucene99.Lucene99Codec;
38-
import org.apache.lucene.codecs.lucene99.Lucene99Codec.Mode;
37+
import org.apache.lucene.codecs.lucene912.Lucene912Codec;
38+
import org.apache.lucene.codecs.lucene912.Lucene912Codec.Mode;
3939
import org.opensearch.common.Nullable;
4040
import org.opensearch.common.collect.MapBuilder;
4141
import org.opensearch.index.IndexSettings;
@@ -70,10 +70,10 @@ public CodecService(@Nullable MapperService mapperService, IndexSettings indexSe
7070
final MapBuilder<String, Codec> codecs = MapBuilder.<String, Codec>newMapBuilder();
7171
assert null != indexSettings;
7272
if (mapperService == null) {
73-
codecs.put(DEFAULT_CODEC, new Lucene99Codec());
74-
codecs.put(LZ4, new Lucene99Codec());
75-
codecs.put(BEST_COMPRESSION_CODEC, new Lucene99Codec(Mode.BEST_COMPRESSION));
76-
codecs.put(ZLIB, new Lucene99Codec(Mode.BEST_COMPRESSION));
73+
codecs.put(DEFAULT_CODEC, new Lucene912Codec());
74+
codecs.put(LZ4, new Lucene912Codec());
75+
codecs.put(BEST_COMPRESSION_CODEC, new Lucene912Codec(Mode.BEST_COMPRESSION));
76+
codecs.put(ZLIB, new Lucene912Codec(Mode.BEST_COMPRESSION));
7777
} else {
7878
// CompositeCodec still delegates to PerFieldMappingPostingFormatCodec
7979
// We can still support all the compression codecs when composite index is present
@@ -97,8 +97,8 @@ public CodecService(@Nullable MapperService mapperService, IndexSettings indexSe
9797
public CodecService(@Nullable MapperService mapperService, Logger logger) {
9898
final MapBuilder<String, Codec> codecs = MapBuilder.<String, Codec>newMapBuilder();
9999
if (mapperService == null) {
100-
codecs.put(DEFAULT_CODEC, new Lucene99Codec());
101-
codecs.put(BEST_COMPRESSION_CODEC, new Lucene99Codec(Mode.BEST_COMPRESSION));
100+
codecs.put(DEFAULT_CODEC, new Lucene912Codec());
101+
codecs.put(BEST_COMPRESSION_CODEC, new Lucene912Codec(Mode.BEST_COMPRESSION));
102102
} else {
103103
IndexSettings indexSettings = mapperService.getIndexSettings();
104104
codecs.put(DEFAULT_CODEC, new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger));

server/src/main/java/org/opensearch/index/codec/PerFieldMappingPostingFormatCodec.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import org.apache.lucene.codecs.DocValuesFormat;
3838
import org.apache.lucene.codecs.PostingsFormat;
3939
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat;
40-
import org.apache.lucene.codecs.lucene99.Lucene99Codec;
40+
import org.apache.lucene.codecs.lucene912.Lucene912Codec;
4141
import org.opensearch.common.lucene.Lucene;
4242
import org.opensearch.index.codec.fuzzy.FuzzyFilterPostingsFormat;
4343
import org.opensearch.index.codec.fuzzy.FuzzySetFactory;
@@ -59,7 +59,7 @@
5959
*
6060
* @opensearch.internal
6161
*/
62-
public class PerFieldMappingPostingFormatCodec extends Lucene99Codec {
62+
public class PerFieldMappingPostingFormatCodec extends Lucene912Codec {
6363
private final Logger logger;
6464
private final MapperService mapperService;
6565
private final DocValuesFormat dvFormat = new Lucene90DocValuesFormat();

server/src/main/java/org/opensearch/index/codec/composite/CompositeCodecFactory.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
import org.apache.logging.log4j.Logger;
1212
import org.apache.lucene.codecs.Codec;
13-
import org.apache.lucene.codecs.lucene99.Lucene99Codec;
13+
import org.apache.lucene.codecs.lucene912.Lucene912Codec;
1414
import org.opensearch.common.annotation.ExperimentalApi;
15+
import org.opensearch.index.codec.composite.composite912.Composite912Codec;
1516
import org.opensearch.index.codec.composite.composite99.Composite99Codec;
1617
import org.opensearch.index.mapper.MapperService;
1718

@@ -38,10 +39,10 @@ public CompositeCodecFactory() {}
3839

3940
public Map<String, Codec> getCompositeIndexCodecs(MapperService mapperService, Logger logger) {
4041
Map<String, Codec> codecs = new HashMap<>();
41-
codecs.put(DEFAULT_CODEC, new Composite99Codec(Lucene99Codec.Mode.BEST_SPEED, mapperService, logger));
42-
codecs.put(LZ4, new Composite99Codec(Lucene99Codec.Mode.BEST_SPEED, mapperService, logger));
43-
codecs.put(BEST_COMPRESSION_CODEC, new Composite99Codec(Lucene99Codec.Mode.BEST_COMPRESSION, mapperService, logger));
44-
codecs.put(ZLIB, new Composite99Codec(Lucene99Codec.Mode.BEST_COMPRESSION, mapperService, logger));
42+
codecs.put(DEFAULT_CODEC, new Composite912Codec(Lucene912Codec.Mode.BEST_SPEED, mapperService, logger));
43+
codecs.put(LZ4, new Composite912Codec(Lucene912Codec.Mode.BEST_SPEED, mapperService, logger));
44+
codecs.put(BEST_COMPRESSION_CODEC, new Composite912Codec(Lucene912Codec.Mode.BEST_COMPRESSION, mapperService, logger));
45+
codecs.put(ZLIB, new Composite912Codec(Lucene912Codec.Mode.BEST_COMPRESSION, mapperService, logger));
4546
return codecs;
4647
}
4748
}

0 commit comments

Comments
 (0)