Skip to content

Add high level rest client support for SetIndexLifecyclePolicy#32443

Merged
dakrone merged 4 commits intoelastic:index-lifecyclefrom
dakrone:ilm-add-hlrc-support-for-set-index-policy
Jul 30, 2018
Merged

Add high level rest client support for SetIndexLifecyclePolicy#32443
dakrone merged 4 commits intoelastic:index-lifecyclefrom
dakrone:ilm-add-hlrc-support-for-set-index-policy

Conversation

@dakrone
Copy link
Copy Markdown
Member

@dakrone dakrone commented Jul 27, 2018

This adds HLRC support for the ILM operation of setting an index's lifecycle
policy.

It also includes extracting and renaming a number of classes (like the request
and response objects) as well as the addition of a new IndexLifecycleClient
for the HLRC. This is a prerequisite to making the index.lifecycle.name
setting internal only, because we require a dedicated REST endpoint to change
the policy, and our tests currently set this setting with the REST client
multiple places. A subsequent PR will change the setting to be internal and move
those uses over to this new API.

This misses some links to the documentation because I don't think ILM has any
documentation available yet.

Relates to #29827 and #29823

This adds HLRC support for the ILM operation of setting an index's lifecycle
policy.

It also includes extracting and renaming a number of classes (like the request
and response objects) as well as the addition of a new `IndexLifecycleClient`
for the HLRC. This is a prerequisite to making the `index.lifecycle.name`
setting internal only, because we require a dedicated REST endpoint to change
the policy, and our tests currently set this setting with the REST client
multiple places. A subsequent PR will change the setting to be internal and move
those uses over to this new API.

This misses some links to the documentation because I don't think ILM has any
documentation available yet.

Relates to elastic#29827 and elastic#29823
@dakrone dakrone added the :Data Management/ILM+SLM DO NOT USE. Use ":StorageEngine/ILM" or ":Distributed Coordination/SLM" instead. label Jul 27, 2018
@dakrone dakrone requested review from colings86, hub-cap and talevy July 27, 2018 17:42
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra

Copy link
Copy Markdown
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.

Left a very minor comment but LGTM

public void testSetIndexLifecyclePolicy() throws Exception {
String policy = randomAlphaOfLength(10);

// TODO: convert this to using the high level client once there are APIs for it
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: Could you make this a NORELEASE since we want to do this before we release rather than just at some point?

Copy link
Copy Markdown
Contributor

@hub-cap hub-cap left a comment

Choose a reason for hiding this comment

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

I cannot tell if you are renaming or renaming and adding content to a lot of these classes so its hard to give a good review. But of the things i did review, good job on the tests being added (the abstract streamables) and most of the client work itself was good. Minor nits.

static Request setIndexLifecyclePolicy(SetIndexLifecyclePolicyRequest setPolicyRequest) {
Request request = new Request(HttpPut.METHOD_NAME,
new EndpointBuilder()
.addCommaSeparatedPathParts(setPolicyRequest.indices())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pls be sure this is not null. Other converters do a null check and return and give this addCommaSeparatedPathParts a empty array if need be. check forceMerge for an example

public void testSetIndexLifecyclePolicy() throws Exception {
String policy = randomAlphaOfLength(10);

// TODO: NORELEASE convert this to using the high level client once there are APIs for it
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lol i found this out the hard way by not starging with "put/create" in the client too :)

public void testSetIndexLifecyclePolicy() throws Exception {
SetIndexLifecyclePolicyRequest req = new SetIndexLifecyclePolicyRequest();
String policyName = randomAlphaOfLength(10);
String[] indices = randomIndicesNames(0, 10);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if this can be null maybe do a rarely() and assign to null.

@dakrone dakrone merged commit a314efc into elastic:index-lifecycle Jul 30, 2018
jasontedor pushed a commit that referenced this pull request Aug 17, 2018
This adds HLRC support for the ILM operation of setting an index's lifecycle
policy.

It also includes extracting and renaming a number of classes (like the request
and response objects) as well as the addition of a new `IndexLifecycleClient`
for the HLRC. This is a prerequisite to making the `index.lifecycle.name`
setting internal only, because we require a dedicated REST endpoint to change
the policy, and our tests currently set this setting with the REST client
multiple places. A subsequent PR will change the setting to be internal and move
those uses over to this new API.

This misses some links to the documentation because I don't think ILM has any
documentation available yet.

Relates to #29827 and #29823
@dakrone dakrone deleted the ilm-add-hlrc-support-for-set-index-policy branch February 4, 2019 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/ILM+SLM DO NOT USE. Use ":StorageEngine/ILM" or ":Distributed Coordination/SLM" instead.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants