Skip to content
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

[ML] Adjust BWC after daily_model_snapshot_retention_after_days backport #55911

Merged
merged 4 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ task verifyVersions {
* after the backport of the backcompat code is complete.
*/

boolean bwc_tests_enabled = false
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/55911" /* place a PR link here when committing bwc changes */
boolean bwc_tests_enabled = true
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
if (bwc_tests_enabled == false) {
if (bwc_tests_disabled_issue.isEmpty()) {
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,41 +207,26 @@ public Job(StreamInput in) throws IOException {
description = in.readOptionalString();
createTime = new Date(in.readVLong());
finishedTime = in.readBoolean() ? new Date(in.readVLong()) : null;
// for removed last_data_time field
if (in.getVersion().before(Version.V_7_0_0)) {
if (in.readBoolean()) {
in.readVLong();
}
}
analysisConfig = new AnalysisConfig(in);
analysisLimits = in.readOptionalWriteable(AnalysisLimits::new);
dataDescription = in.readOptionalWriteable(DataDescription::new);
modelPlotConfig = in.readOptionalWriteable(ModelPlotConfig::new);
renormalizationWindowDays = in.readOptionalLong();
backgroundPersistInterval = in.readOptionalTimeValue();
modelSnapshotRetentionDays = in.readOptionalLong();
// TODO: change version in backport
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
dailyModelSnapshotRetentionAfterDays = in.readOptionalLong();
} else {
dailyModelSnapshotRetentionAfterDays = null;
}
dailyModelSnapshotRetentionAfterDays = in.readOptionalLong();
resultsRetentionDays = in.readOptionalLong();
Map<String, Object> readCustomSettings = in.readMap();
customSettings = readCustomSettings == null ? null : Collections.unmodifiableMap(readCustomSettings);
modelSnapshotId = in.readOptionalString();
if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) {
if (in.readBoolean()) {
modelSnapshotMinVersion = Version.readVersion(in);
} else {
modelSnapshotMinVersion = null;
}
resultsIndexName = in.readString();
deleting = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
allowLazyOpen = in.readBoolean();
} else {
allowLazyOpen = false;
}
allowLazyOpen = in.readBoolean();
}

/**
Expand Down Expand Up @@ -486,37 +471,26 @@ public void writeTo(StreamOutput out) throws IOException {
} else {
out.writeBoolean(false);
}
// for removed last_data_time field
if (out.getVersion().before(Version.V_7_0_0)) {
out.writeBoolean(false);
}
analysisConfig.writeTo(out);
out.writeOptionalWriteable(analysisLimits);
out.writeOptionalWriteable(dataDescription);
out.writeOptionalWriteable(modelPlotConfig);
out.writeOptionalLong(renormalizationWindowDays);
out.writeOptionalTimeValue(backgroundPersistInterval);
out.writeOptionalLong(modelSnapshotRetentionDays);
// TODO: change version in backport
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeOptionalLong(dailyModelSnapshotRetentionAfterDays);
}
out.writeOptionalLong(dailyModelSnapshotRetentionAfterDays);
out.writeOptionalLong(resultsRetentionDays);
out.writeMap(customSettings);
out.writeOptionalString(modelSnapshotId);
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
if (modelSnapshotMinVersion != null) {
out.writeBoolean(true);
Version.writeVersion(modelSnapshotMinVersion, out);
} else {
out.writeBoolean(false);
}
if (modelSnapshotMinVersion != null) {
out.writeBoolean(true);
Version.writeVersion(modelSnapshotMinVersion, out);
} else {
out.writeBoolean(false);
}
out.writeString(resultsIndexName);
out.writeBoolean(deleting);
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
out.writeBoolean(allowLazyOpen);
}
out.writeBoolean(allowLazyOpen);
}

@Override
Expand Down Expand Up @@ -732,23 +706,18 @@ public Builder(StreamInput in) throws IOException {
renormalizationWindowDays = in.readOptionalLong();
backgroundPersistInterval = in.readOptionalTimeValue();
modelSnapshotRetentionDays = in.readOptionalLong();
// TODO: change version in backport
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
dailyModelSnapshotRetentionAfterDays = in.readOptionalLong();
}
dailyModelSnapshotRetentionAfterDays = in.readOptionalLong();
resultsRetentionDays = in.readOptionalLong();
customSettings = in.readMap();
modelSnapshotId = in.readOptionalString();
if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) {
if (in.readBoolean()) {
modelSnapshotMinVersion = Version.readVersion(in);
} else {
modelSnapshotMinVersion = null;
}
resultsIndexName = in.readOptionalString();
deleting = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
allowLazyOpen = in.readBoolean();
}
allowLazyOpen = in.readBoolean();
}

public Builder setId(String id) {
Expand Down Expand Up @@ -934,26 +903,19 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalLong(renormalizationWindowDays);
out.writeOptionalTimeValue(backgroundPersistInterval);
out.writeOptionalLong(modelSnapshotRetentionDays);
// TODO: change version in backport
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeOptionalLong(dailyModelSnapshotRetentionAfterDays);
}
out.writeOptionalLong(dailyModelSnapshotRetentionAfterDays);
out.writeOptionalLong(resultsRetentionDays);
out.writeMap(customSettings);
out.writeOptionalString(modelSnapshotId);
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
if (modelSnapshotMinVersion != null) {
out.writeBoolean(true);
Version.writeVersion(modelSnapshotMinVersion, out);
} else {
out.writeBoolean(false);
}
if (modelSnapshotMinVersion != null) {
out.writeBoolean(true);
Version.writeVersion(modelSnapshotMinVersion, out);
} else {
out.writeBoolean(false);
}
out.writeOptionalString(resultsIndexName);
out.writeBoolean(deleting);
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
out.writeBoolean(allowLazyOpen);
}
out.writeBoolean(allowLazyOpen);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,7 @@ public JobUpdate(StreamInput in) throws IOException {
renormalizationWindowDays = in.readOptionalLong();
backgroundPersistInterval = in.readOptionalTimeValue();
modelSnapshotRetentionDays = in.readOptionalLong();
// TODO: change version on backport
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
dailyModelSnapshotRetentionAfterDays = in.readOptionalLong();
} else {
dailyModelSnapshotRetentionAfterDays = null;
}
dailyModelSnapshotRetentionAfterDays = in.readOptionalLong();
resultsRetentionDays = in.readOptionalLong();
if (in.readBoolean()) {
categorizationFilters = in.readStringList();
Expand All @@ -147,16 +142,12 @@ public JobUpdate(StreamInput in) throws IOException {
jobVersion = null;
}
clearJobFinishTime = in.readOptionalBoolean();
if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) {
if (in.readBoolean()) {
modelSnapshotMinVersion = Version.readVersion(in);
} else {
modelSnapshotMinVersion = null;
}
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
allowLazyOpen = in.readOptionalBoolean();
} else {
allowLazyOpen = null;
}
allowLazyOpen = in.readOptionalBoolean();
}

@Override
Expand All @@ -174,10 +165,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalLong(renormalizationWindowDays);
out.writeOptionalTimeValue(backgroundPersistInterval);
out.writeOptionalLong(modelSnapshotRetentionDays);
// TODO: change on backport
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeOptionalLong(dailyModelSnapshotRetentionAfterDays);
}
out.writeOptionalLong(dailyModelSnapshotRetentionAfterDays);
out.writeOptionalLong(resultsRetentionDays);
out.writeBoolean(categorizationFilters != null);
if (categorizationFilters != null) {
Expand All @@ -192,17 +180,13 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(false);
}
out.writeOptionalBoolean(clearJobFinishTime);
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
if (modelSnapshotMinVersion != null) {
out.writeBoolean(true);
Version.writeVersion(modelSnapshotMinVersion, out);
} else {
out.writeBoolean(false);
}
}
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
out.writeOptionalBoolean(allowLazyOpen);
if (modelSnapshotMinVersion != null) {
out.writeBoolean(true);
Version.writeVersion(modelSnapshotMinVersion, out);
} else {
out.writeBoolean(false);
}
out.writeOptionalBoolean(allowLazyOpen);
}

public String getJobId() {
Expand Down