Skip to content

Commit 799fb3a

Browse files
committed
Remove setting
1 parent 9d0a1f8 commit 799fb3a

9 files changed

Lines changed: 39 additions & 150 deletions

File tree

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/TSDBSyntheticIdsIT.java

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,8 @@ public void testInvalidIndexMode() {
104104

105105
public void testSyntheticId() throws Exception {
106106
assumeTrue("Test should only run with feature flag", IndexSettings.TSDB_SYNTHETIC_ID_FEATURE_FLAG);
107-
assumeTrue("Test should only run with feature flag", IndexSettings.USE_STORED_FIELDS_BLOOM_FILTER_FOR_ID_FEATURE_FLAG);
108107
final var dataStreamName = randomIdentifier();
109-
final var enableStoredFieldsBloomFilter = randomBoolean();
110-
putDataStreamTemplate(dataStreamName, randomIntBetween(1, 5), enableStoredFieldsBloomFilter);
108+
putDataStreamTemplate(dataStreamName, randomIntBetween(1, 5));
111109

112110
final var docs = new HashMap<String, String>();
113111
final var unit = randomFrom(ChronoUnit.SECONDS, ChronoUnit.MINUTES);
@@ -271,22 +269,20 @@ enum Operation {
271269
for (var index : indices) {
272270
var diskUsage = diskUsage(index);
273271
var diskUsageIdField = AnalyzeIndexDiskUsageTestUtils.getPerFieldDiskUsage(diskUsage, IdFieldMapper.NAME);
274-
// If the _id stored fields bloom filter is enabled, IndexDiskUsageStats won't account for anything since
275-
// the bloom filter it's not exposed through the Reader API.
276-
if (enableStoredFieldsBloomFilter) {
277-
assertThat(diskUsageIdField, nullValue());
278-
} else {
279-
assertThat("_id field should not have postings on disk", diskUsageIdField.getInvertedIndexBytes(), equalTo(0L));
280-
}
272+
// When _id's are only used to populate the bloom filter,
273+
// IndexDiskUsageStats won't account for anything since
274+
// the bloom filter it's not exposed through the Reader API and
275+
// the analyzer expects to get documents with fields to do the
276+
// disk usage accounting.
277+
assertThat(diskUsageIdField, nullValue());
281278
}
282279
}
283280
}
284281

285282
public void testGetFromTranslogBySyntheticId() throws Exception {
286283
assumeTrue("Test should only run with feature flag", IndexSettings.TSDB_SYNTHETIC_ID_FEATURE_FLAG);
287284
final var dataStreamName = randomIdentifier();
288-
final var enableStoredFieldsBloomFilter = randomBoolean();
289-
putDataStreamTemplate(dataStreamName, 1, enableStoredFieldsBloomFilter);
285+
putDataStreamTemplate(dataStreamName, 1);
290286

291287
final var docs = new HashMap<String, String>();
292288
final var unit = randomFrom(ChronoUnit.SECONDS, ChronoUnit.MINUTES);
@@ -393,13 +389,12 @@ public void testGetFromTranslogBySyntheticId() throws Exception {
393389
for (var index : indices) {
394390
var diskUsage = diskUsage(index);
395391
var diskUsageIdField = AnalyzeIndexDiskUsageTestUtils.getPerFieldDiskUsage(diskUsage, IdFieldMapper.NAME);
396-
// If the _id stored fields bloom filter is enabled, IndexDiskUsageStats won't account for anything since
397-
// the bloom filter it's not exposed through the Reader API.
398-
if (enableStoredFieldsBloomFilter) {
399-
assertThat(diskUsageIdField, nullValue());
400-
} else {
401-
assertThat("_id field should not have postings on disk", diskUsageIdField.getInvertedIndexBytes(), equalTo(0L));
402-
}
392+
// When _id's are only used to populate the bloom filter,
393+
// IndexDiskUsageStats won't account for anything since
394+
// the bloom filter it's not exposed through the Reader API and
395+
// the analyzer expects to get documents with fields to do the
396+
// disk usage accounting.
397+
assertThat(diskUsageIdField, nullValue());
403398
}
404399
}
405400

@@ -437,12 +432,11 @@ private static BulkItemResponse[] createDocuments(String indexName, XContentBuil
437432
return bulkResponse.getItems();
438433
}
439434

440-
private static void putDataStreamTemplate(String indexPattern, int shards, boolean enableStoredFieldsBloomFilter) throws IOException {
435+
private static void putDataStreamTemplate(String indexPattern, int shards) throws IOException {
441436
final var settings = indexSettings(shards, 0).put(IndexSettings.MODE.getKey(), IndexMode.TIME_SERIES.getName())
442437
.put(IndexSettings.BLOOM_FILTER_ID_FIELD_ENABLED_SETTING.getKey(), false)
443438
.put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), -1)
444-
.put(IndexSettings.USE_SYNTHETIC_ID.getKey(), true)
445-
.put(IndexSettings.USE_STORED_FIELD_BLOOM_FILTER_ID.getKey(), enableStoredFieldsBloomFilter);
439+
.put(IndexSettings.USE_SYNTHETIC_ID.getKey(), true);
446440

447441
final var mappings = """
448442
{

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,6 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
252252
if (IndexSettings.TSDB_SYNTHETIC_ID_FEATURE_FLAG) {
253253
settings.add(IndexSettings.USE_SYNTHETIC_ID);
254254
}
255-
if (IndexSettings.USE_STORED_FIELDS_BLOOM_FILTER_FOR_ID_FEATURE_FLAG) {
256-
settings.add(IndexSettings.USE_STORED_FIELD_BLOOM_FILTER_ID);
257-
}
258255
settings.add(IndexSettings.INDEX_MAPPING_EXCLUDE_SOURCE_VECTORS_SETTING);
259256
BUILT_IN_INDEX_SETTINGS = Collections.unmodifiableSet(settings);
260257
};

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

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -735,57 +735,6 @@ public Iterator<Setting<?>> settings() {
735735
Property.Final
736736
);
737737

738-
public static final boolean USE_STORED_FIELDS_BLOOM_FILTER_FOR_ID_FEATURE_FLAG = new FeatureFlag("stored_field_bloom_filter")
739-
.isEnabled();
740-
public static final Setting<Boolean> USE_STORED_FIELD_BLOOM_FILTER_ID = Setting.boolSetting(
741-
"index.mapping.use_stored_field_bloom_filter_id",
742-
false,
743-
new Setting.Validator<>() {
744-
@Override
745-
public void validate(Boolean enabled) {
746-
if (enabled) {
747-
if (USE_STORED_FIELDS_BLOOM_FILTER_FOR_ID_FEATURE_FLAG == false) {
748-
throw new IllegalArgumentException(
749-
String.format(
750-
Locale.ROOT,
751-
"The setting [%s] is only permitted when the feature flag is enabled.",
752-
USE_STORED_FIELD_BLOOM_FILTER_ID.getKey()
753-
)
754-
);
755-
}
756-
}
757-
}
758-
759-
@Override
760-
public void validate(Boolean enabled, Map<Setting<?>, Object> settings) {
761-
if (enabled) {
762-
// Verify if index mode is TIME_SERIES
763-
var indexMode = (IndexMode) settings.get(MODE);
764-
if (indexMode != IndexMode.TIME_SERIES) {
765-
throw new IllegalArgumentException(
766-
String.format(
767-
Locale.ROOT,
768-
"The setting [%s] is only permitted when [%s] is set to [%s]. Current mode: [%s].",
769-
USE_STORED_FIELD_BLOOM_FILTER_ID.getKey(),
770-
MODE.getKey(),
771-
IndexMode.TIME_SERIES.name(),
772-
indexMode.name()
773-
)
774-
);
775-
}
776-
}
777-
}
778-
779-
@Override
780-
public Iterator<Setting<?>> settings() {
781-
List<Setting<?>> list = List.of(MODE);
782-
return list.iterator();
783-
}
784-
},
785-
Property.IndexScope,
786-
Property.Final
787-
);
788-
789738
/**
790739
* The {@link IndexMode "mode"} of the index.
791740
*/
@@ -1071,7 +1020,6 @@ private void setRetentionLeaseMillis(final TimeValue retentionLease) {
10711020
private final boolean useTimeSeriesSyntheticId;
10721021
private final boolean useTimeSeriesDocValuesFormat;
10731022
private final boolean useEs812PostingsFormat;
1074-
private final boolean useStoredFieldsBloomFilterForId;
10751023

10761024
/**
10771025
* The maximum number of refresh listeners allows on this shard.
@@ -1282,12 +1230,6 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
12821230
} else {
12831231
useTimeSeriesSyntheticId = false;
12841232
}
1285-
useStoredFieldsBloomFilterForId = IndexSettings.USE_STORED_FIELDS_BLOOM_FILTER_FOR_ID_FEATURE_FLAG
1286-
&& scopedSettings.get(USE_STORED_FIELD_BLOOM_FILTER_ID);
1287-
if (useStoredFieldsBloomFilterForId) {
1288-
assert indexMetadata.getIndexMode() == IndexMode.TIME_SERIES : indexMetadata.getIndexMode();
1289-
assert indexMetadata.getCreationVersion().onOrAfter(IndexVersions.TIME_SERIES_USE_STORED_FIELDS_BLOOM_FILTER_FOR_ID);
1290-
}
12911233
if (recoverySourceSyntheticEnabled) {
12921234
if (DiscoveryNode.isStateless(settings)) {
12931235
throw new IllegalArgumentException("synthetic recovery source is only allowed in stateful");
@@ -2027,13 +1969,6 @@ public boolean useTimeSeriesSyntheticId() {
20271969
return useTimeSeriesSyntheticId;
20281970
}
20291971

2030-
/**
2031-
* @return whether _id fields are stored as bloom filters in time-series indices for fast lookups.
2032-
*/
2033-
public boolean useStoredFieldsBloomFilterForId() {
2034-
return useStoredFieldsBloomFilterForId;
2035-
}
2036-
20371972
/**
20381973
* @return Whether the time series doc value format should be used.
20391974
*/

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

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.elasticsearch.core.Nullable;
1919
import org.elasticsearch.index.IndexMode;
2020
import org.elasticsearch.index.IndexSettings;
21+
import org.elasticsearch.index.IndexVersions;
2122
import org.elasticsearch.index.codec.zstd.Zstd814StoredFieldsFormat;
2223
import org.elasticsearch.index.mapper.MapperService;
2324

@@ -51,12 +52,11 @@ public CodecService(@Nullable MapperService mapperService, BigArrays bigArrays)
5152
boolean useSyntheticId = IndexSettings.TSDB_SYNTHETIC_ID_FEATURE_FLAG
5253
&& mapperService != null
5354
&& mapperService.getIndexSettings().useTimeSeriesSyntheticId()
55+
&& mapperService.getIndexSettings()
56+
.getIndexVersionCreated()
57+
.onOrAfter(IndexVersions.TIME_SERIES_USE_STORED_FIELDS_BLOOM_FILTER_FOR_ID)
5458
&& mapperService.getIndexSettings().getMode() == IndexMode.TIME_SERIES;
5559

56-
boolean syntheticIdBloomFilterEnabled = IndexSettings.USE_STORED_FIELDS_BLOOM_FILTER_FOR_ID_FEATURE_FLAG
57-
&& mapperService != null
58-
&& mapperService.getIndexSettings().useStoredFieldsBloomFilterForId();
59-
6060
var legacyBestSpeedCodec = new LegacyPerFieldMapperCodec(Lucene103Codec.Mode.BEST_SPEED, mapperService, bigArrays);
6161
if (ZSTD_STORED_FIELDS_FEATURE_FLAG) {
6262
PerFieldMapperCodec defaultZstdCodec = new PerFieldMapperCodec(
@@ -66,47 +66,37 @@ public CodecService(@Nullable MapperService mapperService, BigArrays bigArrays)
6666
);
6767
codecs.put(
6868
DEFAULT_CODEC,
69-
useSyntheticId
70-
? new ES93TSDBZSTDCompressionLucene103Codec(defaultZstdCodec, bigArrays, syntheticIdBloomFilterEnabled)
71-
: defaultZstdCodec
69+
useSyntheticId ? new ES93TSDBZSTDCompressionLucene103Codec(defaultZstdCodec, bigArrays) : defaultZstdCodec
7270
);
7371
} else {
7472
codecs.put(
7573
DEFAULT_CODEC,
76-
useSyntheticId
77-
? new ES93TSDBDefaultCompressionLucene103Codec(legacyBestSpeedCodec, bigArrays, syntheticIdBloomFilterEnabled)
78-
: legacyBestSpeedCodec
74+
useSyntheticId ? new ES93TSDBDefaultCompressionLucene103Codec(legacyBestSpeedCodec, bigArrays) : legacyBestSpeedCodec
7975
);
8076
}
8177

8278
codecs.put(
8379
LEGACY_DEFAULT_CODEC,
84-
useSyntheticId
85-
? new ES93TSDBDefaultCompressionLucene103Codec(legacyBestSpeedCodec, bigArrays, syntheticIdBloomFilterEnabled)
86-
: legacyBestSpeedCodec
80+
useSyntheticId ? new ES93TSDBDefaultCompressionLucene103Codec(legacyBestSpeedCodec, bigArrays) : legacyBestSpeedCodec
8781
);
8882

8983
var bestCompressionCodec = new PerFieldMapperCodec(Zstd814StoredFieldsFormat.Mode.BEST_COMPRESSION, mapperService, bigArrays);
9084
codecs.put(
9185
BEST_COMPRESSION_CODEC,
92-
useSyntheticId
93-
? new ES93TSDBZSTDCompressionLucene103Codec(bestCompressionCodec, bigArrays, syntheticIdBloomFilterEnabled)
94-
: bestCompressionCodec
86+
useSyntheticId ? new ES93TSDBZSTDCompressionLucene103Codec(bestCompressionCodec, bigArrays) : bestCompressionCodec
9587
);
9688

9789
var legacyBestCompressionCodec = new LegacyPerFieldMapperCodec(Lucene103Codec.Mode.BEST_COMPRESSION, mapperService, bigArrays);
9890
codecs.put(
9991
LEGACY_BEST_COMPRESSION_CODEC,
10092
useSyntheticId
101-
? new ES93TSDBDefaultCompressionLucene103Codec(legacyBestCompressionCodec, bigArrays, syntheticIdBloomFilterEnabled)
93+
? new ES93TSDBDefaultCompressionLucene103Codec(legacyBestCompressionCodec, bigArrays)
10294
: legacyBestCompressionCodec
10395
);
10496

10597
codecs.put(
10698
LUCENE_DEFAULT_CODEC,
107-
useSyntheticId
108-
? new ES93TSDBLuceneDefaultCodec(Codec.getDefault(), bigArrays, syntheticIdBloomFilterEnabled)
109-
: Codec.getDefault()
99+
useSyntheticId ? new ES93TSDBLuceneDefaultCodec(Codec.getDefault(), bigArrays) : Codec.getDefault()
110100
);
111101
for (String codec : Codec.availableCodecs()) {
112102
codecs.put(codec, Codec.forName(codec));

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
public class ES93TSDBDefaultCompressionLucene103Codec extends TSDBCodecWithSyntheticId {
1616
/** Public no-arg constructor, needed for SPI loading at read-time. */
1717
public ES93TSDBDefaultCompressionLucene103Codec() {
18-
this(new Lucene103Codec(), null, true);
18+
this(new Lucene103Codec(), null);
1919
}
2020

21-
ES93TSDBDefaultCompressionLucene103Codec(Lucene103Codec delegate, BigArrays bigArrays, boolean bloomFilterEnabled) {
22-
super("ES93TSDBDefaultCompressionLucene103Codec", delegate, bigArrays, bloomFilterEnabled);
21+
ES93TSDBDefaultCompressionLucene103Codec(Lucene103Codec delegate, BigArrays bigArrays) {
22+
super("ES93TSDBDefaultCompressionLucene103Codec", delegate, bigArrays);
2323
}
2424
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
public class ES93TSDBLuceneDefaultCodec extends TSDBCodecWithSyntheticId {
1717
/** Public no-arg constructor, needed for SPI loading at read-time. */
1818
public ES93TSDBLuceneDefaultCodec() {
19-
this(new Lucene103Codec(), null, true);
19+
this(new Lucene103Codec(), null);
2020
}
2121

22-
ES93TSDBLuceneDefaultCodec(Codec delegate, BigArrays bigArrays, boolean bloomFilterEnabled) {
23-
super("ES93TSDBLuceneDefaultCodec", delegate, bigArrays, bloomFilterEnabled);
22+
ES93TSDBLuceneDefaultCodec(Codec delegate, BigArrays bigArrays) {
23+
super("ES93TSDBLuceneDefaultCodec", delegate, bigArrays);
2424
}
2525
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
public class ES93TSDBZSTDCompressionLucene103Codec extends TSDBCodecWithSyntheticId {
1515
/** Public no-arg constructor, needed for SPI loading at read-time. */
1616
public ES93TSDBZSTDCompressionLucene103Codec() {
17-
this(new Elasticsearch92Lucene103Codec(), null, true);
17+
this(new Elasticsearch92Lucene103Codec(), null);
1818
}
1919

20-
ES93TSDBZSTDCompressionLucene103Codec(Elasticsearch92Lucene103Codec delegate, BigArrays bigArrays, boolean bloomFilterEnabled) {
21-
super("ES93TSDBZSTDCompressionLucene103Codec", delegate, bigArrays, bloomFilterEnabled);
20+
ES93TSDBZSTDCompressionLucene103Codec(Elasticsearch92Lucene103Codec delegate, BigArrays bigArrays) {
21+
super("ES93TSDBZSTDCompressionLucene103Codec", delegate, bigArrays);
2222
}
2323
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@
3737
abstract class TSDBCodecWithSyntheticId extends FilterCodec {
3838
private final TSDBStoredFieldsFormat storedFieldsFormat;
3939

40-
TSDBCodecWithSyntheticId(String name, Codec delegate, BigArrays bigArrays, boolean bloomFilterEnabled) {
40+
TSDBCodecWithSyntheticId(String name, Codec delegate, BigArrays bigArrays) {
4141
super(name, new TSDBSyntheticIdCodec(delegate));
4242
this.storedFieldsFormat = new TSDBStoredFieldsFormat(
4343
delegate.storedFieldsFormat(),
4444
new ES93BloomFilterStoredFieldsFormat(
4545
bigArrays,
4646
ES93BloomFilterStoredFieldsFormat.DEFAULT_BLOOM_FILTER_SIZE,
47-
IdFieldMapper.NAME,
48-
bloomFilterEnabled
47+
IdFieldMapper.NAME
4948
)
5049
);
5150
}

server/src/main/java/org/elasticsearch/index/codec/bloomfilter/ES93BloomFilterStoredFieldsFormat.java

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public class ES93BloomFilterStoredFieldsFormat extends StoredFieldsFormat {
9090

9191
private final BigArrays bigArrays;
9292
private final String bloomFilterFieldName;
93-
private boolean enabled;
9493
private final int numHashFunctions;
9594
private final int bloomFilterSizeInBits;
9695

@@ -103,18 +102,8 @@ public ES93BloomFilterStoredFieldsFormat() {
103102
}
104103

105104
public ES93BloomFilterStoredFieldsFormat(BigArrays bigArrays, ByteSizeValue bloomFilterSize, String bloomFilterFieldName) {
106-
this(bigArrays, bloomFilterSize, bloomFilterFieldName, true);
107-
}
108-
109-
public ES93BloomFilterStoredFieldsFormat(
110-
BigArrays bigArrays,
111-
ByteSizeValue bloomFilterSize,
112-
String bloomFilterFieldName,
113-
boolean enabled
114-
) {
115105
this.bigArrays = bigArrays;
116106
this.bloomFilterFieldName = bloomFilterFieldName;
117-
this.enabled = enabled;
118107
this.numHashFunctions = DEFAULT_NUM_HASH_FUNCTIONS;
119108

120109
if (bloomFilterSize.getBytes() <= 0) {
@@ -136,16 +125,7 @@ public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, IOCo
136125
assert numHashFunctions > 0;
137126
assert bloomFilterSizeInBits > 0;
138127
// TODO: compute the bloom filter size based on heuristics and oversize factor
139-
return new Writer(
140-
directory,
141-
si,
142-
context,
143-
bigArrays,
144-
numHashFunctions,
145-
this::getBloomFilterSizeInBits,
146-
bloomFilterFieldName,
147-
enabled
148-
);
128+
return new Writer(directory, si, context, bigArrays, numHashFunctions, this::getBloomFilterSizeInBits, bloomFilterFieldName);
149129
}
150130

151131
int getBloomFilterSizeInBits() {
@@ -173,7 +153,6 @@ static class Writer extends StoredFieldsWriter {
173153
private final IOContext context;
174154
private final BigArrays bigArrays;
175155
private final IntSupplier defaultBloomFilterSizeInBitsSupplier;
176-
private final boolean enabled;
177156
private final int numHashFunctions;
178157
private final String bloomFilterFieldName;
179158
private final List<Closeable> toClose = new ArrayList<>();
@@ -188,15 +167,13 @@ static class Writer extends StoredFieldsWriter {
188167
BigArrays bigArrays,
189168
int numHashFunctions,
190169
IntSupplier defaultBloomFilterSizeInBitsSupplier,
191-
String bloomFilterFieldName,
192-
boolean enabled
170+
String bloomFilterFieldName
193171
) throws IOException {
194172
this.directory = directory;
195173
this.segmentInfo = segmentInfo;
196174
this.context = context;
197175
this.bigArrays = bigArrays;
198176
this.defaultBloomFilterSizeInBitsSupplier = defaultBloomFilterSizeInBitsSupplier;
199-
this.enabled = enabled;
200177
assert numHashFunctions <= PRIMES.length
201178
: "Number of hash functions must be <= " + PRIMES.length + " but was " + numHashFunctions;
202179

@@ -285,9 +262,6 @@ private int getBloomFilterSizeInBits() {
285262

286263
private void addToBloomFilter(FieldInfo info, BytesRef value) throws IOException {
287264
assert info.getName().equals(bloomFilterFieldName) : "Expected " + bloomFilterFieldName + " but got " + info;
288-
if (enabled == false) {
289-
return;
290-
}
291265
maybeInitializeBloomFilterWriter(info, getBloomFilterSizeInBits());
292266
bloomFilterWriter.add(value);
293267
}

0 commit comments

Comments
 (0)