Skip to content

[ML] removing old 7.x bwc serialization code #80029

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

Merged

Conversation

benwtrent
Copy link
Member

This commit removes all the old serialization code to that was added when serializing to nodes with a version before 8.0.0.

It also removes specific tests for those versions and some code only used by older versions.

@elasticmachine elasticmachine added the Team:ML Meta label for the ML team label Oct 28, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realise we had so many BWC differences across the 7.16/8.0 boundary. All those need to stay except the one in the MlMetadata that is a bug.

Sorry - I should have mentioned originally that the 8.0 ones needed extra investigation.

Comment on lines 43 to 45
// NOTE: Always rewrite potentially old date histogram intervals.
// This should occur in 8.x+ but not 7.x.
// 7.x is BWC with versions that do not support the new date_histogram fields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes in this file should be reverted, because 8.x needs to be able to coexist with 7.16.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, all of 8.x -> 7.16. Will revert the various places.

@@ -131,36 +130,14 @@ public DataDescription(String timeFieldName, String timeFormat) {
}

public DataDescription(StreamInput in) throws IOException {
if (in.getVersion().before(Version.V_8_0_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file should be reverted too, in case 8.x is talking to 7.16.

@@ -68,9 +68,6 @@ public static AggProvider createRandomValidAggProvider() {

@Override
protected AggProvider mutateInstanceForVersion(AggProvider instance, Version version) {
if (version.before(Version.V_8_0_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted to match the AggProvider class.

@@ -47,13 +46,8 @@
public MlScalingReason(StreamInput in) throws IOException {
this.waitingAnalyticsJobs = in.readStringList();
this.waitingAnomalyJobs = in.readStringList();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is genuinely new in 8.0 too.

@@ -162,21 +162,15 @@ public MlMetadata(StreamInput in) throws IOException {
this.datafeeds = datafeeds;
this.groupOrJobLookup = new GroupOrJobLookup(jobs.values());
this.upgradeMode = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should really have been V_7_13_0, so this is actually a bad bug that would mean 8.0.0-alpha1, 8.0.0-alpha2 and 8.0.0-beta1 cannot safely run in a mixed version cluster with 7.16.x if the ML metadata exists and an MlMetadata diff gets bundled up into the same cluster state update as some other update. I guess we never hit that in testing. 😬

I'm wondering if we need a known issue for 8.0.0-beta1 telling people not to attempt a rolling upgrade to it if they are using ML.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at 7.16, at least its correct there 😌

IDK if we have a list of known issues or not for beta1. If we do, this should definitely be on it.

@@ -886,11 +879,7 @@ public static LazyModelDefinition fromBase64String(String base64String) {
}

public static LazyModelDefinition fromStreamInput(StreamInput input) throws IOException {
if (input.getVersion().onOrAfter(Version.V_8_0_0)) { // TODO adjust on backport
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never was backported, so the check needs to stay here, and in the corresponding writeTo method below. The TODOs should be removed. This functionality was added in the PyTorch work. I think at the time these comments were written we must have been intending to backport to 7.16 but we changed our minds.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please open a separate bug fix PR against 8.0 that makes the changes to MlMetadata.java in 8.0. Maybe also remove the TODOs from TrainedModelConfig.java in case they cause alarm to somebody reading the 8.0 branch code in the future. The rest of the changes are fine to be master only.

@benwtrent benwtrent merged commit e6e41c0 into elastic:master Oct 28, 2021
@benwtrent benwtrent deleted the feature/ml-remove-7.x-bwc-handlers branch October 28, 2021 18:46
@benwtrent
Copy link
Member Author

@droberts195

Please open a separate bug fix PR against 8.0 that makes the changes to MlMetadata.java in 8.0. Maybe also remove the TODOs from TrainedModelConfig.java in case they cause alarm to somebody reading the 8.0 branch code in the future. The rest of the changes are fine to be master only.

#80041

dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Dec 15, 2021
dimitris-athanasiou added a commit that referenced this pull request Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:ml Machine learning >non-issue Team:ML Meta label for the ML team v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants