Skip to content

Add default snapshot repo cluster setting#139155

Merged
seanzatzdev merged 21 commits intoelastic:mainfrom
seanzatzdev:default-repo
Jan 5, 2026
Merged

Add default snapshot repo cluster setting#139155
seanzatzdev merged 21 commits intoelastic:mainfrom
seanzatzdev:default-repo

Conversation

@seanzatzdev
Copy link
Copy Markdown
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
Copy Markdown
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 and others added 2 commits December 5, 2025 18:48
…esService.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…esService.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@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
Copy Markdown
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 :StorageEngine/Data streams Data streams and their lifecycles Team:Data Management (obsolete) DO NOT USE. This team no longer exists. labels Dec 8, 2025
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Dec 8, 2025
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@seanzatzdev
Copy link
Copy Markdown
Contributor Author

Based on our discussions, i added some additional logic to ensure default repos are not read-only, and only validating on the master node/master update thread. Thank you everybody for the comments, learning a lot on this one!

Copy link
Copy Markdown
Member

@masseyke masseyke left a comment

Choose a reason for hiding this comment

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

LGTM, assuming the conversations about whether to validate on start and whether to handle multi-project have been resolved.
I left a few minor comments.

@seanzatzdev seanzatzdev enabled auto-merge (squash) December 22, 2025 22:37
@seanzatzdev seanzatzdev removed the request for review from nielsbauman January 5, 2026 05:05
@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Jan 5, 2026
@seanzatzdev seanzatzdev merged commit cf12935 into elastic:main Jan 5, 2026
35 of 36 checks passed
@seanzatzdev seanzatzdev deleted the default-repo branch January 5, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue serverless-linked Added by automation, don't add manually :StorageEngine/Data streams Data streams and their lifecycles Team:Data Management (obsolete) DO NOT USE. This team no longer exists. Team:Distributed Coordination (obsolete) Meta label for Distributed Coordination team. Obsolete. Please do not use. v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the concept of a "default" repository

7 participants