[ 
https://issues.apache.org/jira/browse/CASSANDRA-18546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17726949#comment-17726949
 ] 

Stefan Miklosovic commented on CASSANDRA-18546:
-----------------------------------------------

trunk 
j11 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2322/workflows/1565ea8d-47d7-4bd4-b31e-125b2351bc77
j8 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2322/workflows/ac14b081-811c-432e-8f34-964b8a387338
branch https://github.com/instaclustr/cassandra/tree/CASSANDRA-18546-trunk

4.1
j11 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2321/workflows/bb3c4b46-dee5-4d25-9f6f-e24a26f5a3c8
j8 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2321/workflows/92f5397d-14e0-4725-8b0b-45fe77d147ff
branch https://github.com/instaclustr/cassandra/tree/CASSANDRA-18546-4.1

4.0
j11 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2318/workflows/d456f4a1-0fed-4397-9ccd-8406e3260728
j8 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2318/workflows/bb938792-21be-40d6-a0dc-331a74a6dc1e
branch https://github.com/instaclustr/cassandra/tree/CASSANDRA-18546-4.0

> Remove Gossiper#makeRandomGossipDigest
> --------------------------------------
>
>                 Key: CASSANDRA-18546
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18546
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Cluster/Gossip
>            Reporter: Cameron Zemek
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 4.0.x, 4.1.x, 5.x
>
>
> In going through trying to understand the Gossiper code I come across:
> {code:java}
>     /**
>      * The gossip digest is built based on randomization
>      * rather than just looping through the collection of live endpoints.
>      *
>      * @param gDigests list of Gossip Digests.
>      */
>     private void makeRandomGossipDigest(List<GossipDigest> gDigests) {code}
> But I couldn't see what purpose randomization had. In fact in 3.11 it will 
> call:
> {code:java}
>  doSort(gDigestList); {code}
> On the receiving end, negating the purpose of the randomization.
>  
> In discussion with [~stefan.miklosovic] he found this ticket CASSANDRA-14174
> So it seems to me this randomization may have been to allow for limited sizes 
> of SYN messages. But this feature doesn't exist and as such by randomizing it 
> is:
>  * creating more garbage
>  * using more CPU (sure its mostly trival; see next point)
>  * more time spent on unnecessary functionality on the *single threaded* 
> gossip stage.
>  * complicating the code and making it more difficult to understand
> In fact there is a bug in the implementation:
> {code:java}
>         int generation = 0;
>         int maxVersion = 0;        // local epstate will be part of 
> endpointStateMap
>         List<InetAddress> endpoints = new 
> ArrayList<InetAddress>(endpointStateMap.keySet());
>         Collections.shuffle(endpoints, random);
>         for (InetAddress endpoint : endpoints)
>         {
>             epState = endpointStateMap.get(endpoint);
>             if (epState != null)
>             {
>                 generation = epState.getHeartBeatState().getGeneration();
>                 maxVersion = getMaxEndpointStateVersion(epState);
>             }
>             gDigests.add(new GossipDigest(endpoint, generation, maxVersion));
>         } {code}
> If epState is null and we already had a non-null epState, then the next 
> digest will use the generation and maxVersion of the previous iterated 
> epState.
>  
> Here is change to remove this randomization and fix the above bug, 
> [https://github.com/apache/cassandra/pull/2357/commits/1ba422ab5de35f7057c7621ec3607dcbca19768c]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to