You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2013/11/21 03:58:09 UTC

[4/9] git commit: merge from 1.2

merge from 1.2


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/91d56bf5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/91d56bf5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/91d56bf5

Branch: refs/heads/cassandra-2.0
Commit: 91d56bf5cadd25674e4034462f5a0a2ee2ab4132
Parents: 26d1b68 e01224e
Author: Jonathan Ellis <jb...@apache.org>
Authored: Wed Nov 20 20:55:51 2013 -0600
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Wed Nov 20 20:55:51 2013 -0600

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/gms/FailureDetector.java   | 41 +++++++++++++-------
 .../apache/cassandra/gms/ArrivalWindowTest.java |  9 ++---
 3 files changed, 30 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/91d56bf5/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 00b82c0,b3fa565..6ae8e8c
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,33 -1,9 +1,34 @@@
 -1.2.13
 +2.0.3
 + * Fix FD leak on slice read path (CASSANDRA-6275)
 + * Cancel read meter task when closing SSTR (CASSANDRA-6358)
 + * free off-heap IndexSummary during bulk (CASSANDRA-6359)
 + * Recover from IOException in accept() thread (CASSANDRA-6349)
 + * Improve Gossip tolerance of abnormally slow tasks (CASSANDRA-6338)
 + * Fix trying to hint timed out counter writes (CASSANDRA-6322)
 + * Allow restoring specific columnfamilies from archived CL (CASSANDRA-4809)
 + * Avoid flushing compaction_history after each operation (CASSANDRA-6287)
 + * Fix repair assertion error when tombstones expire (CASSANDRA-6277)
 + * Skip loading corrupt key cache (CASSANDRA-6260)
 + * Fixes for compacting larger-than-memory rows (CASSANDRA-6274)
 + * Compact hottest sstables first and optionally omit coldest from
 +   compaction entirely (CASSANDRA-6109)
 + * Fix modifying column_metadata from thrift (CASSANDRA-6182)
 + * cqlsh: fix LIST USERS output (CASSANDRA-6242)
 + * Add IRequestSink interface (CASSANDRA-6248)
 + * Update memtable size while flushing (CASSANDRA-6249)
 + * Provide hooks around CQL2/CQL3 statement execution (CASSANDRA-6252)
 + * Require Permission.SELECT for CAS updates (CASSANDRA-6247)
 + * New CQL-aware SSTableWriter (CASSANDRA-5894)
 + * Reject CAS operation when the protocol v1 is used (CASSANDRA-6270)
 + * Correctly throw error when frame too large (CASSANDRA-5981)
 + * Fix serialization bug in PagedRange with 2ndary indexes (CASSANDRA-6299)
 + * Fix CQL3 table validation in Thrift (CASSANDRA-6140)
 + * Fix bug missing results with IN clauses (CASSANDRA-6327)
 + * Fix paging with reversed slices (CASSANDRA-6343)
 + * Set minTimestamp correctly to be able to drop expired sstables (CASSANDRA-6337)
 +Merged from 1.2:
   * Optimize FD phi calculation (CASSANDRA-6386)
+  * Improve initial FD phi estimate when starting up (CASSANDRA-6385)
 -
 -
 -1.2.12
   * Invalidate row cache when dropping CF (CASSANDRA-6351)
   * add non-jamm path for cached statements (CASSANDRA-6293)
   * (Hadoop) Require CFRR batchSize to be at least 2 (CASSANDRA-6114)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/91d56bf5/src/java/org/apache/cassandra/gms/FailureDetector.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/gms/FailureDetector.java
index bb07154,ee47997..4e5ba90
--- a/src/java/org/apache/cassandra/gms/FailureDetector.java
+++ b/src/java/org/apache/cassandra/gms/FailureDetector.java
@@@ -284,22 -287,23 +295,24 @@@ class ArrivalWindo
          arrivalIntervals = new BoundedStatsDeque(size);
      }
  
 -    synchronized void add(double value)
 +    synchronized void add(long value)
      {
-         long interArrivalTime;
-         if (tLast != 0L)
++        assert tLast >= 0;
+         if (tLast > 0L)
          {
-             interArrivalTime = (value - tLast);
 -            double interArrivalTime = (value - tLast);
 -            if (interArrivalTime <= MAX_INTERVAL_IN_MS)
++            long interArrivalTime = (value - tLast);
++            if (interArrivalTime <= MAX_INTERVAL_IN_NANO)
+                 arrivalIntervals.add(interArrivalTime);
+             else
+                 logger.debug("Ignoring interval time of {}", interArrivalTime);
          }
          else
          {
-             interArrivalTime = (Gossiper.intervalInMillis * MILLI_TO_NANO) / 2;
+             // We use a very large initial interval since the "right" average depends on the cluster size
+             // and it's better to err high (false negatives, which will be corrected by waiting a bit longer)
+             // than low (false positives, which cause "flapping").
 -            arrivalIntervals.add(Gossiper.intervalInMillis * 30);
++            arrivalIntervals.add(Gossiper.intervalInMillis * MILLI_TO_NANO * 30);
          }
- 
-         if (interArrivalTime <= MAX_INTERVAL_IN_NANO)
-             arrivalIntervals.add(interArrivalTime);
-         else
-             logger.debug("Ignoring interval time of {}", interArrivalTime);
          tLast = value;
      }
  
@@@ -311,11 -315,9 +324,9 @@@
      // see CASSANDRA-2597 for an explanation of the math at work here.
      double phi(long tnow)
      {
-         int size = arrivalIntervals.size();
+         assert arrivalIntervals.size() > 0 && tLast > 0; // should not be called before any samples arrive
 -        double t = tnow - tLast;
 +        long t = tnow - tLast;
-         return (size > 0)
-                ? PHI_FACTOR * (t / mean())
-                : 0.0;
+         return t / mean();
      }
  
      public String toString()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/91d56bf5/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java
index d05ba96,46fee34..e678d86
--- a/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java
+++ b/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java
@@@ -28,23 -28,20 +28,20 @@@ import org.junit.Test
  public class ArrivalWindowTest
  {
      @Test
 -    public void test()
 +    public void testWithNanoTime()
      {
 -        ArrivalWindow window = new ArrivalWindow(4);
 -        //base readings
 -        window.add(111);
 -        window.add(222);
 -        window.add(333);
 -        window.add(444);
 -        window.add(555);
 +        final ArrivalWindow windowWithNano = new ArrivalWindow(4);
 +        final long toNano = 1000000L;
  
 -        //all good
 -        assertEquals(1.0, window.phi(666), 0.01);
 +        windowWithNano.add(111 * toNano);
 +        windowWithNano.add(222 * toNano);
 +        windowWithNano.add(333 * toNano);
 +        windowWithNano.add(444 * toNano);
 +        windowWithNano.add(555 * toNano);
  
- 
-         assertEquals(0.4342, windowWithNano.phi(666 * toNano), 0.01);
++        //all good
++        assertEquals(1.0, windowWithNano.phi(666 * toNano), 0.01);
          //oh noes, a much higher timestamp, something went wrong!
-         assertEquals(9.566, windowWithNano.phi(3000 * toNano), 0.01);
- 
 -        assertEquals(22.03, window.phi(3000), 0.01);
++        assertEquals(22.03, windowWithNano.phi(3000 * toNano), 0.01);
      }
- 
- 
  }