-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ILM fix the init step to actually be retryable #52076
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
Changes from 5 commits
63f377c
af73584
6e46ae3
26a18af
a180e61
27708dd
8523f21
b609366
3355825
d7f0828
04c444c
5695091
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,13 +47,17 @@ public ClusterState performAction(Index index, ClusterState clusterState) { | |
|
|
||
| IndexMetaData.Builder indexMetadataBuilder = IndexMetaData.builder(indexMetaData); | ||
| if (shouldParseIndexName(indexMetaData.getSettings())) { | ||
| long parsedOriginationDate = parseIndexNameAndExtractDate(index.getName()); | ||
| indexMetadataBuilder.settingsVersion(indexMetaData.getSettingsVersion() + 1) | ||
| .settings(Settings.builder() | ||
| .put(indexMetaData.getSettings()) | ||
| .put(LifecycleSettings.LIFECYCLE_ORIGINATION_DATE, parsedOriginationDate) | ||
| .build() | ||
| ); | ||
| try { | ||
| long parsedOriginationDate = parseIndexNameAndExtractDate(index.getName()); | ||
| indexMetadataBuilder.settingsVersion(indexMetaData.getSettingsVersion() + 1) | ||
| .settings(Settings.builder() | ||
| .put(indexMetaData.getSettings()) | ||
| .put(LifecycleSettings.LIFECYCLE_ORIGINATION_DATE, parsedOriginationDate) | ||
| .build() | ||
| ); | ||
| } catch (Exception e) { | ||
| throw new InitializePolicyException(e.getMessage(), e); | ||
|
||
| } | ||
| } | ||
|
|
||
| ClusterState.Builder newClusterStateBuilder = ClusterState.builder(clusterState); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
| package org.elasticsearch.xpack.core.ilm; | ||
|
|
||
| import org.elasticsearch.ElasticsearchException; | ||
|
|
||
| /** | ||
| * Exception thrown when a problem is encountered while initialising an ILM policy for an index. | ||
| */ | ||
| public class InitializePolicyException extends ElasticsearchException { | ||
|
|
||
| public InitializePolicyException(String msg, Throwable cause, Object... args) { | ||
|
||
| super(msg, cause, args); | ||
| } | ||
| } | ||
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.
I think we may want to move the
tryto surround more of the function (for example, thefromIndexMetadata(...)call