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

BADNESS_THRESHOLD does not working correctly with DynamicEndpointSnitch

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.0.6, 2.1 beta2
    • None
    • Linux 3.8.0-33-generic

    • Normal

    Description

      There is a problem in DynamicEndpointSnitch.java in sortByProximityWithBadness()

      Before calling sortByProximityWithScore we comparing each nodes score ratios to the badness threshold.

      if ((first - next) / first >  BADNESS_THRESHOLD)
                  {
                      sortByProximityWithScore(address, addresses);
                      return;
                  }
      

      This is not always the correct comparison because first score can be less than next score and in that case we will compare a negative number with positive.

      The solution is to compute absolute value of the ratio:

      if (Math.abs((first - next) / first) > BADNESS_THRESHOLD)
      

      This issue causing an incorrect sorting of DCs based on their performance and affects performance of the snitch.

      Thanks.

      Attachments

        1. 6683.patch
          8 kB
          Tom Hobbs

        Activity

          People

            thobbs Tom Hobbs
            kirill.sc Kirill Bogdanov
            Tom Hobbs
            Brandon Williams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: