tephra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anew <...@git.apache.org>
Subject [GitHub] incubator-tephra pull request #47: [TEPHRA-240] Include conflicting key and ...
Date Tue, 12 Sep 2017 19:02:44 GMT
Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/47#discussion_r138437903
  
    --- 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 --
    
    Good catch. I forgot to remove this from existing code. 


---

Mime
View raw message