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 #22: Transaction pruning service
Date Mon, 12 Dec 2016 17:02:22 GMT
Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/22#discussion_r91990644
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/util/TxUtils.java ---
    @@ -163,8 +167,22 @@ public static long getPruneUpperBound(Transaction tx) {
     
         long maxInvalidTx =
           tx.getInvalids().length > 0 ? tx.getInvalids()[tx.getInvalids().length - 1]
: Transaction.NO_TX_IN_PROGRESS;
    +
    +    // An invalid transaction can be used up to its max lifetime for data writes, hence
we cannot prune an invalid
    +    // transaction until it exhausts its max lifetime.
    +    long elapsedTime = currentTimeMillis - TxUtils.getTimestamp(maxInvalidTx);
    +    long invalidTxBound;
    +    if (elapsedTime > txMaxLifetimeMillis) {
    +      // maxInvalidTx is past its max lifetime
    +      invalidTxBound = maxInvalidTx;
    +    } else {
    +      // Reduce the lifetime of maxInvalidTx, so that it cannot be used for any more
writes
    +      long remainingTime = txMaxLifetimeMillis - elapsedTime;
    +      invalidTxBound = maxInvalidTx - remainingTime * TxConstants.MAX_TX_PER_MS - 1;
    --- End diff --
    
    agreed. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message