Skip to content

Commit

Permalink
Update SLM Retention serialization versions
Browse files Browse the repository at this point in the history
With elastic#46506 backporting SLM retention, this updates master's version
guards for SLM retention.

Relates to elastic#43663
  • Loading branch information
dakrone committed Sep 9, 2019
1 parent 39c4b6b commit cb7c9c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public SnapshotLifecycleMetadata(Map<String, SnapshotLifecyclePolicyMetadata> sn
public SnapshotLifecycleMetadata(StreamInput in) throws IOException {
this.snapshotConfigurations = in.readMap(StreamInput::readString, SnapshotLifecyclePolicyMetadata::new);
this.operationMode = in.readEnum(OperationMode.class);
// TODO: version qualify this with the correct version (7.5) once available
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
this.slmStats = new SnapshotLifecycleStats(in);
} else {
this.slmStats = new SnapshotLifecycleStats();
Expand Down Expand Up @@ -123,8 +122,7 @@ public Version getMinimalSupportedVersion() {
public void writeTo(StreamOutput out) throws IOException {
out.writeMap(this.snapshotConfigurations, StreamOutput::writeString, (out1, value) -> value.writeTo(out1));
out.writeEnum(this.operationMode);
// TODO: version qualify this with the correct version (7.5) once available
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
this.slmStats.writeTo(out);
}
}
Expand Down Expand Up @@ -179,8 +177,7 @@ public SnapshotLifecycleMetadataDiff(StreamInput in) throws IOException {
SnapshotLifecyclePolicyMetadata::new,
SnapshotLifecycleMetadataDiff::readLifecyclePolicyDiffFrom);
this.operationMode = in.readEnum(OperationMode.class);
// TODO: version qualify this with the correct version (7.5) once available
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
this.slmStats = new SnapshotLifecycleStats(in);
} else {
this.slmStats = new SnapshotLifecycleStats();
Expand All @@ -203,8 +200,7 @@ public String getWriteableName() {
public void writeTo(StreamOutput out) throws IOException {
lifecycles.writeTo(out);
out.writeEnum(this.operationMode);
// TODO: version qualify this with the correct version (7.5) once available
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
this.slmStats.writeTo(out);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public SnapshotLifecyclePolicyItem(StreamInput in) throws IOException {
this.lastSuccess = in.readOptionalWriteable(SnapshotInvocationRecord::new);
this.lastFailure = in.readOptionalWriteable(SnapshotInvocationRecord::new);
this.snapshotInProgress = in.readOptionalWriteable(SnapshotInProgress::new);
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
this.policyStats = new SnapshotLifecycleStats.SnapshotPolicyStats(in);
} else {
this.policyStats = new SnapshotLifecycleStats.SnapshotPolicyStats(this.policy.getId());
Expand Down Expand Up @@ -122,7 +122,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalWriteable(lastSuccess);
out.writeOptionalWriteable(lastFailure);
out.writeOptionalWriteable(snapshotInProgress);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
this.policyStats.writeTo(out);
}
}
Expand Down

0 comments on commit cb7c9c2

Please sign in to comment.