Skip to content

migrate allocate action pojo/xcontent to xpack.protocol #32853

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 11 commits into from
Aug 16, 2018

Conversation

talevy
Copy link
Contributor

@talevy talevy commented Aug 14, 2018

This splits out the AllocateAction into some parts xpack-protocol
so that it can be re-usable in the client.

This splits out the AllocateAction into some parts xpack-protocol
so that it can be re-usable in the client.
@talevy talevy added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Aug 14, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@talevy talevy requested review from dakrone and colings86 August 14, 2018 17:00
Copy link
Contributor

@colings86 colings86 left a comment

Choose a reason for hiding this comment

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

I'm surprised that this change doesn't register the action with the NamedXContentRegistry on the client side. I think we will need that?

@talevy
Copy link
Contributor Author

talevy commented Aug 15, 2018

@colings86 thanks, don't want to forget about that. Client isn't using it yet, so there are no tests to catch that. I'll add it in

@talevy
Copy link
Contributor Author

talevy commented Aug 15, 2018

updated with it in. will be used soon!

@talevy talevy requested a review from colings86 August 16, 2018 04:12
Copy link
Contributor

@colings86 colings86 left a comment

Choose a reason for hiding this comment

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

I left a small comment on the registering of the actions which I think needs to be addressed in order for the deserialisation of actions to work correctly but otherwise I think this is good

// ILM - Client - Lifecycle Actions
new NamedXContentRegistry.Entry(org.elasticsearch.protocol.xpack.indexlifecycle.AllocateAction.class,
new ParseField(org.elasticsearch.protocol.xpack.indexlifecycle.AllocateAction.NAME),
org.elasticsearch.protocol.xpack.indexlifecycle.AllocateAction::parse)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is going to work, we need to register the categoryClass as something more generic than the specific action because when we are deserialising the Phase we don't know what specific action we are deserialising (hence why we use the NamedXContentRegistry. I think we need an interface equivalent to LifecycleAction but on the client side.

Also, we will want to move the registering of the server action classes to IndexLifecycle since the client won't need access to the server side objects (this can be done in a clean up PR after the client objects are there if you want but its important we don't forget to do it).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is what happens with unused code :)

@talevy
Copy link
Contributor Author

talevy commented Aug 16, 2018

thanks for the review @colings86, I've added a LifecycleAction interface. I preferred to leave it blank, rather than consolidate it with the shared ToXContentObject requirement. I'd rather have the transparency there

@talevy
Copy link
Contributor Author

talevy commented Aug 16, 2018

nevermind. one second. early morning. this shouldn't be an interface :)

import org.elasticsearch.common.xcontent.NamedXContentRegistry;

/**
* Parent class for the client-side ilm actions for the {@link NamedXContentRegistry}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think this should be worded differently given its public:

Marker interface for index lifecycle management actions

Reasons:

  • This is a marker interface not a parent class
  • The fact that its a client side copy is an implementation detail that client users should not need to know about
  • The fact that we use it to have a common category class for the NamedXContentRegistry is an implementation detail I don't think clients should need to consider

@talevy talevy merged commit 238eb93 into elastic:index-lifecycle Aug 16, 2018
@talevy talevy deleted the ilm-protocol-allocate-action branch August 16, 2018 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/ILM+SLM Index and Snapshot lifecycle management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants