summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
de73a66)
Rather than waiting for abort to complete, which cannot happen
during isolation for example, propagate timeout immediately.
Change-Id: I90333938cb951f3b478320c682c65be219660fdf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
b6a43d9e31f6300fe35a27ecd1830a044b7cceb9)
}
LOG.warn("Tx: {} Error during phase {}, starting Abort", transaction.getIdentifier(), phase, throwable);
}
LOG.warn("Tx: {} Error during phase {}, starting Abort", transaction.getIdentifier(), phase, throwable);
- final Exception e;
- if (throwable instanceof NoShardLeaderException || throwable instanceof ShardLeaderNotRespondingException) {
- e = new DataStoreUnavailableException(throwable.getMessage(), throwable);
- } else if (throwable instanceof Exception) {
- e = (Exception)throwable;
- } else {
- e = new RuntimeException("Unexpected error occurred", throwable);
- }
-
- final TransactionCommitFailedException clientException = exMapper.apply(e);
// Transaction failed - tell all cohorts to abort.
// Transaction failed - tell all cohorts to abort.
@SuppressWarnings("unchecked")
ListenableFuture<Void>[] canCommitFutures = new ListenableFuture[cohorts.size()];
int index = 0;
@SuppressWarnings("unchecked")
ListenableFuture<Void>[] canCommitFutures = new ListenableFuture[cohorts.size()];
int index = 0;
canCommitFutures[index++] = cohort.abort();
}
canCommitFutures[index++] = cohort.abort();
}
+ // Propagate the original exception
+ final Exception e;
+ if (throwable instanceof NoShardLeaderException || throwable instanceof ShardLeaderNotRespondingException) {
+ e = new DataStoreUnavailableException(throwable.getMessage(), throwable);
+ } else if (throwable instanceof Exception) {
+ e = (Exception)throwable;
+ } else {
+ e = new RuntimeException("Unexpected error occurred", throwable);
+ }
+ clientSubmitFuture.setException(exMapper.apply(e));
+
ListenableFuture<List<Void>> combinedFuture = Futures.allAsList(canCommitFutures);
Futures.addCallback(combinedFuture, new FutureCallback<List<Void>>() {
@Override
public void onSuccess(List<Void> notUsed) {
// Propagate the original exception to the client.
ListenableFuture<List<Void>> combinedFuture = Futures.allAsList(canCommitFutures);
Futures.addCallback(combinedFuture, new FutureCallback<List<Void>>() {
@Override
public void onSuccess(List<Void> notUsed) {
// Propagate the original exception to the client.
- clientSubmitFuture.setException(clientException);
+ LOG.debug("Tx: {} aborted successfully", transaction.getIdentifier());
}
@Override
public void onFailure(Throwable failure) {
LOG.error("Tx: {} Error during Abort.", transaction.getIdentifier(), failure);
}
@Override
public void onFailure(Throwable failure) {
LOG.error("Tx: {} Error during Abort.", transaction.getIdentifier(), failure);
-
- // Propagate the original exception as that is what caused the Tx to fail and is
- // what's interesting to the client.
- clientSubmitFuture.setException(clientException);
}
}, MoreExecutors.directExecutor());
}
}
}, MoreExecutors.directExecutor());
}