[
https://issues.apache.org/jira/browse/TEPHRA-240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16162616#comment-16162616
]
ASF GitHub Bot commented on TEPHRA-240:
---------------------------------------
Github user poornachandra commented on a diff in the pull request:
https://github.com/apache/incubator-tephra/pull/47#discussion_r138270921
--- Diff:
tephra-core/src/main/java/org/apache/tephra/TransactionManager.java ---
@@ -853,46 +867,45 @@ private void advanceWritePointer(long writePointer) {
}
}
- public boolean canCommit(Transaction tx, Collection<byte[]> changeIds)
- throws TransactionNotInProgressException, TransactionSizeException {
+ public void canCommit(long txId, Collection<byte[]> changeIds)
+ throws TransactionNotInProgressException, TransactionSizeException,
TransactionConflictException {
txMetricsCollector.rate("canCommit");
Stopwatch timer = new Stopwatch().start();
- InProgressTx inProgressTx = inProgress.get(tx.getTransactionId());
+ InProgressTx inProgressTx = inProgress.get(txId);
if (inProgressTx == null) {
synchronized (this) {
// invalid transaction, either this has timed out and moved to
invalid, or something else is wrong.
- if (invalidTxList.contains(tx.getTransactionId())) {
+ if (invalidTxList.contains(txId)) {
throw new TransactionNotInProgressException(
String.format(
- "canCommit() is called for transaction %d that is not in
progress (it is known to be invalid)",
- tx.getTransactionId()));
+ "canCommit() is called for transaction %d that is not in
progress (it is known to be invalid)", txId));
} else {
throw new TransactionNotInProgressException(
- String.format("canCommit() is called for transaction %d that
is not in progress", tx.getTransactionId()));
+ String.format("canCommit() is called for transaction %d that
is not in progress", txId));
}
}
}
Set<ChangeId> set =
- validateChangeSet(tx, changeIds, inProgressTx.clientId != null ?
inProgressTx.clientId : DEFAULT_CLIENTID);
-
- if (hasConflicts(tx, set)) {
- return false;
+ validateChangeSet(txId, changeIds, inProgressTx.clientId != null ?
inProgressTx.clientId : DEFAULT_CLIENTID);
+ for (byte[] change : changeIds) {
--- End diff --
I don't think this for-loop is needed as method `validateChangeSet()`
already returns `Set<ChangeId>`.
> TransactionConflictException should contain the conflicting key and client id
> -----------------------------------------------------------------------------
>
> Key: TEPHRA-240
> URL: https://issues.apache.org/jira/browse/TEPHRA-240
> Project: Tephra
> Issue Type: Bug
> Reporter: Andreas Neumann
> Assignee: Andreas Neumann
> Fix For: 0.13.0-incubating
>
>
> Often transaction conflicts are hard to explain. Having the conflicting key,
> or even the name of the client that performed the concurrent update would
> greatly help debug.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)