Skip to content

Commit 2189447

Browse files
committed
Small fixes
1 parent 31c5fea commit 2189447

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/lifecycle/DataStreamGlobalRetentionIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void setup() throws IOException {
6767
Request createDocRequest = new Request("POST", "/my-data-stream/_doc?refresh=true");
6868
createDocRequest.setJsonEntity("{ \"@timestamp\": \"2022-12-12\"}");
6969
assertOK(client().performRequest(createDocRequest));
70-
// Index failed doc, this will create the failure store
70+
// Index one doc that will fail, this will create the failure store
7171
createDocRequest = new Request("POST", "/my-data-stream/_doc?refresh=true");
7272
createDocRequest.setJsonEntity("{ \"@timestamp\": \"2022-12-12\", \"count\": \"not-a-number\"}");
7373
assertOK(client().performRequest(createDocRequest));

modules/data-streams/src/main/java/org/elasticsearch/datastreams/options/rest/RestGetDataStreamOptionsAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import org.elasticsearch.action.support.IndicesOptions;
1212
import org.elasticsearch.client.internal.node.NodeClient;
13+
import org.elasticsearch.cluster.metadata.DataStreamFailureStore;
1314
import org.elasticsearch.common.Strings;
1415
import org.elasticsearch.datastreams.options.action.GetDataStreamOptionsAction;
1516
import org.elasticsearch.rest.BaseRestHandler;
@@ -28,8 +29,7 @@
2829
@ServerlessScope(Scope.PUBLIC)
2930
public class RestGetDataStreamOptionsAction extends BaseRestHandler {
3031

31-
public static final String DATA_STREAM_FAILURE_LIFECYCLE = "failure_lifecycle";
32-
private static final Set<String> CAPABILITIES = Set.of(DATA_STREAM_FAILURE_LIFECYCLE);
32+
private static final Set<String> CAPABILITIES = Set.of(DataStreamFailureStore.FAILURES_LIFECYCLE_API_CAPABILITY);
3333

3434
@Override
3535
public String getName() {

modules/data-streams/src/main/java/org/elasticsearch/datastreams/rest/RestGetDataStreamsAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
import org.elasticsearch.action.support.IndicesOptions;
1313
import org.elasticsearch.client.internal.node.NodeClient;
1414
import org.elasticsearch.cluster.metadata.DataStream;
15+
import org.elasticsearch.cluster.metadata.DataStreamFailureStore;
1516
import org.elasticsearch.cluster.metadata.DataStreamLifecycle;
1617
import org.elasticsearch.common.Strings;
1718
import org.elasticsearch.common.util.set.Sets;
18-
import org.elasticsearch.datastreams.options.rest.RestGetDataStreamOptionsAction;
1919
import org.elasticsearch.rest.BaseRestHandler;
2020
import org.elasticsearch.rest.RestRequest;
2121
import org.elasticsearch.rest.RestUtils;
@@ -52,7 +52,7 @@ public class RestGetDataStreamsAction extends BaseRestHandler {
5252
);
5353
private static final Set<String> CAPABILITIES = Stream.of(
5454
DataStreamLifecycle.EFFECTIVE_RETENTION_REST_API_CAPABILITY,
55-
DataStream.isFailureStoreFeatureFlagEnabled() ? RestGetDataStreamOptionsAction.DATA_STREAM_FAILURE_LIFECYCLE : null
55+
DataStream.isFailureStoreFeatureFlagEnabled() ? DataStreamFailureStore.FAILURES_LIFECYCLE_API_CAPABILITY : null
5656
).filter(Objects::nonNull).collect(Collectors.toSet());
5757

5858
@Override

modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/240_failure_store_info.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ setup:
55
capabilities:
66
- method: GET
77
path: /_data_stream/{target}
8-
capabilities: [ 'failure_lifecycle' ]
8+
capabilities: [ 'failures_lifecycle' ]
99
- do:
1010
allowed_warnings:
1111
- "index template [my-template1] has index patterns [fs-data-stream] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template1] will take precedence during new index creation"

server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ public ClusterState execute(BatchExecutionContext<RolloverTask> batchExecutionCo
513513
try (var ignored = taskContext.captureResponseHeaders()) {
514514
state = executeTask(state, resultsCollector::appendItem, taskContext, listener);
515515
} catch (Exception e) {
516-
logger.warn("Failed to rollover task: {}", taskContext.getTask().rolloverRequest.getRolloverTarget());
517516
taskContext.onFailure(e);
518517
}
519518
}

server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,8 @@ public DataStreamLifecycle getDataLifecycle() {
527527

528528
/**
529529
* Retrieves the effective lifecycle configuration for the failure store. This can be either the configuration provided
530-
* by a user or the default lifecycle if there are failure indices.
530+
* by a user or the default lifecycle if there are failure indices. NOTE: this does not take into consideration if the
531+
* failure store is enabled by a cluster setting, please use {@link DataStream#getFailuresLifecycle(Boolean)}.
531532
*/
532533
@Nullable
533534
public DataStreamLifecycle getFailuresLifecycle() {
@@ -538,7 +539,7 @@ public DataStreamLifecycle getFailuresLifecycle() {
538539

539540
/**
540541
* Retrieves the effective lifecycle configuration for the failure store. This can be either the configuration provided
541-
* by a user or the default lifecycle if there are failure indices.
542+
* by a user or the default lifecycle if there are failure indices or if the failure store is enabled by a cluster setting.
542543
*/
543544
@Nullable
544545
public DataStreamLifecycle getFailuresLifecycle(Boolean effectivelyEnabledFailureStore) {

server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamFailureStore.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public record DataStreamFailureStore(@Nullable Boolean enabled, @Nullable DataSt
3535
SimpleDiffable<DataStreamFailureStore>,
3636
ToXContentObject {
3737

38+
public static final String FAILURES_LIFECYCLE_API_CAPABILITY = "failures_lifecycle";
3839
public static final String FAILURE_STORE = "failure_store";
3940
public static final String ENABLED = "enabled";
4041
public static final String LIFECYCLE = "lifecycle";

0 commit comments

Comments
 (0)