Skip to content
Merged
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 @@ -143,7 +143,7 @@ public static List<Entry> getNamedWriteables() {
ComposableIndexTemplateMetadata::readDiffFrom);
registerMetadataCustom(entries, DataStreamMetadata.TYPE, DataStreamMetadata::new, DataStreamMetadata::readDiffFrom);

if (RollupV2.ROLLUPV2_FEATURE_FLAG_REGISTERED != null && RollupV2.ROLLUPV2_FEATURE_FLAG_REGISTERED) {
if (RollupV2.isEnabled()) {
registerMetadataCustom(entries, RollupMetadata.TYPE, RollupMetadata::new, RollupMetadata::readDiffFrom);
}
// Task Status (not Diffable)
Expand All @@ -170,7 +170,7 @@ public static List<NamedXContentRegistry.Entry> getNamedXWriteables() {
ComposableIndexTemplateMetadata::fromXContent));
entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(DataStreamMetadata.TYPE),
DataStreamMetadata::fromXContent));
if (RollupV2.ROLLUPV2_FEATURE_FLAG_REGISTERED != null && RollupV2.ROLLUPV2_FEATURE_FLAG_REGISTERED) {
if (RollupV2.isEnabled()) {
entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(RollupMetadata.TYPE),
RollupMetadata::fromXContent));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -96,6 +97,12 @@ public RollupGroup(List<String> group, Map<String, DateHistogramInterval> dateIn
this.dateTimezone = dateTimezone;
}

public RollupGroup() {
this.group = new ArrayList<>();
this.dateInterval = new HashMap<>();
this.dateTimezone = new HashMap<>();
}

public RollupGroup(StreamInput in) throws IOException {
this.group = in.readStringList();
this.dateInterval = in.readMap(StreamInput::readString, DateHistogramInterval::new);
Expand Down
22 changes: 3 additions & 19 deletions server/src/main/java/org/elasticsearch/rollup/RollupV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,10 @@

package org.elasticsearch.rollup;

import org.elasticsearch.Build;

public class RollupV2 {
public static final Boolean ROLLUPV2_FEATURE_FLAG_REGISTERED;
public static final boolean ROLLUP_V2_FEATURE_FLAG_ENABLED = "true".equals(System.getProperty("es.rollup_v2_feature_flag_enabled"));

static {
final String property = System.getProperty("es.rollupv2_feature_flag_registered");
if (Build.CURRENT.isSnapshot() && property != null) {
throw new IllegalArgumentException("es.rollupv2_feature_flag_registered is only supported in non-snapshot builds");
}
if ("true".equals(property)) {
ROLLUPV2_FEATURE_FLAG_REGISTERED = true;
} else if ("false".equals(property)) {
ROLLUPV2_FEATURE_FLAG_REGISTERED = false;
} else if (property == null) {
ROLLUPV2_FEATURE_FLAG_REGISTERED = null;
} else {
throw new IllegalArgumentException(
"expected es.rollupv2_feature_flag_registered to be unset or [true|false] but was [" + property + "]"
);
}
public static boolean isEnabled() {
return ROLLUP_V2_FEATURE_FLAG_ENABLED;
}
}
4 changes: 4 additions & 0 deletions server/src/main/java/org/elasticsearch/tasks/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ public String getHeader(String header) {
return headers.get(header);
}

public Map<String, String> headers() {
return headers;
}

public TaskResult result(DiscoveryNode node, Exception error) throws IOException {
return new TaskResult(taskInfo(node.getId(), true), error);
}
Expand Down
Loading