smiklosovic commented on code in PR #2376:
URL: https://github.com/apache/cassandra/pull/2376#discussion_r1208608695


##########
src/java/org/apache/cassandra/gms/Gossiper.java:
##########
@@ -1299,14 +1304,39 @@ void notifyFailureDetector(InetAddressAndPort endpoint, 
EndpointState remoteEndp
 
     private void markAlive(final InetAddressAndPort addr, final EndpointState 
localState)
     {
+        if (inflightEcho.contains(addr))
+        {
+            return;
+        }
+        inflightEcho.add(addr);
+
         localState.markDead();
 
         Message<NoPayload> echoMessage = Message.out(ECHO_REQ, noPayload);
         logger.trace("Sending ECHO_REQ to {}", addr);
-        RequestCallback echoHandler = msg ->
+        RequestCallback echoHandler = new RequestCallback()
         {
-            // force processing of the echo response onto the gossip stage, as 
it comes in on the REQUEST_RESPONSE stage
-            runInGossipStageBlocking(() -> realMarkAlive(addr, localState));
+            @Override
+            public void onResponse(Message msg)
+            {
+                // force processing of the echo response onto the gossip 
stage, as it comes in on the REQUEST_RESPONSE stage
+                runInGossipStageBlocking(() -> {
+                    realMarkAlive(addr, localState);
+                    inflightEcho.remove(addr);

Review Comment:
   @grom358 what happens when `realMarkAlive` throws an exception? (it might 
happen if you check closely). Is it guaranteed that exception thrown in 
`realMarkAlive` will invoke `onFailure`? 
   
   How I understand it is that `onResponse` will be invoked when we have acutal 
answer from other node, if we do not or there is a failure, `onFailure` is 
invoked. But does it mean that when we get a response and this method is 
called, when it fails, onFailure is invoked too?



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