Remove inFlightEcho entry on ECHO_REQ failure

patch by Cameron Zemek; reviewed by Stefan Miklosovic, Caleb Rackliffe for CASSANDRA-21428
This commit is contained in:
Cameron Zemek 2026-06-05 11:28:52 +10:00 committed by Stefan Miklosovic
parent 1362ac6f69
commit 8aa71cea52
No known key found for this signature in database
GPG Key ID: 32F35CB2F546D93E
2 changed files with 26 additions and 6 deletions

View File

@ -1,4 +1,5 @@
4.0.21
* Remove inFlightEcho entry on ECHO_REQ failure (CASSANDRA-21428)
* Validate snapshot names (CASSANDRA-21389)
* BTree.FastBuilder.reset() fails to clear savedBuffer and savedNextKey, causing ClassCastException and SSTable header corruption during schema disagreement (CASSANDRA-21216, CASSANDRA-21260)
* Backport CASSANDRA-17810 fix and improve RTBoundValidator error messages (CASSANDRA-18282)

View File

@ -58,6 +58,7 @@ import org.apache.cassandra.concurrent.Stage;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.SystemKeyspace;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.exceptions.RequestFailureReason;
import org.apache.cassandra.net.RequestCallback;
import org.apache.cassandra.net.Message;
import org.apache.cassandra.net.MessagingService;
@ -633,6 +634,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
private void evictFromMembership(InetAddressAndPort endpoint)
{
checkProperThreadForStateMutation();
inflightEcho.remove(endpoint);
unreachableEndpoints.remove(endpoint);
endpointStateMap.remove(endpoint);
expireTimeEndpointMap.remove(endpoint);
@ -1339,13 +1341,30 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
{
Message<NoPayload> echoMessage = Message.out(ECHO_REQ, noPayload);
logger.trace("Sending ECHO_REQ to {}", addr);
RequestCallback echoHandler = msg ->
RequestCallback echoHandler = new RequestCallback()
{
runInGossipStageBlocking(() -> {
EndpointState epState = inflightEcho.remove(addr);
if (epState != null)
realMarkAlive(addr, epState);
});
@Override
public void onResponse(Message msg)
{
runInGossipStageBlocking(() -> {
EndpointState epState = inflightEcho.remove(addr);
if (epState != null)
realMarkAlive(addr, epState);
});
}
@Override
public boolean invokeOnFailure()
{
return true;
}
@Override
public void onFailure(InetAddressAndPort from, RequestFailureReason failureReason)
{
logger.trace("ECHO_REQ to {} failed ({})", addr, failureReason);
inflightEcho.remove(addr);
}
};
MessagingService.instance().sendWithCallback(echoMessage, addr, echoHandler);
}