Skip to content

Run TransportExplainLifecycleAction on local node #122885

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 5 commits into from
Mar 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into local-explain-lifecycle
  • Loading branch information
nielsbauman committed Mar 7, 2025
commit c5540a09a9c63a6d844e1c219d877a7022caee02
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public TransportExplainLifecycleAction(
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
NamedXContentRegistry xContentRegistry
NamedXContentRegistry xContentRegistry,
ProjectResolver projectResolver
) {
super(
ExplainLifecycleAction.NAME,
Expand Down Expand Up @@ -142,7 +143,8 @@ static IndexLifecycleExplainResponse getIndexLifecycleExplainResponse(
NamedXContentRegistry xContentRegistry,
boolean rolloverOnlyIfHasDocuments
) throws IOException {
IndexMetadata indexMetadata = metadata.getProject().index(indexName);
final var project = metadata.getProject();
IndexMetadata indexMetadata = project.index(indexName);
Settings idxSettings = indexMetadata.getSettings();
LifecycleExecutionState lifecycleState = indexMetadata.getLifecycleExecutionState();
String policyName = indexMetadata.getLifecyclePolicyName();
Expand Down Expand Up @@ -185,8 +187,8 @@ static IndexLifecycleExplainResponse getIndexLifecycleExplainResponse(
}

final IndexLifecycleExplainResponse indexResponse;
if (metadata.isIndexManagedByILM(indexMetadata)) {
final IndexLifecycleMetadata indexLifecycleMetadata = metadata.custom(IndexLifecycleMetadata.TYPE);
if (project.isIndexManagedByILM(indexMetadata)) {
final IndexLifecycleMetadata indexLifecycleMetadata = project.custom(IndexLifecycleMetadata.TYPE);
final boolean policyExists = indexLifecycleMetadata.getPolicies().containsKey(policyName);
// If this is requesting only errors, only include indices in the error step or which are using a nonexistent policy
if (onlyErrors == false || (ErrorStep.NAME.equals(lifecycleState.step()) || policyExists == false)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The IndexLifecycleService only runs on the master node, which meant that policyExists was always false. I changed it to use the Metadata to check for policy existence.

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.