Skip to content

Commit dd1db50

Browse files
Move calls to FeatureFlag.enabled to class-load time (#125885)
I noticed that we tend to create the flag instance and call this method everywhere. This doesn't compile the same way as a real boolean constant unless you're running with `-XX:+TrustFinalNonStaticFields`. For most of the code spots changed here that's irrelevant but at least the usage in the mapper parsing code is a little hot and gets a small speedup from this potentially. Also we're simply wasting some bytes for the static footprint of ES by using the `FeatureFlag` indirection instead of just a boolean.
1 parent b3e500f commit dd1db50

File tree

18 files changed

+70
-70
lines changed

18 files changed

+70
-70
lines changed

modules/data-streams/src/test/java/org/elasticsearch/datastreams/mapper/DataStreamTimestampFieldMapperTests.java

+29-29
Large diffs are not rendered by default.

server/src/internalClusterTest/java/org/elasticsearch/index/shard/SearchIdleIT.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ public void testSearchIdleStats() throws InterruptedException {
235235
}
236236

237237
public void testSearchIdleBoolQueryMatchOneIndex() throws InterruptedException {
238-
checkSearchIdleBoolQueryMatchOneIndex(IndexSettings.DOC_VALUES_SKIPPER.isEnabled());
238+
checkSearchIdleBoolQueryMatchOneIndex(IndexSettings.DOC_VALUES_SKIPPER);
239239
}
240240

241241
public void testSearchIdleBoolQueryMatchOneIndexWithDocValuesSkipper() throws InterruptedException {
242-
assumeTrue("doc values skipper feature should be enabled", IndexSettings.DOC_VALUES_SKIPPER.isEnabled());
242+
assumeTrue("doc values skipper feature should be enabled", IndexSettings.DOC_VALUES_SKIPPER);
243243
checkSearchIdleBoolQueryMatchOneIndex(false);
244244
}
245245

server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@
7171

7272
public final class DataStream implements SimpleDiffable<DataStream>, ToXContentObject, IndexAbstraction {
7373

74-
public static final FeatureFlag FAILURE_STORE_FEATURE_FLAG = new FeatureFlag("failure_store");
74+
public static final boolean FAILURE_STORE_FEATURE_FLAG = new FeatureFlag("failure_store").isEnabled();
7575
public static final TransportVersion ADDED_FAILURE_STORE_TRANSPORT_VERSION = TransportVersions.V_8_12_0;
7676
public static final TransportVersion ADDED_AUTO_SHARDING_EVENT_VERSION = TransportVersions.V_8_14_0;
7777
public static final TransportVersion ADD_DATA_STREAM_OPTIONS_VERSION = TransportVersions.V_8_16_0;
7878

7979
public static boolean isFailureStoreFeatureFlagEnabled() {
80-
return FAILURE_STORE_FEATURE_FLAG.isEnabled();
80+
return FAILURE_STORE_FEATURE_FLAG;
8181
}
8282

8383
public static final String BACKING_INDEX_PREFIX = ".ds-";

server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
234234
)
235235
);
236236

