In looking into CASSANDRA-19580 I noticed something that raises a question. 
With Gossip SYN it doesn't check for missing digests. If its empty for shadow 
round it will add everything from endpointStateMap to the reply. But why not 
included missing entries in normal replies? The branching for reply handling of 
SYN requests could then be merged into single code path (though shadow round 
handles empty state different with CASSANDRA-16213). Potential is performance 
impact as this requires doing a set difference.

For example, something along the lines of:

```
        Set<InetAddressAndPort> missing = new 
HashSet<>(endpointStateMap.keySet());
        
missing.removeAll(gDigestList.stream().map(GossipDigest::getEndpoint).collect(Collectors.toSet()));
        for ( InetAddressAndPort endpoint : missing)
        {
            gDigestList.add(new GossipDigest(endpoint, 0, 0));
        }
```

It seems odd to me that after shadow round for a new node we have 
endpointStateMap with only itself as an entry. Then the only way it gets the 
gossip state is by another node choosing to send the new node a gossip SYN. The 
choosing of this is random. Yeah this happens every second so eventually its 
going to receive one (outside the issue of CASSANDRA-19580 were it doesn't if 
its in a dead state like hibernate) , but doesn't this open up bootstrapping to 
failures on very large clusters as it can take longer before its sent a SYN (as 
the odds of being chosen for SYN get lower)? For years been seeing bootstrap 
failures with 'Unable to contact any seeds' but they are infrequent and never 
been able to figure out how to reproduce in order to open a ticket, but I 
wonder if some of them have been due to not receiving a SYN message before it 
does the seenAnySeed check.

Reply via email to