Skip to content

Commit 646c566

Browse files
committed
Revert node setting for jvm env variable.
1 parent 27efdd2 commit 646c566

File tree

8 files changed

+22
-26
lines changed

8 files changed

+22
-26
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/index/codec/tsdb/TSDBDocValuesMergeBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private IndexWriter createIndex(final Directory directory, final boolean optimiz
107107
new SortedNumericSortField(TIMESTAMP_FIELD, SortField.Type.LONG, true)
108108
)
109109
);
110-
ES87TSDBDocValuesFormat docValuesFormat = new ES87TSDBDocValuesFormat(optimizedMergeEnabled);
110+
ES87TSDBDocValuesFormat docValuesFormat = new ES87TSDBDocValuesFormat(4096, optimizedMergeEnabled);
111111
config.setCodec(new Lucene101Codec() {
112112

113113
@Override

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
import org.elasticsearch.index.IndexSettings;
9090
import org.elasticsearch.index.IndexingPressure;
9191
import org.elasticsearch.index.MergePolicyConfig;
92-
import org.elasticsearch.index.codec.CodecService;
9392
import org.elasticsearch.index.engine.ThreadPoolMergeScheduler;
9493
import org.elasticsearch.index.shard.IndexingStatsSettings;
9594
import org.elasticsearch.indices.IndexingMemoryController;
@@ -636,7 +635,6 @@ public void apply(Settings value, Settings current, Settings previous) {
636635
ShardsAvailabilityHealthIndicatorService.REPLICA_UNASSIGNED_BUFFER_TIME,
637636
DataStream.isFailureStoreFeatureFlagEnabled() ? DataStreamFailureStoreSettings.DATA_STREAM_FAILURE_STORED_ENABLED_SETTING : null,
638637
IndexingStatsSettings.RECENT_WRITE_LOAD_HALF_LIFE_SETTING,
639-
TransportGetAllocationStatsAction.CACHE_TTL_SETTING,
640-
CodecService.TSDB_DOC_VALUES_OPTIMIZED_MERGE_SETTING
638+
TransportGetAllocationStatsAction.CACHE_TTL_SETTING
641639
).filter(Objects::nonNull).collect(toSet());
642640
}

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.apache.lucene.codecs.FieldInfosFormat;
1414
import org.apache.lucene.codecs.FilterCodec;
1515
import org.apache.lucene.codecs.lucene101.Lucene101Codec;
16-
import org.elasticsearch.common.settings.Setting;
1716
import org.elasticsearch.common.util.BigArrays;
1817
import org.elasticsearch.common.util.FeatureFlag;
1918
import org.elasticsearch.core.Nullable;
@@ -33,12 +32,6 @@
3332
public class CodecService implements CodecProvider {
3433

3534
public static final FeatureFlag ZSTD_STORED_FIELDS_FEATURE_FLAG = new FeatureFlag("zstd_stored_fields");
36-
public static final FeatureFlag TSDB_DOC_VALUES_OPTIMIZED_MERGE = new FeatureFlag("tsdb_doc_values_codec_optimized_merge");
37-
public static Setting<Boolean> TSDB_DOC_VALUES_OPTIMIZED_MERGE_SETTING = Setting.boolSetting(
38-
"indices.time_series.doc_values_codec_optimized_merge",
39-
TSDB_DOC_VALUES_OPTIMIZED_MERGE.isEnabled(),
40-
Setting.Property.NodeScope
41-
);
4235

4336
private final Map<String, Codec> codecs;
4437

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.apache.lucene.codecs.PostingsFormat;
1515
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat;
1616
import org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat;
17-
import org.elasticsearch.common.settings.Settings;
1817
import org.elasticsearch.common.util.BigArrays;
1918
import org.elasticsearch.index.IndexMode;
2019
import org.elasticsearch.index.IndexSettings;
@@ -35,17 +34,15 @@ public class PerFieldFormatSupplier {
3534

3635
private static final DocValuesFormat docValuesFormat = new Lucene90DocValuesFormat();
3736
private static final KnnVectorsFormat knnVectorsFormat = new Lucene99HnswVectorsFormat();
37+
private static final ES87TSDBDocValuesFormat tsdbDocValuesFormat = new ES87TSDBDocValuesFormat();
3838
private static final ES812PostingsFormat es812PostingsFormat = new ES812PostingsFormat();
3939
private static final PostingsFormat completionPostingsFormat = PostingsFormat.forName("Completion101");
4040

41-
private final ES87TSDBDocValuesFormat tsdbDocValuesFormat;
4241
private final ES87BloomFilterPostingsFormat bloomFilterPostingsFormat;
4342
private final MapperService mapperService;
4443

4544
public PerFieldFormatSupplier(MapperService mapperService, BigArrays bigArrays) {
4645
this.mapperService = mapperService;
47-
var nodeSettings = mapperService != null ? mapperService.getIndexSettings().getNodeSettings() : Settings.EMPTY;
48-
this.tsdbDocValuesFormat = new ES87TSDBDocValuesFormat(CodecService.TSDB_DOC_VALUES_OPTIMIZED_MERGE_SETTING.get(nodeSettings));
4946
this.bloomFilterPostingsFormat = new ES87BloomFilterPostingsFormat(bigArrays, this::internalGetPostingsFormatForField);
5047
}
5148

server/src/main/java/org/elasticsearch/index/codec/tsdb/ES87TSDBDocValuesFormat.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
import org.apache.lucene.codecs.DocValuesProducer;
1414
import org.apache.lucene.index.SegmentReadState;
1515
import org.apache.lucene.index.SegmentWriteState;
16+
import org.elasticsearch.common.util.FeatureFlag;
1617

1718
import java.io.IOException;
1819

19-
import static org.elasticsearch.index.codec.CodecService.TSDB_DOC_VALUES_OPTIMIZED_MERGE;
20-
2120
public class ES87TSDBDocValuesFormat extends org.apache.lucene.codecs.DocValuesFormat {
2221

2322
static final int NUMERIC_BLOCK_SHIFT = 7;
@@ -77,16 +76,25 @@ public class ES87TSDBDocValuesFormat extends org.apache.lucene.codecs.DocValuesF
7776
}
7877
}
7978

79+
// Default for escape hatch:
80+
static final boolean OPTIMIZED_MERGE_ENABLE_DEFAULT;
81+
static final FeatureFlag TSDB_DOC_VALUES_OPTIMIZED_MERGE = new FeatureFlag("tsdb_doc_values_optimized_merge");
82+
static final String OPTIMIZED_MERGE_ENABLED_NAME = ES87TSDBDocValuesConsumer.class.getName() + ".enableOptimizedMerge";
83+
84+
static {
85+
boolean optimizedMergeDefault = TSDB_DOC_VALUES_OPTIMIZED_MERGE.isEnabled();
86+
OPTIMIZED_MERGE_ENABLE_DEFAULT = Boolean.parseBoolean(
87+
System.getProperty(OPTIMIZED_MERGE_ENABLED_NAME, Boolean.toString(optimizedMergeDefault))
88+
);
89+
}
90+
8091
private final int skipIndexIntervalSize;
92+
// TODO: remove escape hatch? Is useful now when testing/benchmarking, but current optimized merge logic currently do too scary things.
8193
private final boolean enableOptimizedMerge;
8294

8395
/** Default constructor. */
8496
public ES87TSDBDocValuesFormat() {
85-
this(TSDB_DOC_VALUES_OPTIMIZED_MERGE.isEnabled());
86-
}
87-
88-
public ES87TSDBDocValuesFormat(boolean enableOptimizedMerge) {
89-
this(DEFAULT_SKIP_INDEX_INTERVAL_SIZE, enableOptimizedMerge);
97+
this(DEFAULT_SKIP_INDEX_INTERVAL_SIZE, OPTIMIZED_MERGE_ENABLE_DEFAULT);
9098
}
9199

92100
/** Doc values fields format with specified skipIndexIntervalSize. */

server/src/test/java/org/elasticsearch/index/codec/tsdb/DocValuesCodecDuelTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void testDuel() throws IOException {
4848
baselineConfig.setMergePolicy(mergePolicy);
4949
baselineConfig.setCodec(TestUtil.alwaysDocValuesFormat(new Lucene90DocValuesFormat()));
5050
var contenderConf = newIndexWriterConfig();
51-
contenderConf.setCodec(TestUtil.alwaysDocValuesFormat(new ES87TSDBDocValuesFormat(true)));
51+
contenderConf.setCodec(TestUtil.alwaysDocValuesFormat(new ES87TSDBDocValuesFormat()));
5252
contenderConf.setMergePolicy(mergePolicy);
5353

5454
try (

server/src/test/java/org/elasticsearch/index/codec/tsdb/ES87TSDBDocValuesFormatTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class ES87TSDBDocValuesFormatTests extends BaseDocValuesFormatTestCase {
5454

5555
private static final int NUM_DOCS = 10;
5656

57-
private final Codec codec = TestUtil.alwaysDocValuesFormat(new ES87TSDBDocValuesFormat(true));
57+
private final Codec codec = TestUtil.alwaysDocValuesFormat(new ES87TSDBDocValuesFormat());
5858

5959
@Override
6060
protected Codec getCodec() {

server/src/test/java/org/elasticsearch/index/codec/tsdb/ES87TSDBDocValuesFormatVariableSkipIntervalTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public class ES87TSDBDocValuesFormatVariableSkipIntervalTests extends BaseDocVal
3232
@Override
3333
protected Codec getCodec() {
3434
// small interval size to test with many intervals
35-
return TestUtil.alwaysDocValuesFormat(new ES87TSDBDocValuesFormat(random().nextInt(4, 16), true));
35+
return TestUtil.alwaysDocValuesFormat(new ES87TSDBDocValuesFormat(random().nextInt(4, 16), false));
3636
}
3737

3838
public void testSkipIndexIntervalSize() {
3939
IllegalArgumentException ex = expectThrows(
4040
IllegalArgumentException.class,
41-
() -> new ES87TSDBDocValuesFormat(random().nextInt(Integer.MIN_VALUE, 2), true)
41+
() -> new ES87TSDBDocValuesFormat(random().nextInt(Integer.MIN_VALUE, 2), false)
4242
);
4343
assertTrue(ex.getMessage().contains("skipIndexIntervalSize must be > 1"));
4444
}

0 commit comments

Comments
 (0)