Skip to content

Conversation

@imotov
Copy link
Contributor

@imotov imotov commented Dec 23, 2016

Switches custom cluster state components from PROTO-based de-serialization to named objects based de-serialization

Closes #21868

This PR removes PROTO-based serialization from all custom objects except custom IndexMetaData. Custom IndexMetaData is not currently used in any know code and will be removed in v7.0. I will open a separate PR deprecating it and disabling creation of Custom IndexMetaData for new indices in v6.0.

Copy link
Member

Choose a reason for hiding this comment

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

Is there an incomplete NamedDiff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, but there could be partial NamedDiff. CompleteNameDiff is a NamedWriteable equivalent of CompleteDiff which sends a complete copy every time anything changes, hence the name.

Copy link
Member

Choose a reason for hiding this comment

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

Comments and class name are now out of date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I am going to rename it to DiffableValueReader

Copy link
Member

Choose a reason for hiding this comment

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

Can you use the constructor instead?

Copy link
Member

Choose a reason for hiding this comment

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

I see the symmetry of having these two methods. I still wonder if it'd be as readable if you removed them and used the ctors directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't move readFrom to constructor to reduce the number of changes. I will do that. I wouldn't want to move code in readDiffFrom away from the class itself, because it will expose too much implementation details in the registration code.

Copy link
Member

Choose a reason for hiding this comment

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

Do we need this method any more?

Copy link
Member

Choose a reason for hiding this comment

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

I think instead we can use the one it delegates to, right?

Copy link
Member

Choose a reason for hiding this comment

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

Still TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. These are leftovers from when I was trying to convert custom index metadata to the new mode. I will restore this back.

Copy link
Member

Choose a reason for hiding this comment

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

Can it have a reading ctor? Those tend to do nice stuff like let you declare more things final.

Copy link
Member

Choose a reason for hiding this comment

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

do we still want to warn here? Supposedly this only occurs when you uninstall a plugin that uses customer state, right? I think it'd be cool to log a warning.

Copy link
Member

Choose a reason for hiding this comment

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

I'd add something like Prefer {@link StreamInput#readNamedWriteable(Class)} and {@link StreamOutput#writeNamedWriteable(NamedWriteable)} unless you have a compelling reason to use this method instead..

Copy link
Member

Choose a reason for hiding this comment

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

Maybe use NamedXContentRegistry.FromXContent instead. Maybe extract it into a top level class? Remember that ParseFieldMatcher is being removed. If you want to keep the signatures the same you can use the static ParseFieldMatcher.EMPTY or remove all usages.

@imotov
Copy link
Contributor Author

imotov commented Dec 26, 2016

@nik9000 I pushed changes that you have requested. Could you take another look when you have a chance?

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

Maybe we should test backwards compatibility in rolling upgrade qa test, just to be sure?

Something like I did in #21243? First add some custom cluster state components, then verify that the custom cluster state parts exist in both mixed and upgraded cluster. We do then need to [preserve the cluster state] (https://github.com/elastic/elasticsearch/pull/21243/files#diff-701d16f5dd09c2af203aed8b5838c22cR40) between tests.

Switches custom cluster state components from PROTO-based de-serialization to named objects based de-serialization
@imotov imotov force-pushed the issue-21868-kill-proto-rebased branch from f584231 to ca90d9e Compare December 28, 2016 19:41
@imotov imotov merged commit ca90d9e into elastic:master Dec 28, 2016
@clintongormley clintongormley added :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. and removed :Cluster labels Feb 13, 2018
@imotov imotov deleted the issue-21868-kill-proto-rebased branch May 1, 2020 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>breaking-java :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. v5.2.0 v6.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants