-
Notifications
You must be signed in to change notification settings - Fork 25.2k
HLRC: Add ILM Retry #33990
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
original-brownbear
merged 15 commits into
elastic:index-lifecycle
from
original-brownbear:hlrc-ilm-retry-step
Oct 19, 2018
Merged
HLRC: Add ILM Retry #33990
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b004154
HLRC: Add ILM Retry
original-brownbear 3c6fce1
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear 28f39cd
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear 9925286
CR: Add request converter test
original-brownbear 9a1dffa
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear fe5d3f9
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear 10159b3
start documentation
original-brownbear 2cf0ec3
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear d9d22c6
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear def8a6d
merge in origin
original-brownbear 9a62390
merge in origin
original-brownbear 039f63b
merge in origin
original-brownbear c07695a
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear c7ee96c
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear 5eb23a9
Merge remote-tracking branch 'elastic/index-lifecycle' into hlrc-ilm-…
original-brownbear File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
package org.elasticsearch.client; | ||
|
||
import java.util.List; | ||
import org.apache.http.HttpEntity; | ||
import org.apache.http.client.methods.HttpDelete; | ||
import org.apache.http.client.methods.HttpGet; | ||
|
@@ -54,6 +55,7 @@ | |
import org.elasticsearch.client.indexlifecycle.GetLifecyclePolicyRequest; | ||
import org.elasticsearch.client.indexlifecycle.LifecycleManagementStatusRequest; | ||
import org.elasticsearch.client.indexlifecycle.PutLifecyclePolicyRequest; | ||
import org.elasticsearch.client.indexlifecycle.RetryLifecyclePolicyRequest; | ||
import org.elasticsearch.client.indexlifecycle.RemoveIndexLifecyclePolicyRequest; | ||
import org.elasticsearch.client.indexlifecycle.SetIndexLifecyclePolicyRequest; | ||
import org.elasticsearch.client.indexlifecycle.StartILMRequest; | ||
|
@@ -717,6 +719,19 @@ static Request explainLifecycle(ExplainLifecycleRequest explainLifecycleRequest) | |
return request; | ||
} | ||
|
||
static Request retryLifecycle(RetryLifecyclePolicyRequest retryLifecyclePolicyRequest) { | ||
Request request = new Request(HttpPost.METHOD_NAME, | ||
new EndpointBuilder() | ||
.addCommaSeparatedPathParts(retryLifecyclePolicyRequest.getIndices()) | ||
.addPathPartAsIs("_ilm") | ||
.addPathPartAsIs("retry") | ||
.build()); | ||
Params params = new Params(request); | ||
params.withMasterTimeout(retryLifecyclePolicyRequest.masterNodeTimeout()); | ||
params.withTimeout(retryLifecyclePolicyRequest.timeout()); | ||
return request; | ||
} | ||
|
||
static HttpEntity createEntity(ToXContent toXContent, XContentType xContentType) throws IOException { | ||
BytesRef source = XContentHelper.toXContent(toXContent, xContentType, false).toBytesRef(); | ||
return new ByteArrayEntity(source.bytes, source.offset, source.length, createContentType(xContentType)); | ||
|
@@ -1102,7 +1117,12 @@ EndpointBuilder addCommaSeparatedPathParts(String[] parts) { | |
return this; | ||
} | ||
|
||
EndpointBuilder addPathPartAsIs(String... parts) { | ||
EndpointBuilder addCommaSeparatedPathParts(List<String> parts) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just added this to save a |
||
addPathPart(String.join(",", parts)); | ||
return this; | ||
} | ||
|
||
EndpointBuilder addPathPartAsIs(String ... parts) { | ||
for (String part : parts) { | ||
if (Strings.hasLength(part)) { | ||
joiner.add(part); | ||
|
58 changes: 58 additions & 0 deletions
58
...el/src/main/java/org/elasticsearch/client/indexlifecycle/RetryLifecyclePolicyRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.client.indexlifecycle; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import org.elasticsearch.client.TimedRequest; | ||
|
||
public class RetryLifecyclePolicyRequest extends TimedRequest { | ||
|
||
private final List<String> indices; | ||
|
||
public RetryLifecyclePolicyRequest(String... indices) { | ||
if (indices.length == 0) { | ||
throw new IllegalArgumentException("Must at least specify one index to retry"); | ||
} | ||
this.indices = Arrays.asList(indices); | ||
} | ||
|
||
public List<String> getIndices() { | ||
return indices; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
RetryLifecyclePolicyRequest that = (RetryLifecyclePolicyRequest) o; | ||
return indices.size() == that.indices.size() && indices.containsAll(that.indices); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(indices); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be in some IndexLifecycleRequestConverters class. i dont think it exists yet.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, ILM stuff hasn't been moved to a separate RequestConverters class yet. I'd say this is okay for this PR since we'll do a mass move at some point before merging anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me