You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tephra.apache.org by anew <gi...@git.apache.org> on 2016/11/05 02:41:50 UTC

[GitHub] incubator-tephra pull request #19: TEPHRA-35 Save compaction state for pruni...

Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/19#discussion_r86656252
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/util/TxUtils.java ---
    @@ -149,4 +149,15 @@ private static long getMaxTTL(Map<byte[], Long> ttlByFamily) {
       public static boolean isPreExistingVersion(long version) {
         return version < MAX_NON_TX_TIMESTAMP;
       }
    +
    +  /**
    +   * Returns the maximum transaction that can be removed from the invalid list for the state represented by the given
    +   * transaction.
    +   */
    +  public static long getPruneUpperBound(Transaction tx) {
    +    long maxInvalidTx =
    +      tx.getInvalids().length > 0 ? tx.getInvalids()[tx.getInvalids().length - 1] : Transaction.NO_TX_IN_PROGRESS;
    +    long firstInProgress = tx.getFirstInProgress();
    +    return Math.min(maxInvalidTx, firstInProgress - 1);
    --- End diff --
    
    if there is no invalid tx, and also no in-progress, the upper bound would still be the current tx id? That is, return tx.getTransactionId()-1? 


---
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.
---