Skip to content

Deprecate serializing PipelineAggregators #54926

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 5 commits into from
Apr 9, 2020

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Apr 7, 2020

PipelineAggregators are only sent across the wire for backwards
compatibility with 7.7.0. PipelineAggregator needs to continue to
implement NamedWriteable for backwards compatibility but pipeline
aggregations created after 7.7.0 need not implement any of the methods
in that interface because we'll never attempt to call them. So this
creates implementations in PipelineAggregator (the base class) that
just throw exceptions.

`PipelineAggregator`s are only sent across the wire for backwards
compatibility with 7.7.0. `PipelineAggregator` needs to continue to
implement `NamedWriteable` for backwards compatibility but pipeline
aggregations created after 7.7.0 need not implement any of the methods
in that interface because we'll never attempt to call them. So this
creates implementations in `PipelineAggregator` (the base class) that
just throw exceptions.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Aggregations)

@nik9000
Copy link
Member Author

nik9000 commented Apr 7, 2020

This is the last item for #53742 that I plan to backport to 7.x. I plan one more item in master only to remove NamedWriteable from PipelineAggregator.

@nik9000 nik9000 mentioned this pull request Apr 7, 2020
3 tasks
Copy link
Contributor

@polyfractal polyfractal left a comment

Choose a reason for hiding this comment

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

Left a question about the exceptions :)

bucketsPaths = in.readStringArray();
metadata = in.readMap();
} else {
throw new IllegalArgumentException("[" + getClass() + "] is not supported on versions before 7.8.0");
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I think these exception messages are a bit confusing. If I understand correctly, this path theoretically should never happen because e.g. InternalAggregations won't serialize pipelines in 7.8+, so read/write on the aggregator 7.8+ should never be invoked.

I think we should probably change the message to "Cannot (de)serialize pipeline aggregator from stream because pipelines are not serialized after 7.8" or something to that effect. That way if a user does see this, it won't confuse them; the current message may make them think the aggregation itself is no longer supported (due to the node being 7.8+ to reach that statement, but the message saying "before 7.8").

I think we need to throw a 5xx error too, because if we get here we are firmly in the server-side going pear shaped and not the fault of a client/user. Perhaps IllegalStateException?

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense to me!

@nik9000
Copy link
Member Author

nik9000 commented Apr 9, 2020

@polyfractal I pushed an update to the exception type and message in one spot. The other spots I think are actually correct because they'll happen for pipeline aggregations that never implemented serialization because they aren't supported before 7.8.0.

Copy link
Contributor

@polyfractal polyfractal left a comment

Choose a reason for hiding this comment

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

LGTM. I was going to quibble over the other IllegalArgExceptions... but I guess it's a matter of perspective. If you have a heterogeneous cluster, it's technically valid and invalid to request a new 7.8 agg. So could be viewed as a server issue (can't de/serialize), or that the user requested something bad.

👍 to keeping IllegalArg for the rest.

bucketsPaths = in.readStringArray();
metadata = in.readMap();
} else {
throw new IllegalStateException("Cannot deserialize pipeline [" + getClass() + "] because it 7.8.0");
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "because it 7.8.0" :)

Copy link
Member Author

Choose a reason for hiding this comment

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

❤️

@nik9000 nik9000 merged commit ea6152c into elastic:master Apr 9, 2020
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Apr 9, 2020
`PipelineAggregator`s are only sent across the wire for backwards
compatibility with 7.7.0. `PipelineAggregator` needs to continue to
implement `NamedWriteable` for backwards compatibility but pipeline
aggregations created after 7.7.0 need not implement any of the methods
in that interface because we'll never attempt to call them. So this
creates implementations in `PipelineAggregator` (the base class) that
just throw exceptions.
nik9000 added a commit that referenced this pull request Apr 9, 2020
`PipelineAggregator`s are only sent across the wire for backwards
compatibility with 7.7.0. `PipelineAggregator` needs to continue to
implement `NamedWriteable` for backwards compatibility but pipeline
aggregations created after 7.7.0 need not implement any of the methods
in that interface because we'll never attempt to call them. So this
creates implementations in `PipelineAggregator` (the base class) that
just throw exceptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants