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

Stefan Miklosovic commented on CASSANDRA-19426:
-----------------------------------------------

[~samt] thoughts?

> Fix Double Type issues in the Gossiper#maybeGossipToCMS
> -------------------------------------------------------
>
>                 Key: CASSANDRA-19426
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19426
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Cluster/Gossip, Transactional Cluster Metadata
>            Reporter: Ling Mao
>            Assignee: Ling Mao
>            Priority: Low
>             Fix For: 5.x
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> _*issue-1:*_
> if liveEndpoints.size()=unreachableEndpoints.size()=0; probability will be 
> {*}_Infinity_{*}.
> randDbl <= probability will always be true, then sendGossip
> _*issue-2:*_ 
> comparing two double is safe by using *<* or {*}>{*}. However missing 
> accuracy will happen if we compare the equality of two double by 
> intuition({*}={*}). For example:
> {code:java}
> double probability = 0.1;
> double randDbl = 0.10000000000000001; // Slightly greater than probability
> if (randDbl <= probability)
> {
>     System.out.println("randDbl <= probability(always here)");
> }
> else
> {
>     System.out.println("randDbl > probability");
> }
> {code}
> A good example from: _*Gossiper#maybeGossipToUnreachableMember*_
> {code:java}
> if (randDbl < prob)
> {
> sendGossip(message, Sets.filter(unreachableEndpoints.keySet(),
>                                 ep -> 
> !isDeadState(getEndpointStateMap().get(ep))));
> }{code}



--
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