237-
if (IndexSettings.DOC_VALUES_SKIPPER.isEnabled()) {
237+
if (IndexSettings.DOC_VALUES_SKIPPER) {
238238
settings.add(IndexSettings.USE_DOC_VALUES_SKIPPER);
239239
}
240240
BUILT_IN_INDEX_SETTINGS = Collections.unmodifiableSet(settings);

server/src/main/java/org/elasticsearch/index/IndexSettings.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ public boolean isES87TSDBCodecEnabled() {
674674
Property.Final
675675
);
676676

677-
public static final FeatureFlag DOC_VALUES_SKIPPER = new FeatureFlag("doc_values_skipper");
677+
public static final boolean DOC_VALUES_SKIPPER = new FeatureFlag("doc_values_skipper").isEnabled();
678678
public static final Setting<Boolean> USE_DOC_VALUES_SKIPPER = Setting.boolSetting(
679679
"index.mapping.use_doc_values_skipper",
680680
false,
@@ -1095,7 +1095,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
10951095
recoverySourceEnabled = RecoverySettings.INDICES_RECOVERY_SOURCE_ENABLED_SETTING.get(nodeSettings);
10961096
recoverySourceSyntheticEnabled = DiscoveryNode.isStateless(nodeSettings) == false
10971097
&& scopedSettings.get(RECOVERY_USE_SYNTHETIC_SOURCE_SETTING);
1098-
useDocValuesSkipper = DOC_VALUES_SKIPPER.isEnabled() && scopedSettings.get(USE_DOC_VALUES_SKIPPER);
1098+
useDocValuesSkipper = DOC_VALUES_SKIPPER && scopedSettings.get(USE_DOC_VALUES_SKIPPER);
10991099
if (recoverySourceSyntheticEnabled) {
11001100
if (DiscoveryNode.isStateless(settings)) {
11011101
throw new IllegalArgumentException("synthetic recovery source is only allowed in stateful");

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232
public class CodecService implements CodecProvider {
3333

34-
public static final FeatureFlag ZSTD_STORED_FIELDS_FEATURE_FLAG = new FeatureFlag("zstd_stored_fields");
34+
public static final boolean ZSTD_STORED_FIELDS_FEATURE_FLAG = new FeatureFlag("zstd_stored_fields").isEnabled();
3535

3636
private final Map<String, Codec> codecs;
3737

@@ -47,7 +47,7 @@ public CodecService(@Nullable MapperService mapperService, BigArrays bigArrays)
4747
final var codecs = new HashMap<String, Codec>();
4848

4949
Codec legacyBestSpeedCodec = new LegacyPerFieldMapperCodec(Lucene101Codec.Mode.BEST_SPEED, mapperService, bigArrays);
50-
if (ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled()) {
50+
if (ZSTD_STORED_FIELDS_FEATURE_FLAG) {
5151
codecs.put(DEFAULT_CODEC, new PerFieldMapperCodec(Zstd814StoredFieldsFormat.Mode.BEST_SPEED, mapperService, bigArrays));
5252
} else {
5353
codecs.put(DEFAULT_CODEC, legacyBestSpeedCodec);

server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
public class ObjectMapper extends Mapper {
4949
private static final Logger logger = LogManager.getLogger(ObjectMapper.class);
5050
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ObjectMapper.class);
51-
public static final FeatureFlag SUB_OBJECTS_AUTO_FEATURE_FLAG = new FeatureFlag("sub_objects_auto");
51+
public static final boolean SUB_OBJECTS_AUTO_FEATURE_FLAG = new FeatureFlag("sub_objects_auto").isEnabled();
5252
static final NodeFeature SUBOBJECTS_FALSE_MAPPING_UPDATE_FIX = new NodeFeature("mapper.subobjects_false_mapping_update_fix");
5353

5454
public static final String CONTENT_TYPE = "object";
@@ -80,7 +80,7 @@ public static Subobjects from(Object node) {
8080
if (value.equalsIgnoreCase("false")) {
8181
return DISABLED;
8282
}
83-
if (SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled() && value.equalsIgnoreCase("auto")) {
83+
if (SUB_OBJECTS_AUTO_FEATURE_FLAG && value.equalsIgnoreCase("auto")) {
8484
return AUTO;
8585
}
8686
}

server/src/test/java/org/elasticsearch/index/codec/CodecIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void testDefaultCodecLogsdb() {
4848
}
4949

5050
public void testDefaultCodec() {
51-
assumeTrue("Only when zstd_stored_fields feature flag is enabled", CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled());
51+
assumeTrue("Only when zstd_stored_fields feature flag is enabled", CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG);
5252

5353
var indexService = createIndex("index1");
5454
var storedFieldsFormat = (Zstd814StoredFieldsFormat) indexService.getShard(0)

server/src/test/java/org/elasticsearch/index/codec/CodecTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@
4747
public class CodecTests extends ESTestCase {
4848

4949
public void testResolveDefaultCodecs() throws Exception {
50-
assumeTrue("Only when zstd_stored_fields feature flag is enabled", CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled());
50+
assumeTrue("Only when zstd_stored_fields feature flag is enabled", CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG);
5151
CodecService codecService = createCodecService();
5252
assertThat(codecService.codec("default"), instanceOf(PerFieldMapperCodec.class));
5353
assertThat(codecService.codec("default"), instanceOf(Elasticsearch900Lucene101Codec.class));
5454
}
5555

5656
public void testDefault() throws Exception {
57-
assumeTrue("Only when zstd_stored_fields feature flag is enabled", CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled());
57+
assumeTrue("Only when zstd_stored_fields feature flag is enabled", CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG);
5858
Codec codec = createCodecService().codec("default");
5959
assertEquals(
6060
"Zstd814StoredFieldsFormat(compressionMode=ZSTD(level=1), chunkSize=14336, maxDocsPerChunk=128, blockShift=10)",

server/src/test/java/org/elasticsearch/index/mapper/CompletionFieldMapperTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void testPostingsFormat() throws IOException {
152152
MapperService mapperService = createMapperService(fieldMapping(this::minimalMapping));
153153
CodecService codecService = new CodecService(mapperService, BigArrays.NON_RECYCLING_INSTANCE);
154154
Codec codec = codecService.codec("default");
155-
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled()) {
155+
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG) {
156156
assertThat(codec, instanceOf(PerFieldMapperCodec.class));
157157
assertThat(((PerFieldMapperCodec) codec).getPostingsFormatForField("field"), instanceOf(latestLuceneCPClass));
158158
} else {

server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ public void testMalformedDynamicMapping_v7() throws IOException {
14051405
}
14061406

14071407
public void testSubobjectsAutoFlatPaths() throws IOException {
1408-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
1408+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
14091409
MapperService mapperService = createDynamicTemplateAutoSubobjects();
14101410
ParsedDocument doc = mapperService.documentMapper().parse(source(b -> {
14111411
b.field("foo.metric.count", 10);
@@ -1418,7 +1418,7 @@ public void testSubobjectsAutoFlatPaths() throws IOException {
14181418
}
14191419

14201420
public void testSubobjectsAutoStructuredPaths() throws IOException {
1421-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
1421+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
14221422
MapperService mapperService = createDynamicTemplateAutoSubobjects();
14231423
ParsedDocument doc = mapperService.documentMapper().parse(source(b -> {
14241424
b.startObject("foo");
@@ -1441,7 +1441,7 @@ public void testSubobjectsAutoStructuredPaths() throws IOException {
14411441
}
14421442

14431443
public void testSubobjectsAutoArrayOfObjects() throws IOException {
1444-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
1444+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
14451445
MapperService mapperService = createDynamicTemplateAutoSubobjects();
14461446
ParsedDocument doc = mapperService.documentMapper().parse(source(b -> {
14471447
b.startObject("foo");
@@ -1475,7 +1475,7 @@ public void testSubobjectsAutoArrayOfObjects() throws IOException {
14751475
}
14761476

14771477
public void testSubobjectAutoDynamicNested() throws IOException {
1478-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
1478+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
14791479
DocumentMapper mapper = createDocumentMapper(topMapping(b -> {
14801480
b.startArray("dynamic_templates");
14811481
{
@@ -1514,7 +1514,7 @@ public void testSubobjectAutoDynamicNested() throws IOException {
15141514
}
15151515

15161516
public void testRootSubobjectAutoDynamicNested() throws IOException {
1517-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
1517+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
15181518
DocumentMapper mapper = createDocumentMapper(topMapping(b -> {
15191519
b.startArray("dynamic_templates");
15201520
{
@@ -1548,7 +1548,7 @@ public void testRootSubobjectAutoDynamicNested() throws IOException {
15481548
}
15491549

15501550
public void testDynamicSubobjectsAutoDynamicFalse() throws Exception {
1551-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
1551+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
15521552
// verify that we read the dynamic value properly from the parent mapper. DocumentParser#dynamicOrDefault splits the field
15531553
// name where dots are found, but it does that only for the parent prefix e.g. metrics.service and not for the leaf suffix time.max
15541554
DocumentMapper mapper = createDocumentMapper(topMapping(b -> {
@@ -1612,7 +1612,7 @@ public void testDynamicSubobjectsAutoDynamicFalse() throws Exception {
16121612
}
16131613

16141614
public void testSubobjectsAutoWithInnerNestedFromDynamicTemplate() throws IOException {
1615-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
1615+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
16161616
DocumentMapper mapper = createDocumentMapper(topMapping(b -> {
16171617
b.startArray("dynamic_templates");
16181618
{
@@ -2080,7 +2080,7 @@ public void testSubobjectsFalseFlattened() throws IOException {
20802080
}
20812081

20822082
public void testSubobjectsAutoFlattened() throws IOException {
2083-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
2083+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
20842084
String mapping = """
20852085
{
20862086
"_doc": {

server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void testMergeEnabledForIndexTemplates() throws IOException {
169169
assertEquals(ObjectMapper.Subobjects.ENABLED, objectMapper.subobjects());
170170
assertTrue(objectMapper.sourceKeepMode().isEmpty());
171171

172-
if (ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled()) {
172+
if (ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG) {
173173
// Setting 'enabled' to true is allowed, and updates the mapping.
174174
update = Strings.toString(
175175
XContentFactory.jsonBuilder()
@@ -539,7 +539,7 @@ public void testSubobjectsCannotBeUpdatedOnRoot() throws IOException {
539539
}
540540

541541
public void testSubobjectsAuto() throws Exception {
542-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
542+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
543543
MapperService mapperService = createMapperService(mapping(b -> {
544544
b.startObject("metrics.service");
545545
{
@@ -569,7 +569,7 @@ public void testSubobjectsAuto() throws Exception {
569569
}
570570

571571
public void testSubobjectsAutoWithInnerObject() throws IOException {
572-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
572+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
573573
MapperService mapperService = createMapperService(mapping(b -> {
574574
b.startObject("metrics.service");
575575
{
@@ -603,7 +603,7 @@ public void testSubobjectsAutoWithInnerObject() throws IOException {
603603
}
604604

605605
public void testSubobjectsAutoWithInnerNested() throws IOException {
606-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
606+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
607607
MapperService mapperService = createMapperService(mapping(b -> {
608608
b.startObject("metrics.service");
609609
{
@@ -625,7 +625,7 @@ public void testSubobjectsAutoWithInnerNested() throws IOException {
625625
}
626626

627627
public void testSubobjectsAutoRoot() throws Exception {
628-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
628+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
629629
MapperService mapperService = createMapperService(mappingWithSubobjects(b -> {
630630
b.startObject("metrics.service.time");
631631
b.field("type", "long");
@@ -646,7 +646,7 @@ public void testSubobjectsAutoRoot() throws Exception {
646646
}
647647

648648
public void testSubobjectsAutoRootWithInnerObject() throws IOException {
649-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
649+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
650650
MapperService mapperService = createMapperService(mappingWithSubobjects(b -> {
651651
b.startObject("metrics.service.time");
652652
{
@@ -667,7 +667,7 @@ public void testSubobjectsAutoRootWithInnerObject() throws IOException {
667667
}
668668

669669
public void testSubobjectsAutoRootWithInnerNested() throws IOException {
670-
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG.isEnabled());
670+
assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG);
671671
MapperService mapperService = createMapperService(mappingWithSubobjects(b -> {
672672
b.startObject("metrics.service");
673673
b.field("type", "nested");

server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,7 @@ public void testKnnVectorsFormat() throws IOException {
19921992
CodecService codecService = new CodecService(mapperService, BigArrays.NON_RECYCLING_INSTANCE);
19931993
Codec codec = codecService.codec("default");
19941994
KnnVectorsFormat knnVectorsFormat;
1995-
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled()) {
1995+
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG) {
19961996
assertThat(codec, instanceOf(PerFieldMapperCodec.class));
19971997
knnVectorsFormat = ((PerFieldMapperCodec) codec).getKnnVectorsFormatForField("field");
19981998
} else {
@@ -2030,7 +2030,7 @@ public void testKnnQuantizedFlatVectorsFormat() throws IOException {
20302030
CodecService codecService = new CodecService(mapperService, BigArrays.NON_RECYCLING_INSTANCE);
20312031
Codec codec = codecService.codec("default");
20322032
KnnVectorsFormat knnVectorsFormat;
2033-
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled()) {
2033+
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG) {
20342034
assertThat(codec, instanceOf(PerFieldMapperCodec.class));
20352035
knnVectorsFormat = ((PerFieldMapperCodec) codec).getKnnVectorsFormatForField("field");
20362036
} else {
@@ -2081,7 +2081,7 @@ public void testKnnQuantizedHNSWVectorsFormat() throws IOException {
20812081
CodecService codecService = new CodecService(mapperService, BigArrays.NON_RECYCLING_INSTANCE);
20822082
Codec codec = codecService.codec("default");
20832083
KnnVectorsFormat knnVectorsFormat;
2084-
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled()) {
2084+
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG) {
20852085
assertThat(codec, instanceOf(PerFieldMapperCodec.class));
20862086
knnVectorsFormat = ((PerFieldMapperCodec) codec).getKnnVectorsFormatForField("field");
20872087
} else {
@@ -2127,7 +2127,7 @@ public void testKnnBBQHNSWVectorsFormat() throws IOException {
21272127
CodecService codecService = new CodecService(mapperService, BigArrays.NON_RECYCLING_INSTANCE);
21282128
Codec codec = codecService.codec("default");
21292129
KnnVectorsFormat knnVectorsFormat;
2130-
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled()) {
2130+
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG) {
21312131
assertThat(codec, instanceOf(PerFieldMapperCodec.class));
21322132
knnVectorsFormat = ((PerFieldMapperCodec) codec).getKnnVectorsFormatForField("field");
21332133
} else {
@@ -2185,7 +2185,7 @@ public void testKnnHalfByteQuantizedHNSWVectorsFormat() throws IOException {
21852185
CodecService codecService = new CodecService(mapperService, BigArrays.NON_RECYCLING_INSTANCE);
21862186
Codec codec = codecService.codec("default");
21872187
KnnVectorsFormat knnVectorsFormat;
2188-
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG.isEnabled()) {
2188+
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG) {
21892189
assertThat(codec, instanceOf(PerFieldMapperCodec.class));
21902190
knnVectorsFormat = ((PerFieldMapperCodec) codec).getKnnVectorsFormatForField("field");
21912191
} else {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/LogicalPlanBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ private void fail(Expression exp, String message, Object... args) {
362362

363363
@Override
364364
public PlanFactory visitInlinestatsCommand(EsqlBaseParser.InlinestatsCommandContext ctx) {
365-
if (false == EsqlPlugin.INLINESTATS_FEATURE_FLAG.isEnabled()) {
365+
if (false == EsqlPlugin.INLINESTATS_FEATURE_FLAG) {
366366
throw new ParsingException(source(ctx), "INLINESTATS command currently requires a snapshot build");
367367
}
368368
List<Alias> aggFields = visitAggFields(ctx.stats);

0 commit comments

Comments
 (0)