Skip to content

SOLR-18684: Retry IO errs on backup+restore copying - #5387

Merged
gerlowskija merged 2 commits into
apache:mainfrom
gerlowskija:SOLR-18684-retry-backup-file-copies
Nov 27, 2026
Merged

gerlowskija merged 2 commits into
apache:mainfrom
gerlowskija:SOLR-18684-retry-backup-file-copies

Conversation

@gerlowskija

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18684

Description

Prior to this commit Solr's backup/restore framework had no consistent support for retrying IO errors. This caused lots of problems for users with large indices: a restore or installshard might copy 100s of GB and fail on the very last file due to a single connection-drop.

Solution

This commit addresses this problem by adding retry logic at the framework level. Solr will retry certain IOExceptions solr.backup.maxcopyretries times (defaults to 2), giving users a bit of protection against tiny network blips failing such long, expensive processes.

Tests

See RetryingBackupRepositoryTest. Existing tests continue to pass.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.

Prior to this commit Solr's backup/restore framework had no consistent
support for retrying IO errors.  This caused lots of problems for users
with large indices: a restore or installshard might copy 100s of GB and
fail on the very last file due to a single connection-drop.

This commit addresses this problem by adding retry logic at the
framework level.  Solr will retry certain IOExceptions
`solr.backup.maxcopyretries` times (defaults to 2), giving users a bit
of protection against tiny network blips failing such long, expensive
processes.
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests labels Nov 24, 2026
@github-actions

Copy link
Copy Markdown

Automated PR readiness judgements (LLM-generated; may be wrong; not updated on later pushes).

  • ✅ Jira issue in title: already present
  • ⚠️ Changelog — differs from the entry (suggest type: added; PR has type: changed): The PR introduces new configuration properties `solr.​backup.​maxcopyretries` and `solr.​backup.​copyretrybackoffms` to control the new retry behavior, which is an opt-in feature (or at least a new configuration surface) for users to manage backup/​restore reliability.​
  • ✅ Reference Guide update: included
  • ✅ Upgrade notes: not needed
  • ✅ Tests: included

@gerlowskija

Copy link
Copy Markdown
Contributor Author

(Tests and check pass locally for me 👍 )

@mlbiscoc mlbiscoc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do s3 backups a decent amount and I think I ran into these transient network failures before and I think this would help but doesn't the the S3StorageClient have it's own retry strategy? Will these overlap?

* is 0.
*/
private static BackupRepository withRetries(BackupRepository repo) {
int maxRetries = EnvUtils.getPropertyAsInteger(MAX_COPY_RETRIES_PROP, 2);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like if these are static finals instead and call it like MAX_COPY_RETRIES instead of placing the (default 2) in comments. Then if this ever changes people update comments which is kind of awkward.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!

if (maxRetries <= 0) {
return repo;
}
long backoffMillis = EnvUtils.getPropertyAsLong(COPY_RETRY_BACKOFF_MILLIS_PROP, 1000L);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should protect against negative backoff times like we you did above. Also same as comment above, static final for the defautl backoff time and we don't need this comment (default 1000).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!

@gerlowskija

gerlowskija commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

I think I ran into these transient network failures before and I think this would help but doesn't the the S3StorageClient have it's own retry strategy?

It does! I didn't get into this in the JIRA ticket, but maybe it's worth expanding on. S3StorageClient has retries you can configure, but AFAICT they only cover codepaths within S3StorageClient and the s3 library code. Once the client has returned a stream object and Solr's code is consuming it the s3 level retries don't come into play, which really stinks 😦

@gerlowskija
gerlowskija merged commit 6d2a8dd into apache:main Nov 27, 2026
7 checks passed
@gerlowskija
gerlowskija deleted the SOLR-18684-retry-backup-file-copies branch November 27, 2026 22:34
gerlowskija added a commit that referenced this pull request Nov 27, 2026
Prior to this commit Solr's backup/restore framework had no consistent
support for retrying IO errors.  This caused lots of problems for users
with large indices: a restore or installshard might copy 100s of GB and
fail on the very last file due to a single connection-drop.

This commit addresses this problem by adding retry logic at the
framework level.  Solr will retry certain IOExceptions
`solr.backup.maxcopyretries` times (defaults to 2), giving users a bit
of protection against tiny network blips failing such long, expensive
processes.

(cherry picked from commit 6d2a8dd)
gerlowskija added a commit that referenced this pull request Nov 27, 2026
Prior to this commit Solr's backup/restore framework had no consistent
support for retrying IO errors.  This caused lots of problems for users
with large indices: a restore or installshard might copy 100s of GB and
fail on the very last file due to a single connection-drop.

This commit addresses this problem by adding retry logic at the
framework level.  Solr will retry certain IOExceptions
`solr.backup.maxcopyretries` times (defaults to 2), giving users a bit
of protection against tiny network blips failing such long, expensive
processes.

(cherry picked from commit 6d2a8dd)
(cherry picked from commit 3ba107f)
gerlowskija added a commit that referenced this pull request Nov 27, 2026
Prior to this commit Solr's backup/restore framework had no consistent
support for retrying IO errors.  This caused lots of problems for users
with large indices: a restore or installshard might copy 100s of GB and
fail on the very last file due to a single connection-drop.

This commit addresses this problem by adding retry logic at the
framework level.  Solr will retry certain IOExceptions
`solr.backup.maxcopyretries` times (defaults to 2), giving users a bit
of protection against tiny network blips failing such long, expensive
processes.

(cherry picked from commit 6d2a8dd)
(cherry picked from commit 3ba107f)
(cherry picked from commit a333df8)
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