Details
-
Bug
-
Resolution: Done
-
Minor
-
5.2.0.Alpha4
-
None
Description
When we have a couple of backup sites (e.g. NYC and SFO) and none of them are running, a sync replication with backupFailurePolicy=FAIL with throw an exception on the first failure, e.g. SFO. However it will not report the failure for NYC.
Not sure if this is crucial, but I suspect somewhere someone counts the failures per site, and in this case NYC would not show any failures until SFO is taken offline.
The code is in BackupSenderImpl:
public void processResponses(BackupResponse backupResponse, VisitableCommand command, Transaction transaction) throws Throwable { backupResponse.waitForBackupToFinish(); SitesConfiguration sitesConfiguration = config.sites(); Map<String, Throwable> failures = backupResponse.getFailedBackups(); for (Map.Entry<String, Throwable> failure : failures.entrySet()) { BackupFailurePolicy policy = sitesConfiguration.getFailurePolicy(failure.getKey()); if (policy == BackupFailurePolicy.CUSTOM) { CustomFailurePolicy customFailurePolicy = siteFailurePolicy.get(failure.getKey()); command.acceptVisitor(null, new CustomBackupPolicyInvoker(failure.getKey(), customFailurePolicy, transaction)); } if (policy == BackupFailurePolicy.WARN) { log.warnXsiteBackupFailed(cacheName, failure.getKey(), failure.getValue()); } else if (policy == BackupFailurePolicy.FAIL) { throw new BackupFailureException(failure.getValue(),failure.getKey(), cacheName); } } }
Iterating through the failure map, we throw a BackupFailureException on the first failure. I suggest to either collect all exceptions (also when invoking the custom failure policy !) and throw them as a new exception (listing all of them) or to simply log the situation as an error.