This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch CASSANDRA-16588-trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 13b66fe9d5b08c31fd6b6ed0a9d5929ca742dcd2
Author: Sam Tunnicliffe <[email protected]>
AuthorDate: Thu Apr 15 11:46:21 2021 +0100

    Check for specific app states in shadow round
---
 src/java/org/apache/cassandra/gms/Gossiper.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java 
b/src/java/org/apache/cassandra/gms/Gossiper.java
index 923ffc8..4fde131 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1969,16 +1969,12 @@ public class Gossiper implements 
IFailureDetectionEventListener, GossiperMBean
         return (scheduledGossipTask != null) && 
(!scheduledGossipTask.isCancelled());
     }
 
-    public boolean isShadowRoundStateMap(Map<InetAddressAndPort, 
EndpointState> epStateMap)
+    public boolean sufficientForStartupSafetyCheck(Map<InetAddressAndPort, 
EndpointState> epStateMap)
     {
         // it is possible for a previously queued ack to be sent to us when we 
come back up in shadow
         EndpointState localState = 
epStateMap.get(FBUtilities.getBroadcastAddressAndPort());
-        if (localState != null && epStateMap.size() == 1) // response only 
contains our IP
-        {
-            logger.debug("Not exiting shadow round because received bogus ACK 
{} -> {}", FBUtilities.getBroadcastAddressAndPort(), localState);
-            return false;
-        }
-        return true;
+        // return false if response doesn't contain state necessary for safety 
check
+        return localState != null && 
localState.containsApplicationState(ApplicationState.HOST_ID);
     }
 
     protected void maybeFinishShadowRound(InetAddressAndPort respondent, 
boolean isInShadowRound, Map<InetAddressAndPort, EndpointState> epStateMap)
@@ -1987,8 +1983,12 @@ public class Gossiper implements 
IFailureDetectionEventListener, GossiperMBean
         {
             if (!isInShadowRound)
             {
-                if (!isShadowRoundStateMap(epStateMap))
+                if (!sufficientForStartupSafetyCheck(epStateMap))
+                {
+                    logger.debug("Not exiting shadow round because received 
ACK with insufficient states {} -> {}",
+                                 FBUtilities.getBroadcastAddressAndPort(), 
epStateMap.get(FBUtilities.getBroadcastAddressAndPort()));
                     return;
+                }
 
                 if (!seeds.contains(respondent))
                     logger.warn("Received an ack from {}, who isn't a seed. 
Ensure your seed list includes a live node. Exiting shadow round",

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

Reply via email to