|
@@ -352,7 +352,7 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
|
|
|
@Override
|
|
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
|
|
- return toXContent(builder, params, null, null);
|
|
|
+ return toXContent(builder, params, null, null, null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -363,7 +363,8 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
XContentBuilder builder,
|
|
|
Params params,
|
|
|
@Nullable RolloverConfiguration rolloverConfiguration,
|
|
|
- @Nullable DataStreamGlobalRetention globalRetention
|
|
|
+ @Nullable DataStreamGlobalRetention dataGlobalRetention,
|
|
|
+ @Nullable DataStreamGlobalRetention failureGlobalRetention
|
|
|
) throws IOException {
|
|
|
builder.startObject();
|
|
|
builder.field(DataStream.NAME_FIELD.getPreferredName(), dataStream.getName());
|
|
@@ -384,7 +385,7 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
if (dataStream.getDataLifecycle() != null) {
|
|
|
builder.field(LIFECYCLE_FIELD.getPreferredName());
|
|
|
dataStream.getDataLifecycle()
|
|
|
- .toXContent(builder, params, rolloverConfiguration, globalRetention, dataStream.isInternal());
|
|
|
+ .toXContent(builder, params, rolloverConfiguration, dataGlobalRetention, dataStream.isInternal());
|
|
|
}
|
|
|
if (ilmPolicyName != null) {
|
|
|
builder.field(ILM_POLICY_FIELD.getPreferredName(), ilmPolicyName);
|
|
@@ -423,7 +424,7 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
DataStreamLifecycle failuresLifecycle = dataStream.getFailuresLifecycle(failureStoreEffectivelyEnabled);
|
|
|
if (failuresLifecycle != null) {
|
|
|
builder.field(LIFECYCLE_FIELD.getPreferredName());
|
|
|
- failuresLifecycle.toXContent(builder, params, rolloverConfiguration, globalRetention, dataStream.isInternal());
|
|
|
+ failuresLifecycle.toXContent(builder, params, rolloverConfiguration, failureGlobalRetention, dataStream.isInternal());
|
|
|
}
|
|
|
builder.endObject();
|
|
|
builder.endObject();
|
|
@@ -582,30 +583,44 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
@Nullable
|
|
|
private final RolloverConfiguration rolloverConfiguration;
|
|
|
@Nullable
|
|
|
- private final DataStreamGlobalRetention globalRetention;
|
|
|
+ private final DataStreamGlobalRetention dataGlobalRetention;
|
|
|
+ @Nullable
|
|
|
+ private final DataStreamGlobalRetention failuresGlobalRetention;
|
|
|
|
|
|
public Response(List<DataStreamInfo> dataStreams) {
|
|
|
- this(dataStreams, null, null);
|
|
|
+ this(dataStreams, null, null, null);
|
|
|
}
|
|
|
|
|
|
public Response(
|
|
|
List<DataStreamInfo> dataStreams,
|
|
|
@Nullable RolloverConfiguration rolloverConfiguration,
|
|
|
- @Nullable DataStreamGlobalRetention globalRetention
|
|
|
+ @Nullable DataStreamGlobalRetention dataGlobalRetention,
|
|
|
+ @Nullable DataStreamGlobalRetention failuresGlobalRetention
|
|
|
) {
|
|
|
this.dataStreams = dataStreams;
|
|
|
this.rolloverConfiguration = rolloverConfiguration;
|
|
|
- this.globalRetention = globalRetention;
|
|
|
+ this.dataGlobalRetention = dataGlobalRetention;
|
|
|
+ this.failuresGlobalRetention = failuresGlobalRetention;
|
|
|
}
|
|
|
|
|
|
- public Response(StreamInput in) throws IOException {
|
|
|
- this(
|
|
|
- in.readCollectionAsList(DataStreamInfo::new),
|
|
|
- in.getTransportVersion().onOrAfter(TransportVersions.V_8_9_X) ? in.readOptionalWriteable(RolloverConfiguration::new) : null,
|
|
|
- in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)
|
|
|
- ? in.readOptionalWriteable(DataStreamGlobalRetention::read)
|
|
|
- : null
|
|
|
- );
|
|
|
+ public static Response read(StreamInput in) throws IOException {
|
|
|
+ var dataStreamInfo = in.readCollectionAsList(DataStreamInfo::new);
|
|
|
+ var rolloverConfiguration = in.getTransportVersion().onOrAfter(TransportVersions.V_8_9_X)
|
|
|
+ ? in.readOptionalWriteable(RolloverConfiguration::new)
|
|
|
+ : null;
|
|
|
+ DataStreamGlobalRetention dataGlobalRetention = null;
|
|
|
+ DataStreamGlobalRetention failuresGlobalRetention = null;
|
|
|
+ if (in.getTransportVersion().onOrAfter(TransportVersions.INTRODUCE_FAILURES_DEFAULT_RETENTION_BACKPORT_8_19)) {
|
|
|
+ var defaultRetention = in.readOptionalTimeValue();
|
|
|
+ var maxRetention = in.readOptionalTimeValue();
|
|
|
+ var failuresDefaultRetention = in.readOptionalTimeValue();
|
|
|
+ dataGlobalRetention = DataStreamGlobalRetention.create(defaultRetention, maxRetention);
|
|
|
+ failuresGlobalRetention = DataStreamGlobalRetention.create(failuresDefaultRetention, maxRetention);
|
|
|
+ } else if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) {
|
|
|
+ dataGlobalRetention = in.readOptionalWriteable(DataStreamGlobalRetention::read);
|
|
|
+ failuresGlobalRetention = dataGlobalRetention;
|
|
|
+ }
|
|
|
+ return new Response(dataStreamInfo, rolloverConfiguration, dataGlobalRetention, failuresGlobalRetention);
|
|
|
}
|
|
|
|
|
|
public List<DataStreamInfo> getDataStreams() {
|
|
@@ -618,8 +633,13 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
}
|
|
|
|
|
|
@Nullable
|
|
|
- public DataStreamGlobalRetention getGlobalRetention() {
|
|
|
- return globalRetention;
|
|
|
+ public DataStreamGlobalRetention getDataGlobalRetention() {
|
|
|
+ return dataGlobalRetention;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Nullable
|
|
|
+ public DataStreamGlobalRetention getFailuresGlobalRetention() {
|
|
|
+ return failuresGlobalRetention;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -628,8 +648,13 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_9_X)) {
|
|
|
out.writeOptionalWriteable(rolloverConfiguration);
|
|
|
}
|
|
|
- if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) {
|
|
|
- out.writeOptionalWriteable(globalRetention);
|
|
|
+ // A version 9.x cluster will never read this, so we only need to include the patch version here.
|
|
|
+ if (out.getTransportVersion().isPatchFrom(TransportVersions.INTRODUCE_FAILURES_DEFAULT_RETENTION_BACKPORT_8_19)) {
|
|
|
+ out.writeOptionalTimeValue(dataGlobalRetention == null ? null : dataGlobalRetention.defaultRetention());
|
|
|
+ out.writeOptionalTimeValue(dataGlobalRetention == null ? null : dataGlobalRetention.maxRetention());
|
|
|
+ out.writeOptionalTimeValue(failuresGlobalRetention == null ? null : failuresGlobalRetention.defaultRetention());
|
|
|
+ } else if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) {
|
|
|
+ out.writeOptionalWriteable(dataGlobalRetention);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -642,7 +667,8 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
builder,
|
|
|
DataStreamLifecycle.addEffectiveRetentionParams(params),
|
|
|
rolloverConfiguration,
|
|
|
- globalRetention
|
|
|
+ dataGlobalRetention,
|
|
|
+ failuresGlobalRetention
|
|
|
);
|
|
|
}
|
|
|
builder.endArray();
|
|
@@ -657,12 +683,13 @@ public class GetDataStreamAction extends ActionType<GetDataStreamAction.Response
|
|
|
Response response = (Response) o;
|
|
|
return dataStreams.equals(response.dataStreams)
|
|
|
&& Objects.equals(rolloverConfiguration, response.rolloverConfiguration)
|
|
|
- && Objects.equals(globalRetention, response.globalRetention);
|
|
|
+ && Objects.equals(dataGlobalRetention, response.dataGlobalRetention)
|
|
|
+ && Objects.equals(failuresGlobalRetention, response.failuresGlobalRetention);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int hashCode() {
|
|
|
- return Objects.hash(dataStreams, rolloverConfiguration, globalRetention);
|
|
|
+ return Objects.hash(dataStreams, rolloverConfiguration, dataGlobalRetention, failuresGlobalRetention);
|
|
|
}
|
|
|
}
|
|
|
|