bdeggleston commented on code in PR #4708:
URL: https://github.com/apache/cassandra/pull/4708#discussion_r3562285239


##########
src/java/org/apache/cassandra/service/paxos/PaxosCommit.java:
##########
@@ -474,17 +655,35 @@ public void onResponse(NoPayload response, 
InetAddressAndPort from)
      * Record a failure or success response if {@code from} contributes to our 
consistency.
      * If we have reached a final outcome of the commit, run {@code onDone}.
      */
+    @VisibleForTesting
+    protected boolean isFromLocalDc(InetAddressAndPort endpoint)
+    {
+        return InOurDc.endpoints().test(endpoint);
+    }
+
     private void response(boolean success, InetAddressAndPort from)
     {
-        if (consistencyForCommit.isDatacenterLocal() && 
!InOurDc.endpoints().test(from))
+        if (consistencyForCommit.isDatacenterLocal() && !isFromLocalDc(from))
             return;
 
         long responses = responsesUpdater.addAndGet(this, success ? 0x1L : 
0x100000000L);
         // next two clauses mutually exclusive to ensure we only invoke onDone 
once, when either failed or succeeded
         if (accepts(responses) == required) // if we have received _precisely_ 
the required accepts, we have succeeded
-            onDone.accept(status());
+            onPaxosDecision();
         else if (replicas.size() - failures(responses) == required - 1) // if 
we are _unable_ to receive the required accepts, we have failed
+            onPaxosDecision();
+    }
+
+    /**
+     * Called exactly once when the paxos consensus decision (success or 
failure) is made.
+     * If an additional commit future exists, onDone is deferred until it also 
completes.
+     */
+    private void onPaxosDecision()
+    {
+        if (augmentedCommit == null)
             onDone.accept(status());
+        else
+            augmentedCommit.onPaxosComplete(status());

Review Comment:
   yeah it's only ever set on `PaxosCommit#start`



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