Skip to content

Conversation

@nielsbauman
Copy link
Contributor

And updates MetadataMigrateToDataTiersRoutingService to accept a ProjectState instead of a ProjectResolver.

And updates `MetadataMigrateToDataTiersRoutingService` to accept a
`ProjectState` instead of a `ProjectResolver`.
@nielsbauman nielsbauman added >test Issues or PRs that are addressing/adding tests :Data Management/ILM+SLM Index and Snapshot lifecycle management labels Jul 17, 2025
@elasticsearchmachine elasticsearchmachine added Team:Data Management Meta label for data/management team v9.2.0 labels Jul 17, 2025
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Member

@PeteGillinElastic PeteGillinElastic left a comment

Choose a reason for hiding this comment

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

LGTM as far as the refactoring goes, but I do have a question around what this code is doing.

);
return Tuple.tuple(
ClusterState.builder(currentState).metadata(mb).putProjectMetadata(newProjectMetadataBuilder).build(),
ClusterState.builder(currentState.cluster()).metadata(mb).putProjectMetadata(newProjectMetadataBuilder).build(),
Copy link
Member

Choose a reason for hiding this comment

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

Your change here seems like a straight refactoring, so that's fine, but I have a wider question. This code is working at project scope, but it's also mutating state at the cluster scope (removing the ENFORCE_DEFAULT_TIER_PREFERENCE setting). That can't be safe, can it? Do we just not care because it's ILM? If so, it feels like we should use your annotation to call that out. If we plan to make it safe, is that tracked somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I agree that it's not ideal, but I figured we can make an exception for ILM. I have a feeling that we'll be making some changes to ProjectState at some point, to avoid these kinds of things (i.e. to make it safer in terms of what is modifiable). When we do so, we'll have to take places like this into account. Adding a @NotMultiProjectCapable sounds like a good idea. Will do.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks.

@PeteGillinElastic
Copy link
Member

Nit: I just noticed you applied the >test label. That doesn't seem right, since we're touching production code. More of a >non-issue?

@nielsbauman nielsbauman added >non-issue and removed >test Issues or PRs that are addressing/adding tests labels Jul 29, 2025
);
return Tuple.tuple(
ClusterState.builder(currentState).metadata(mb).putProjectMetadata(newProjectMetadataBuilder).build(),
ClusterState.builder(currentState.cluster()).metadata(mb).putProjectMetadata(newProjectMetadataBuilder).build(),
Copy link
Member

Choose a reason for hiding this comment

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

Thanks.

@nielsbauman nielsbauman enabled auto-merge (squash) July 29, 2025 17:46
@nielsbauman
Copy link
Contributor Author

@elasticmachine update branch

@nielsbauman nielsbauman merged commit 0a85bc3 into elastic:main Jul 30, 2025
33 checks passed
@nielsbauman nielsbauman deleted the refactor-ilm-tests branch July 30, 2025 09:05
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 >non-issue 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.

4 participants