Skip to content

Remove TSDB feature flag #88585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all 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 @@ -1960,9 +1960,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 @@ -58,7 +57,6 @@
import org.elasticsearch.xpack.core.ilm.MigrateAction;
import org.elasticsearch.xpack.core.ilm.ReadOnlyAction;
import org.elasticsearch.xpack.core.ilm.RolloverAction;
import org.elasticsearch.xpack.core.ilm.RollupILMAction;
import org.elasticsearch.xpack.core.ilm.SearchableSnapshotAction;
import org.elasticsearch.xpack.core.ilm.SetPriorityAction;
import org.elasticsearch.xpack.core.ilm.ShrinkAction;
Expand Down Expand Up @@ -258,7 +256,7 @@ public List<Setting<?>> getSettings() {

@Override
public List<ActionType<? extends ActionResponse>> getClientActions() {
List<ActionType<? extends ActionResponse>> actions = new ArrayList<>(
return new ArrayList<>(
Arrays.asList(
// graph
GraphExploreAction.INSTANCE,
Expand Down Expand Up @@ -409,22 +407,17 @@ public List<ActionType<? extends ActionResponse>> getClientActions() {
// Text Structure
FindStructureAction.INSTANCE,
// Terms enum API
TermsEnumAction.INSTANCE
TermsEnumAction.INSTANCE,
// TSDB Downsampling / Rollup
RollupIndexerAction.INSTANCE,
RollupAction.INSTANCE
)
);

// TSDB Downsampling / Rollup
if (IndexSettings.isTimeSeriesModeEnabled()) {
actions.add(RollupIndexerAction.INSTANCE);
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 @@ -571,13 +564,6 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.ARCHIVE, ArchiveFeatureSetUsage::new)
)
);

// 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,15 @@ 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,
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 +67,15 @@ 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();
FreezeAction.NAME
);
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 All @@ -106,13 +102,12 @@ public class TimeseriesLifecycleType implements LifecycleType {
ReadOnlyAction.NAME,
ShrinkAction.NAME,
ForceMergeAction.NAME,
RollupILMAction.NAME,
SearchableSnapshotAction.NAME
);
// Set of actions that cannot be defined (executed) after the managed index has been mounted as searchable snapshot.
// It's ordered to produce consistent error messages which can be unit tested.
public static final Set<String> ACTIONS_CANNOT_FOLLOW_SEARCHABLE_SNAPSHOT = Collections.unmodifiableSet(
new LinkedHashSet<>(Arrays.asList(ForceMergeAction.NAME, FreezeAction.NAME, ShrinkAction.NAME, RollupILMAction.NAME))
new LinkedHashSet<>(Arrays.asList(ForceMergeAction.NAME, FreezeAction.NAME, ShrinkAction.NAME))
);

private TimeseriesLifecycleType() {}
Expand Down
Loading