Skip to content

Commit a279c37

Browse files
committed
Remove completion postings format extension
A while ago we introduced a completion postings format extension to eventually be able to customize how completion FSTs are loaded. See elastic#111494. We have never leveraged this extension, and meanwhile Lucene is moving to always load FSTs off-heap, and no longer allow on-heap. See apache/lucene#14364 . This commit removes the SPI extension as it is no longer needed.
1 parent 6f7a206 commit a279c37

File tree

3 files changed

+3
-51
lines changed

3 files changed

+3
-51
lines changed

server/src/main/java/module-info.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import org.elasticsearch.internal.CompletionsPostingsFormatExtension;
1110
import org.elasticsearch.plugins.internal.RestExtension;
1211

1312
/** The Elasticsearch Server Module. */
@@ -291,8 +290,7 @@
291290
to
292291
org.elasticsearch.serverless.version,
293292
org.elasticsearch.serverless.buildinfo,
294-
org.elasticsearch.serverless.constants,
295-
org.elasticsearch.serverless.codec;
293+
org.elasticsearch.serverless.constants;
296294
exports org.elasticsearch.lucene.analysis.miscellaneous;
297295
exports org.elasticsearch.lucene.grouping;
298296
exports org.elasticsearch.lucene.queries;
@@ -401,7 +399,6 @@
401399
org.elasticsearch.stateless,
402400
org.elasticsearch.settings.secure,
403401
org.elasticsearch.serverless.constants,
404-
org.elasticsearch.serverless.codec,
405402
org.elasticsearch.serverless.apifiltering,
406403
org.elasticsearch.internal.security;
407404

@@ -422,7 +419,6 @@
422419
uses org.elasticsearch.node.internal.TerminationHandlerProvider;
423420
uses org.elasticsearch.internal.VersionExtension;
424421
uses org.elasticsearch.internal.BuildExtension;
425-
uses CompletionsPostingsFormatExtension;
426422
uses org.elasticsearch.features.FeatureSpecification;
427423
uses org.elasticsearch.plugins.internal.LoggingDataProvider;
428424

server/src/main/java/org/elasticsearch/index/codec/PerFieldFormatSupplier.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
import org.elasticsearch.index.mapper.Mapper;
2626
import org.elasticsearch.index.mapper.MapperService;
2727
import org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper;
28-
import org.elasticsearch.internal.CompletionsPostingsFormatExtension;
29-
import org.elasticsearch.plugins.ExtensionLoader;
30-
31-
import java.util.ServiceLoader;
3228

3329
/**
3430
* Class that encapsulates the logic of figuring out the most appropriate file format for a given field, across postings, doc values and
@@ -40,6 +36,7 @@ public class PerFieldFormatSupplier {
4036
private static final KnnVectorsFormat knnVectorsFormat = new Lucene99HnswVectorsFormat();
4137
private static final ES87TSDBDocValuesFormat tsdbDocValuesFormat = new ES87TSDBDocValuesFormat();
4238
private static final ES812PostingsFormat es812PostingsFormat = new ES812PostingsFormat();
39+
private static final PostingsFormat completionPostingsFormat = PostingsFormat.forName("Completion101");
4340

4441
private final ES87BloomFilterPostingsFormat bloomFilterPostingsFormat;
4542
private final MapperService mapperService;
@@ -60,26 +57,13 @@ private PostingsFormat internalGetPostingsFormatForField(String field) {
6057
if (mapperService != null) {
6158
Mapper mapper = mapperService.mappingLookup().getMapper(field);
6259
if (mapper instanceof CompletionFieldMapper) {
63-
return CompletionPostingsFormatHolder.POSTINGS_FORMAT;
60+
return completionPostingsFormat;
6461
}
6562
}
6663
// return our own posting format using PFOR
6764
return es812PostingsFormat;
6865
}
6966

70-
private static class CompletionPostingsFormatHolder {
71-
private static final PostingsFormat POSTINGS_FORMAT = getCompletionPostingsFormat();
72-
73-
private static PostingsFormat getCompletionPostingsFormat() {
74-
String defaultName = "Completion101"; // Caution: changing this name will result in exceptions if a field is created during a
75-
// rolling upgrade and the new codec (specified by the name) is not available on all nodes in the cluster.
76-
String codecName = ExtensionLoader.loadSingleton(ServiceLoader.load(CompletionsPostingsFormatExtension.class))
77-
.map(CompletionsPostingsFormatExtension::getFormatName)
78-
.orElse(defaultName);
79-
return PostingsFormat.forName(codecName);
80-
}
81-
}
82-
8367
boolean useBloomFilter(String field) {
8468
if (mapperService == null) {
8569
return false;

server/src/main/java/org/elasticsearch/internal/CompletionsPostingsFormatExtension.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)