belliottsmith commented on code in PR #168:
URL: https://github.com/apache/cassandra-accord/pull/168#discussion_r1954109621


##########
accord-core/src/main/java/accord/coordinate/Propose.java:
##########
@@ -102,32 +108,37 @@ public void onSuccess(Id from, AcceptReply reply)
         if (isDone)
             return;
 
-        switch (reply.outcome())
+        switch (reply.outcome)
         {
             default: throw new AssertionError("Unhandled AcceptOutcome: " + 
reply.outcome());
-            case Truncated:
-                isDone = true;
-                callback.accept(null, new Truncated(txnId, route.homeKey()));
-                break;
-
             case RejectedBallot:
                 isDone = true;
                 callback.accept(null, new Preempted(txnId, route.homeKey()));
                 break;
 
+            case Truncated:
             case Redundant:
-                if (reply.supersededBy != null || ballot.equals(Ballot.ZERO))
+                if (sendTo == route || !isSufficientPartialReply(reply, from))
                 {
-                    isDone = true;
-                    callback.accept(null, new Preempted(txnId, 
route.homeKey()));
+                    Throwable failNow = reply.outcome == 
AcceptOutcome.Truncated

Review Comment:
   Sure. I think you have more of a problem with ternaries than me, but I am 
not adequately enamoured with them to prefer them strongly.



##########
accord-core/src/main/java/accord/coordinate/Propose.java:
##########
@@ -140,17 +151,27 @@ else if (reply.committedExecuteAt != null)
         }
     }
 
+    private boolean isSufficientPartialReply(AcceptReply reply, Id from)
+    {
+        return reply.successful != null && 
reply.successful.containsAll(sendTo.slice(acceptTracker.topologies().computeRangesForNode(from),
 Minimal));
+    }
+
     @Override
     public void onFailure(Id from, Throwable failure)
     {
+        // TODO (desired): this is a common pattern, find a way to more fully 
share it
         if (isDone)
             return;
 
-        // TODO (required): we aren't tracking the specific failure here to 
report
+        if (failure != null)
+            this.failure = FailureAccumulator.append(this.failure, failure);
+
         if (acceptTracker.recordFailure(from) == Failed)
         {
             isDone = true;
-            callback.accept(null, new Timeout(txnId, route.homeKey()));
+            if (this.failure == null)
+                this.failure = new Timeout(txnId, route.homeKey());

Review Comment:
   `Exhausted` again?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to