Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-19426

Fix Double Type issues in the Gossiper#maybeGossipToCMS

    XMLWordPrintableJSON

Details

    • 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

          Activity

            People

              maoling Ling Mao
              maoling Ling Mao
              Ling Mao
              Stefan Miklosovic
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m