Skip to content

Conversation

@nielsbauman
Copy link
Contributor

@nielsbauman nielsbauman commented Aug 21, 2025

By making the step more generic, we can reuse it in other actions (such
as the upcoming improved force merge action).

By making the step more generic, we can reuse it in other actions (such
as the upcoming improved force merge action).

We ensure that indices that are in this cleanup step while the cluster
upgrades to this version, are still able to progress seamlessly by
registering the old step name as a `NoopStep` and forwarding them to the
new cleanup step name.
@nielsbauman nielsbauman requested a review from Copilot August 21, 2025 19:12
@nielsbauman nielsbauman added >refactoring auto-backport Automatically create backport pull requests when merged v8.19.3 labels Aug 21, 2025
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.2.0 labels Aug 21, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the CleanupShrinkIndexStep to CleanupGeneratedIndexStep to make it more generic and reusable for other actions beyond just shrink operations.

Key Changes

  • Renamed the step class and updated its functionality to use a configurable target index name supplier
  • Added backward compatibility by introducing a NoopStep that forwards indices from the old step name to the new one
  • Updated all test cases to reflect the new class name and structure

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ShrinkAction.java Integrates the new generic cleanup step with a NoopStep for backward compatibility
CleanupGeneratedIndexStep.java Refactored from CleanupShrinkIndexStep with configurable index name supplier
CleanupGeneratedIndexStepTests.java Updated test class to match the new generic step implementation
ShrinkActionTests.java Updated test assertions to account for the additional NoopStep in the workflow

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <[email protected]>
@nielsbauman nielsbauman added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Aug 21, 2025
@nielsbauman nielsbauman requested a review from dakrone August 21, 2025 19:13
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Aug 21, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Aug 21, 2025
@nielsbauman
Copy link
Contributor Author

Build is failing due to unrelated compilation issues, will be addressed by #133354.

@nielsbauman nielsbauman removed auto-backport Automatically create backport pull requests when merged v8.19.3 labels Aug 22, 2025
Comment on lines 171 to 172
StepKey oldCleanupShrinkIndexKey = new StepKey(phase, NAME, CleanupGeneratedIndexStep.OLD_NAME);
StepKey cleanupShrinkIndexKey = new StepKey(phase, NAME, CleanupGeneratedIndexStep.NAME);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just realized that instead of having this old noop step, we could just move the OLD_NAME field to this class and keep using that name for the cleanup step. I don't think there's much value in making this action using the new name too, as we'll never be able to remove the noop step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the NoopStep I added and just moved the OLD_NAME field to the CLEANUP_SHRINK_INDEX_STEP field in ShrinkAction. That avoids us having to keep the noop step forever.

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, I left two tiny comments

@nielsbauman nielsbauman enabled auto-merge (squash) August 26, 2025 18:52
@nielsbauman nielsbauman merged commit d4e25a5 into elastic:main Aug 26, 2025
34 checks passed
@nielsbauman nielsbauman deleted the ilm-cleanup-index branch August 26, 2025 20:25
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 >refactoring Team:Data Management Meta label for data/management team v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants