Skip to content

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

Open
gerlowskija wants to merge 1 commit into
apache:mainfrom
gerlowskija:SOLR-18684-retry-backup-file-copies
Open

gerlowskija wants to merge 1 commit 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.

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).

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