Skip to content

fix(backup): handle S3-style object stores in config restore#4182

Open
elangelo wants to merge 3 commits intoapache:mainfrom
elangelo:handle-s3-restores-ignore-marker
Open

fix(backup): handle S3-style object stores in config restore#4182
elangelo wants to merge 3 commits intoapache:mainfrom
elangelo:handle-s3-restores-ignore-marker

Conversation

@elangelo
Copy link

@elangelo elangelo commented Mar 3, 2026

Description

When restoring a backup, use both exists() and listAll() to check for the config directory. Object stores like S3 may not have an explicit directory marker object, but the config files are still present under that prefix. The previous check using only exists() would incorrectly throw an error in such cases.

Solution

See description

For transparency Github Copilot was used to identify and fix the issue we were encountering with this functionality.

Tests

Manually verified on our solrcloud clusters

Checklist

Please review the following and check all that apply:

  • [ x ] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • [ x ] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • [ x ] I have developed this patch against the main branch.
  • [ x ] I have run ./gradlew check.
  • [ x ] I have added tests for my changes.
  • [ x ] I have added documentation for the Reference Guide
  • [ x ] I have added a changelog entry for my change

samuelverstraete and others added 2 commits March 3, 2026 16:53
When restoring a backup, use both `exists()` and `listAll()` to check
for the config directory. Object stores like S3 may not have an explicit
directory marker object, but the config files are still present under
that prefix. The previous check using only `exists()` would incorrectly
throw an error in such cases.
…configset

When a backup is copied through a local filesystem and re-uploaded to S3
(e.g. via `aws s3 sync`), the zero-byte directory marker objects created
by S3BackupRepository are typically lost. This caused restore to fail with
an error even though all configset files were present under the expected
key prefix.

Change BackupManager#uploadConfigDir to fall back to listing objects by
key prefix when the directory marker is absent, so restore succeeds as
long as the configset files themselves are present. A clear
IllegalArgumentException is still thrown when neither marker nor files
can be found.

- Add unit tests covering the no-marker, truly-absent, and normal cases
- Add documentation in the S3 backup/restore reference guide explaining
  the directory-marker behaviour and the graceful fallback

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added documentation Improvements or additions to documentation tests labels Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants