tephra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtyim <...@git.apache.org>
Subject [GitHub] incubator-tephra pull request #23: [Tephra-201] Store checkpoints in in-prog...
Date Thu, 08 Dec 2016 08:16:51 GMT
Github user chtyim commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/23#discussion_r91462088
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionManager.java ---
    @@ -958,25 +983,31 @@ private void doAbort(long writePointer, long[] checkpointWritePointers,
Transact
         // makes tx visible (assumes that all operations were rolled back)
         // remove from in-progress set, so that it does not get excluded in the future
         InProgressTx removed = inProgress.remove(writePointer);
    +    boolean isInvalid = false;
         if (removed == null) {
           // tx was not in progress! perhaps it timed out and is invalid? try to remove it
there.
           if (invalid.rem(writePointer)) {
    +        isInvalid = true;
             // remove any invalidated checkpoint pointers
             // this will only be present if the parent write pointer was also invalidated
             if (checkpointWritePointers != null) {
    -          for (int i = 0; i < checkpointWritePointers.length; i++) {
    -            invalid.rem(checkpointWritePointers[i]);
    +          for (long checkpointWritePointer : checkpointWritePointers) {
    +            invalid.rem(checkpointWritePointer);
               }
             }
             invalidArray = invalid.toLongArray();
             LOG.info("Tx invalid list: removed aborted tx {}", writePointer);
    -        // removed a tx from excludes: must move read pointer
    -        moveReadPointerIfNeeded(writePointer);
           }
    -    } else {
    -      // removed a tx from excludes: must move read pointer
    -      moveReadPointerIfNeeded(writePointer);
         }
    +    if (!isInvalid) {
    +      if (checkpointWritePointers != null) {
    --- End diff --
    
    These two `if`s can be combined with a `&&` to have the code less indented.


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