Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/191#discussion_r167016249
  
    --- Diff: src/java/org/apache/cassandra/net/MessagingService.java ---
    @@ -1664,4 +1676,113 @@ public static boolean 
isEncryptedConnection(InetAddressAndPort address)
             }
             return true;
         }
    +
    +    public void blockForPeers()
    +    {
    +        // TODO make these yaml props?
    +        int alivePercent = Integer.getInteger(Config.PROPERTY_PREFIX + 
"blockForPeers.percent", 70);
    +        if (alivePercent < 0)
    +            alivePercent = 0;
    +        else if (alivePercent > 100)
    +            alivePercent = 100;
    +
    +        int aliveTimeoutSecs = Integer.getInteger(Config.PROPERTY_PREFIX + 
"blockForPeers.timeout_in_secs", 10);
    +        if (aliveTimeoutSecs < 0)
    +            aliveTimeoutSecs = 1;
    +        else if (aliveTimeoutSecs > 100)
    +            aliveTimeoutSecs = 100;
    +
    +        if (alivePercent > 0)
    +            blockForPeers(alivePercent, aliveTimeoutSecs);
    +    }
    +
    +    private void blockForPeers(int targetAlivePercent, int 
aliveTimeoutSecs)
    +    {
    +        // grab a snapshot of the current cluster from Gossiper. this is 
completely prone to race conditions, but it's
    +        // good enough for the purposes of blocking until some certain 
percentage of nodes are considered 'alive'/connected.
    +        Set<Map.Entry<InetAddressAndPort, EndpointState>> peers = new 
HashSet<>(Gossiper.instance.getEndpointStates());
    --- End diff --
    
    When we reach this how do we know that Gossiper will be seeded with any 
endpoint states so we know to wait on a realistic portion of the cluster?
    
    I assume it's implicit in the bootstrapping process before we get to this 
point?


---

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

Reply via email to