Skip to content

[ML] Fix serialising the inference update request #122278

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
merged 2 commits into from
Feb 11, 2025

Conversation

davidkyle
Copy link
Member

The read and write were processing variables in a different order.

@davidkyle davidkyle added >bug :ml Machine learning auto-backport Automatically create backport pull requests when merged v9.0.0 v8.18.0 v8.19.0 v9.1.0 labels Feb 11, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:ML Meta label for the ML team label Feb 11, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @davidkyle, I've created a changelog YAML for you.

this.taskType = TaskType.fromStream(in);
this.content = in.readBytesReference();
Copy link
Member Author

Choose a reason for hiding this comment

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

Surprisingly the fix doesn't require a new transport version. This change means that reading from older nodes will start working and reads from same version and future versions will work

Copy link
Member

Choose a reason for hiding this comment

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

Making sure I understand, we don't need a new transport version because it was incorrect to start? Will this have any expected impact on serverless?

Copy link
Member Author

Choose a reason for hiding this comment

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

The writeTo() code writes taskType then content and the read was reading content then taskType.
My intuition was that a fix would need a new transport version but when I wrote the code it ended up as:

if (version.before(MY_FIX_VERSION)) {
  // change the order as this is what write is doing in the old version
  this.taskType = TaskType.fromStream(in);
  this.content = in.readBytesReference();
} else {
  // change the order as this is what write is doing in the current version
  this.taskType = TaskType.fromStream(in);
  this.content = in.readBytesReference();
}

Both sides of the condition are the same so I took out the transport version check, that suprised me as things are rarely this simple. As for serverless, what was once broken should start working.

Copy link
Member

@kderusso kderusso left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix, a couple of questions.

this.taskType = TaskType.fromStream(in);
this.content = in.readBytesReference();
Copy link
Member

Choose a reason for hiding this comment

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

Making sure I understand, we don't need a new transport version because it was incorrect to start? Will this have any expected impact on serverless?


import java.io.IOException;

public class UpdateInferenceModelActionRequestTests extends AbstractWireSerializingTestCase<UpdateInferenceModelAction.Request> {
Copy link
Member

Choose a reason for hiding this comment

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

Would we want to use AbstractBWCSerializationTestCase here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because there is on BWC logic on the transport version in the serialisation code the mutateInstanceForVersion() function would have just return the input parameter. I thought it cleaner use the plain AbstractWireSerializingTestCase base class.

@davidkyle davidkyle merged commit 0b7c3ce into elastic:main Feb 11, 2025
16 of 17 checks passed
@davidkyle davidkyle deleted the fix-update-serialisation branch February 11, 2025 20:44
davidkyle added a commit to davidkyle/elasticsearch that referenced this pull request Feb 11, 2025
davidkyle added a commit to davidkyle/elasticsearch that referenced this pull request Feb 11, 2025
davidkyle added a commit to davidkyle/elasticsearch that referenced this pull request Feb 11, 2025
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.0
8.18
8.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >bug :ml Machine learning Team:ML Meta label for the ML team v8.18.0 v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants