Skip to content

Migrate the reserved repository action to be per-project #130155

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

Conversation

ywangd
Copy link
Member

@ywangd ywangd commented Jun 27, 2025

Resolves: ES-10479

@ywangd ywangd requested review from pxsalehi and mark-vieira June 27, 2025 05:32
@ywangd ywangd requested a review from a team as a code owner June 27, 2025 05:32
@ywangd ywangd added >non-issue :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v9.2.0 labels Jun 27, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Jun 27, 2025
Comment on lines +89 to +99
@Override
protected void validateForReservedState(DeleteRepositoryRequest request, ClusterState state) {
super.validateForReservedState(request, state);

validateForReservedState(
projectResolver.getProjectMetadata(state).reservedStateMetadata().values(),
reservedStateHandlerName().get(),
modifiedKeys(request),
request.toString()
);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is copied from the same check from other other reserved project-state actions such as this one. There is room for de-duplication as suggested by the comment, but I'll leave it out from this PR.

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Jun 27, 2025
@@ -36,7 +35,7 @@
* It is used by the ReservedClusterStateService to add/update or remove snapshot repositories. Typical usage
* for this action is in the context of file based settings.
*/
public class ReservedRepositoryAction implements ReservedClusterStateHandler<List<PutRepositoryRequest>> {
public class ReservedRepositoryAction implements ReservedProjectStateHandler<List<PutRepositoryRequest>> {
Copy link
Member

Choose a reason for hiding this comment

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

Basic question. In a non-MP stateless cluster, this is still sufficient because now the cluster back up repo falls under the "default" project?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Additionally, we have ProjectClusterStateHandlerAdapter which reads the reserved state from the main settings.json file in a non-MP setup.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct, no need to explicitly handle the non-MP case.

@ywangd ywangd requested a review from pxsalehi July 1, 2025 00:26
@ywangd
Copy link
Member Author

ywangd commented Jul 1, 2025

@elasticmachine update branch

@ywangd ywangd added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jul 1, 2025
Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -36,7 +35,7 @@
* It is used by the ReservedClusterStateService to add/update or remove snapshot repositories. Typical usage
* for this action is in the context of file based settings.
*/
public class ReservedRepositoryAction implements ReservedClusterStateHandler<List<PutRepositoryRequest>> {
public class ReservedRepositoryAction implements ReservedProjectStateHandler<List<PutRepositoryRequest>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct, no need to explicitly handle the non-MP case.

@ywangd
Copy link
Member Author

ywangd commented Jul 2, 2025

@elasticmachine update branch

@elasticsearchmachine elasticsearchmachine merged commit c17bfcb into elastic:main Jul 3, 2025
32 checks passed
@ywangd ywangd deleted the ES-10479-reserved-project-repository branch July 3, 2025 00:26
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue serverless-linked Added by automation, don't add manually Team:Distributed Coordination Meta label for Distributed Coordination team v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants