Details
-
Improvement
-
Status: Open
-
Low
-
Resolution: Unresolved
-
None
-
Performance
-
Low Hanging Fruit
-
All
-
None
Description
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:
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"); }
A good example from: Gossiper#maybeGossipToUnreachableMember
if (randDbl < prob)
{
sendGossip(message, Sets.filter(unreachableEndpoints.keySet(),
ep -> !isDeadState(getEndpointStateMap().get(ep))));
}
Attachments
Issue Links
- links to