Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
spacemanager: Retry on transient errors
Besides allowing the space manager to recover from various transient errors,
this change also enables us to use serializable transaction isolation.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6397/
  • Loading branch information
gbehrmann committed Jan 21, 2014
1 parent da4d83c commit 548b541
Showing 1 changed file with 19 additions and 6 deletions.
Expand Up @@ -36,6 +36,8 @@
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.dao.RecoverableDataAccessException;
import org.springframework.dao.TransientDataAccessException;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Nonnull;
Expand Down Expand Up @@ -1155,12 +1157,23 @@ public void run()
private void processMessage(Message message)
{
try {
if (message instanceof PoolRemoveFilesMessage) {
// fileRemoved does its own transaction management
fileRemoved((PoolRemoveFilesMessage) message);
}
else {
processMessageTransactionally(message);
boolean isSuccessful = false;
for (int attempts = 0; !isSuccessful; attempts++) {
try {
if (message instanceof PoolRemoveFilesMessage) {
// fileRemoved does its own transaction management
fileRemoved((PoolRemoveFilesMessage) message);
}
else {
processMessageTransactionally(message);
}
isSuccessful = true;
} catch (TransientDataAccessException | RecoverableDataAccessException e) {
if (attempts >= 3) {
throw e;
}
LOGGER.warn("Retriable data access error: {}", e.toString());
}
}
} catch (SpaceAuthorizationException e) {
message.setFailedConditionally(CacheException.PERMISSION_DENIED, e.getMessage());
Expand Down

0 comments on commit 548b541

Please sign in to comment.