Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.index.IndexSettingProvider;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.repositories.RepositoriesService;
Expand Down Expand Up @@ -99,10 +98,6 @@ static void additionalLookAheadTimeValidation(TimeValue lookAhead, TimeValue tim

@Override
public List<Setting<?>> getSettings() {
if (IndexSettings.isTimeSeriesModeEnabled() == false) {
return List.of();
}

return List.of(TIME_SERIES_POLL_INTERVAL, LOOK_AHEAD_TIME);
}

Expand All @@ -120,10 +115,6 @@ public Collection<Object> createComponents(
IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<RepositoriesService> repositoriesServiceSupplier
) {
if (IndexSettings.isTimeSeriesModeEnabled() == false) {
return List.of();
}

var service = new UpdateTimeSeriesRangeService(environment.settings(), threadPool, clusterService);
this.service.set(service);
return List.of(service);
Expand Down Expand Up @@ -151,12 +142,10 @@ public List<RestHandler> getRestHandlers(
IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<DiscoveryNodes> nodesInCluster
) {
if (IndexSettings.isTimeSeriesModeEnabled()) {
indexScopedSettings.addSettingsUpdateConsumer(LOOK_AHEAD_TIME, value -> {
TimeValue timeSeriesPollInterval = service.get().pollInterval;
additionalLookAheadTimeValidation(value, timeSeriesPollInterval);
});
}
indexScopedSettings.addSettingsUpdateConsumer(LOOK_AHEAD_TIME, value -> {
TimeValue timeSeriesPollInterval = service.get().pollInterval;
additionalLookAheadTimeValidation(value, timeSeriesPollInterval);
});

var createDsAction = new RestCreateDataStreamAction();
var deleteDsAction = new RestDeleteDataStreamAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1954,9 +1954,7 @@ public IndexMetadata build() {

final boolean isSearchableSnapshot = SearchableSnapshotsSettings.isSearchableSnapshotStore(settings);
final String indexMode = settings.get(IndexSettings.MODE.getKey());
final boolean isTsdb = IndexSettings.isTimeSeriesModeEnabled()
&& indexMode != null
&& IndexMode.TIME_SERIES.getName().equals(indexMode.toLowerCase(Locale.ROOT));
final boolean isTsdb = indexMode != null && IndexMode.TIME_SERIES.getName().equals(indexMode.toLowerCase(Locale.ROOT));
return new IndexMetadata(
new Index(index, uuid),
version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.elasticsearch.indices.ShardLimitValidator;

import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -162,6 +161,11 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
DiskThresholdDecider.SETTING_IGNORE_DISK_WATERMARKS,
ShardLimitValidator.INDEX_SETTING_SHARD_LIMIT_GROUP,
DataTier.TIER_PREFERENCE_SETTING,
// TSDB
IndexSettings.MODE,
IndexMetadata.INDEX_ROUTING_PATH,
IndexSettings.TIME_SERIES_START_TIME,
IndexSettings.TIME_SERIES_END_TIME,

// validate that built-in similarities don't get redefined
Setting.groupSetting("index.similarity.", (s) -> {
Expand All @@ -180,15 +184,7 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
public static final Set<Setting<?>> BUILT_IN_INDEX_SETTINGS = builtInIndexSettings();

private static Set<Setting<?>> builtInIndexSettings() {
if (false == IndexSettings.isTimeSeriesModeEnabled()) {
return ALWAYS_ENABLED_BUILT_IN_INDEX_SETTINGS;
}
Set<Setting<?>> result = new HashSet<>(ALWAYS_ENABLED_BUILT_IN_INDEX_SETTINGS);
result.add(IndexSettings.MODE);
result.add(IndexMetadata.INDEX_ROUTING_PATH);
result.add(IndexSettings.TIME_SERIES_START_TIME);
result.add(IndexSettings.TIME_SERIES_END_TIME);
return Set.copyOf(result);
return ALWAYS_ENABLED_BUILT_IN_INDEX_SETTINGS;
}

public static final IndexScopedSettings DEFAULT_SCOPED_SETTINGS = new IndexScopedSettings(Settings.EMPTY, BUILT_IN_INDEX_SETTINGS);
Expand Down
22 changes: 1 addition & 21 deletions server/src/main/java/org/elasticsearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.util.Strings;
import org.apache.lucene.index.MergePolicy;
import org.elasticsearch.Build;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.routing.IndexRouting;
Expand All @@ -23,7 +22,6 @@
import org.elasticsearch.common.time.DateUtils;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.core.Booleans;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.translog.Translog;
import org.elasticsearch.ingest.IngestService;
Expand Down Expand Up @@ -455,24 +453,6 @@ public final class IndexSettings {
Setting.Property.IndexScope
);

/**
* Is the {@code index.mode} enabled? It should only be enbaled if you
* pass a jvm parameter or are running a snapshot build.
*/
private static final Boolean TIME_SERIES_MODE_FEATURE_FLAG_REGISTERED;

static {
final String property = System.getProperty("es.index_mode_feature_flag_registered");
if (Build.CURRENT.isSnapshot() && property != null) {
throw new IllegalArgumentException("es.index_mode_feature_flag_registered is only supported in non-snapshot builds");
}
TIME_SERIES_MODE_FEATURE_FLAG_REGISTERED = Booleans.parseBoolean(property, null);
}

public static boolean isTimeSeriesModeEnabled() {
return Build.CURRENT.isSnapshot() || (TIME_SERIES_MODE_FEATURE_FLAG_REGISTERED != null && TIME_SERIES_MODE_FEATURE_FLAG_REGISTERED);
}

/**
* in time series mode, the start time of the index, timestamp must larger than start_time
*/
Expand Down Expand Up @@ -696,7 +676,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
nodeName = Node.NODE_NAME_SETTING.get(settings);
this.indexMetadata = indexMetadata;
numberOfShards = settings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_SHARDS, null);
mode = isTimeSeriesModeEnabled() ? scopedSettings.get(MODE) : IndexMode.STANDARD;
mode = scopedSettings.get(MODE);
this.timestampBounds = mode.getTimestampBound(indexMetadata);
if (timestampBounds != null) {
scopedSettings.addSettingsUpdateConsumer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.common.xcontent.XContentFieldFilter;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.query.QueryShardException;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.xcontent.XContentType;
Expand Down Expand Up @@ -104,10 +103,7 @@ public Builder() {

@Override
protected Parameter<?>[] getParameters() {
if (IndexSettings.isTimeSeriesModeEnabled()) {
return new Parameter<?>[] { enabled, mode, includes, excludes };
}
return new Parameter<?>[] { enabled, includes, excludes };
return new Parameter<?>[] { enabled, mode, includes, excludes };
}

private boolean isDefault() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
Expand Down Expand Up @@ -79,7 +78,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
getRequest.versionType(VersionType.fromString(request.param("version_type"), getRequest.versionType()));

getRequest.fetchSourceContext(FetchSourceContext.parseFromRestRequest(request));
if (IndexSettings.isTimeSeriesModeEnabled() && request.paramAsBoolean("force_synthetic_source", false)) {
if (request.paramAsBoolean("force_synthetic_source", false)) {
getRequest.setForceSyntheticSource(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
Expand Down Expand Up @@ -61,7 +60,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
multiGetRequest.refresh(request.paramAsBoolean("refresh", multiGetRequest.refresh()));
multiGetRequest.preference(request.param("preference"));
multiGetRequest.realtime(request.paramAsBoolean("realtime", multiGetRequest.realtime()));
if (IndexSettings.isTimeSeriesModeEnabled() && request.paramAsBoolean("force_synthetic_source", false)) {
if (request.paramAsBoolean("force_synthetic_source", false)) {
multiGetRequest.setForceSyntheticSource(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.core.Booleans;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
Expand Down Expand Up @@ -209,7 +208,7 @@ public static void parseSearchRequest(
request.paramAsBoolean("ccs_minimize_roundtrips", searchRequest.isCcsMinimizeRoundtrips())
);
}
if (IndexSettings.isTimeSeriesModeEnabled() && request.paramAsBoolean("force_synthetic_source", false)) {
if (request.paramAsBoolean("force_synthetic_source", false)) {
searchRequest.setForceSyntheticSource(true);
}

Expand Down
16 changes: 5 additions & 11 deletions server/src/main/java/org/elasticsearch/search/SearchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.BoostingQueryBuilder;
import org.elasticsearch.index.query.CombinedFieldsQueryBuilder;
Expand Down Expand Up @@ -656,16 +655,11 @@ private ValuesSourceRegistry registerAggregations(List<SearchPlugin> plugins) {
.setAggregatorRegistrar(CompositeAggregationBuilder::registerAggregators),
builder
);
if (IndexSettings.isTimeSeriesModeEnabled()) {
registerAggregation(
new AggregationSpec(
TimeSeriesAggregationBuilder.NAME,
TimeSeriesAggregationBuilder::new,
TimeSeriesAggregationBuilder.PARSER
).addResultReader(InternalTimeSeries::new),
builder
);
}
registerAggregation(
new AggregationSpec(TimeSeriesAggregationBuilder.NAME, TimeSeriesAggregationBuilder::new, TimeSeriesAggregationBuilder.PARSER)
.addResultReader(InternalTimeSeries::new),
builder
);

if (RestApiVersion.minimumSupported() == RestApiVersion.V_7) {
registerQuery(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ private void parseSource(DefaultSearchContext context, SearchSourceBuilder sourc
context::isCancelled,
context::buildFilteredQuery,
enableRewriteAggsToFilterByFilter,
IndexSettings.isTimeSeriesModeEnabled() && source.aggregations().isInSortOrderExecutionRequired()
source.aggregations().isInSortOrderExecutionRequired()
);
context.addReleasable(aggContext);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.license.DeleteLicenseAction;
import org.elasticsearch.license.GetBasicStatusAction;
import org.elasticsearch.license.GetLicenseAction;
Expand Down Expand Up @@ -414,17 +413,15 @@ public List<ActionType<? extends ActionResponse>> getClientActions() {
);

// TSDB Downsampling / Rollup
if (IndexSettings.isTimeSeriesModeEnabled()) {
actions.add(RollupIndexerAction.INSTANCE);
actions.add(RollupAction.INSTANCE);
}
actions.add(RollupIndexerAction.INSTANCE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe adding the rollup actions can move a few lines above in the Arrays.asList() statement like everything else.

actions.add(RollupAction.INSTANCE);

return actions;
}

@Override
public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
List<NamedWriteableRegistry.Entry> namedWriteables = new ArrayList<>(
return new ArrayList<>(
Arrays.asList(
// graph
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.GRAPH, GraphFeatureSetUsage::new),
Expand Down Expand Up @@ -568,16 +565,11 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
// Data Tiers
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.DATA_TIERS, DataTiersFeatureSetUsage::new),
// Archive
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.ARCHIVE, ArchiveFeatureSetUsage::new)
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.ARCHIVE, ArchiveFeatureSetUsage::new),
// TSDB Downsampling / Rollup
new NamedWriteableRegistry.Entry(LifecycleAction.class, RollupILMAction.NAME, RollupILMAction::new)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downampling ILM is still work in progress and we don't want this to be made available before I merge PR #87269

So, please remove it completely from here and I will enable it in #87269

)
);

// TSDB Downsampling / Rollup
if (IndexSettings.isTimeSeriesModeEnabled()) {
namedWriteables.add(new NamedWriteableRegistry.Entry(LifecycleAction.class, RollupILMAction.NAME, RollupILMAction::new));
}

return namedWriteables;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.IndexSettings;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -27,7 +26,6 @@
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static java.util.stream.Collectors.toList;

Expand All @@ -51,16 +49,16 @@ public class TimeseriesLifecycleType implements LifecycleType {
static final String DELETE_PHASE = "delete";
public static final List<String> ORDERED_VALID_PHASES = List.of(HOT_PHASE, WARM_PHASE, COLD_PHASE, FROZEN_PHASE, DELETE_PHASE);

public static final List<String> ORDERED_VALID_HOT_ACTIONS = Stream.of(
public static final List<String> ORDERED_VALID_HOT_ACTIONS = Arrays.asList(
SetPriorityAction.NAME,
UnfollowAction.NAME,
RolloverAction.NAME,
ReadOnlyAction.NAME,
IndexSettings.isTimeSeriesModeEnabled() ? RollupILMAction.NAME : null,
RollupILMAction.NAME,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove RollupILMAction completely from here and I will enable it in #87269

ShrinkAction.NAME,
ForceMergeAction.NAME,
SearchableSnapshotAction.NAME
).filter(Objects::nonNull).toList();
);
public static final List<String> ORDERED_VALID_WARM_ACTIONS = Arrays.asList(
SetPriorityAction.NAME,
UnfollowAction.NAME,
Expand All @@ -70,16 +68,16 @@ public class TimeseriesLifecycleType implements LifecycleType {
ShrinkAction.NAME,
ForceMergeAction.NAME
);
public static final List<String> ORDERED_VALID_COLD_ACTIONS = Stream.of(
public static final List<String> ORDERED_VALID_COLD_ACTIONS = Arrays.asList(
SetPriorityAction.NAME,
UnfollowAction.NAME,
ReadOnlyAction.NAME,
SearchableSnapshotAction.NAME,
AllocateAction.NAME,
MigrateAction.NAME,
FreezeAction.NAME,
IndexSettings.isTimeSeriesModeEnabled() ? RollupILMAction.NAME : null
).filter(Objects::nonNull).toList();
RollupILMAction.NAME
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove RollupILMAction completely from here and I will enable it in #87269

);
public static final List<String> ORDERED_VALID_FROZEN_ACTIONS = List.of(UnfollowAction.NAME, SearchableSnapshotAction.NAME);
public static final List<String> ORDERED_VALID_DELETE_ACTIONS = List.of(WaitForSnapshotAction.NAME, DeleteAction.NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.health.HealthIndicatorService;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.HealthPlugin;
Expand Down Expand Up @@ -330,11 +329,7 @@ private static List<NamedXContentRegistry.Entry> xContentEntries() {
);

// TSDB Downsampling / Rollup
if (IndexSettings.isTimeSeriesModeEnabled()) {
entries.add(
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(RollupILMAction.NAME), RollupILMAction::parse)
);
}
entries.add(new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(RollupILMAction.NAME), RollupILMAction::parse));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove LifecycleAction completely from here and I will enable it in #87269

return List.copyOf(entries);
}

Expand Down
Loading