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:

    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionManager.java ---
    @@ -958,25 +983,31 @@ private void doAbort(long writePointer, long[] checkpointWritePointers,
         // 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
           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) {
    --- End diff --
    I found this variable name less clear on the actual action. Probably better call it `removeInProgressCheckpoints`?
Because it is actually what the condition is about. It seems less clear to me why "not invalid"
means something needs to be removed from the inprogress when reading this part of the code.
I have to trace back to see how this variable is being set. If the variable is "removeInProgressCheckpoints",
it's more obvious that removal needs to be performed here and I can optionally trace the code
if I am interested in how it is being set.

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.

View raw message