mlbiscoc commented on code in PR #5387:
URL: https://github.com/apache/solr/pull/5387#discussion_r4683218620
##########
solr/core/src/java/org/apache/solr/core/backup/repository/BackupRepositoryFactory.java:
##########
@@ -93,7 +100,20 @@ public BackupRepository newInstance(SolrResourceLoader
loader, String name) {
delegatingRepo.setDelegate(delegate);
}
- return backupRepository;
+ return withRetries(backupRepository);
+ }
+
+ /**
+ * Wraps {@code repo} so failed file copies are retried, unless {@code
solr.backup.maxcopyretries}
+ * is 0.
+ */
+ private static BackupRepository withRetries(BackupRepository repo) {
+ int maxRetries = EnvUtils.getPropertyAsInteger(MAX_COPY_RETRIES_PROP, 2);
+ if (maxRetries <= 0) {
+ return repo;
+ }
+ long backoffMillis =
EnvUtils.getPropertyAsLong(COPY_RETRY_BACKOFF_MILLIS_PROP, 1000L);
Review Comment:
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)`.
##########
solr/core/src/java/org/apache/solr/core/backup/repository/BackupRepositoryFactory.java:
##########
@@ -93,7 +100,20 @@ public BackupRepository newInstance(SolrResourceLoader
loader, String name) {
delegatingRepo.setDelegate(delegate);
}
- return backupRepository;
+ return withRetries(backupRepository);
+ }
+
+ /**
+ * Wraps {@code repo} so failed file copies are retried, unless {@code
solr.backup.maxcopyretries}
+ * is 0.
+ */
+ private static BackupRepository withRetries(BackupRepository repo) {
+ int maxRetries = EnvUtils.getPropertyAsInteger(MAX_COPY_RETRIES_PROP, 2);
Review Comment:
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]