Skip to content

Conversation

@seanzatzdev
Copy link
Contributor

@seanzatzdev seanzatzdev commented Dec 5, 2025

This PR adds a cluster setting for the default repository. The setting defaults to "".

The default repo cannot be deleted, you must change the setting before being able to delete a repo. We check that the repo is registered upon updating the setting. The setting can be cleared by setting it to ""

closes #66040
closes https://github.com/elastic/elasticsearch-team/issues/2103

@seanzatzdev seanzatzdev requested a review from Copilot December 5, 2025 23:41
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 introduces a cluster setting to specify a default snapshot repository for snapshot and restore operations. When configured, this eliminates the need to explicitly specify a repository name in these operations.

Key changes:

  • Added repositories.default_repository dynamic cluster setting
  • Implemented validation to ensure only registered repositories can be set as default
  • Added protection to prevent deletion of the default repository

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
RepositoriesService.java Adds the default repository cluster setting, validation logic, getter/setter methods, and prevention of default repository deletion
ClusterSettings.java Registers the new DEFAULT_REPOSITORY_SETTING in the cluster settings registry
10_default_repository.yml Adds comprehensive YAML REST tests covering setting, validation, and edge cases for the default repository feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@seanzatzdev seanzatzdev requested a review from dakrone December 5, 2025 23:53
@seanzatzdev seanzatzdev removed the request for review from dakrone December 6, 2025 02:22
@seanzatzdev seanzatzdev marked this pull request as ready for review December 8, 2025 00:43
@seanzatzdev seanzatzdev requested a review from a team as a code owner December 8, 2025 00:43
@elasticsearchmachine elasticsearchmachine added the needs:triage Requires assignment of a team area label label Dec 8, 2025
@seanzatzdev seanzatzdev requested review from dakrone and masseyke and removed request for dakrone and masseyke December 8, 2025 00:43
@seanzatzdev seanzatzdev requested a review from Copilot December 8, 2025 16:16
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@seanzatzdev seanzatzdev added :Data Management/Data streams Data streams and their lifecycles Team:Data Management Meta label for data/management team labels Dec 8, 2025
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Dec 8, 2025
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, Sean! I added a few minor comments, but we should get someone from the Distributed team to look at this as well, as they own the snapshot/restore feature.

Comment on lines +170 to +171
clusterService.getClusterSettings()
.addSettingsUpdateConsumer(DEFAULT_REPOSITORY_SETTING, this::setDefaultRepository, this::validateDefaultRepository);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should get someone from the Distributed team to have a look at this validation, to verify if there's any reason this validation could cause issues. I'll add the area label to the PR, could you reach out to #es-destrib and ask for a review?

@nielsbauman nielsbauman added the :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs label Dec 9, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Dec 9, 2025
@elasticsearchmachine
Copy link
Collaborator

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

Comment on lines +225 to +235
private boolean isRepositoryRegistered(String repositoryName) {
if (repositoryOrNull(ProjectId.DEFAULT, repositoryName) != null) {
return true;
}
boolean found = repositories.values().stream().anyMatch(projectRepos -> projectRepos.containsKey(repositoryName));
if (found) {
return true;
}
found = internalRepositories.values().stream().anyMatch(projectRepos -> projectRepos.containsKey(repositoryName));
return found;
}
Copy link
Member

Choose a reason for hiding this comment

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

Two comments:

  1. We should not check internal repositories since those are used for CCR.
  2. We should be explicit about it being the default project and not check with any other project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Data streams Data streams and their lifecycles :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue Team:Data Management Meta label for data/management team Team:Distributed Coordination Meta label for Distributed Coordination team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the concept of a "default" repository

4 participants