cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r957993 - in /cassandra/branches/cassandra-0.6: src/java/org/apache/cassandra/service/AntiEntropyService.java test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java
Date Fri, 25 Jun 2010 14:42:08 GMT
Author: jbellis
Date: Fri Jun 25 14:42:08 2010
New Revision: 957993

URL: http://svn.apache.org/viewvc?rev=957993&view=rev
Log:
Remove natural repair throttling.  patch by Stu Hood; reviewed by jbellis for CASSANDRA-1190

Modified:
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/service/AntiEntropyService.java
    cassandra/branches/cassandra-0.6/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/service/AntiEntropyService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/service/AntiEntropyService.java?rev=957993&r1=957992&r2=957993&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/service/AntiEntropyService.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/service/AntiEntropyService.java
Fri Jun 25 14:42:08 2010
@@ -88,18 +88,11 @@ public class AntiEntropyService
 
     // millisecond lifetime to store trees before they become stale
     public final static long TREE_STORE_TIMEOUT = 600000;
-    // max millisecond frequency that natural (automatic) repairs should run at
-    public final static long NATURAL_REPAIR_FREQUENCY = 3600000;
 
     // singleton enforcement
     public static final AntiEntropyService instance = new AntiEntropyService();
 
     /**
-     * Map of CFPair to timestamp of the beginning of the last natural repair.
-     */
-    private final ConcurrentMap<CFPair, Long> naturalRepairs;
-
-    /**
      * Map of column families to remote endpoints that need to rendezvous. The
      * first endpoint to arrive at the rendezvous will store its tree in the
      * appropriate slot of the TreePair object, and the second to arrive will
@@ -114,7 +107,6 @@ public class AntiEntropyService
      */
     protected AntiEntropyService()
     {
-        naturalRepairs = new ConcurrentHashMap<CFPair, Long>();
         trees = new HashMap<CFPair, ExpiringMap<InetAddress, TreePair>>();
     }
 
@@ -252,34 +244,6 @@ public class AntiEntropyService
     }
 
     /**
-     * Should only be used for testing.
-     */
-    void clearNaturalRepairs_TestsOnly()
-    {
-        naturalRepairs.clear();
-    }
-
-    /**
-     * @param cf The column family.
-     * @return True if enough time has elapsed since the beginning of the last natural repair.
-     */
-    private boolean shouldRunNaturally(CFPair cf)
-    {
-        Long curtime = System.currentTimeMillis();
-        Long pretime = naturalRepairs.putIfAbsent(cf, curtime);
-        if (pretime != null)
-        {
-            if (pretime < (curtime - NATURAL_REPAIR_FREQUENCY))
-                // replace pretime with curtime, unless someone beat us to it
-                return naturalRepairs.replace(cf, pretime, curtime);
-            // need to wait longer
-            logger.debug("Skipping natural repair: last occurred " + (curtime - pretime)
+ "ms ago.");
-            return false;
-        }
-        return true;
-    }
-
-    /**
      * Return a Validator object which can be used to collect hashes for a column family.
      * A Validator must be prepared() before use, and completed() afterward.
      *
@@ -300,7 +264,7 @@ public class AntiEntropyService
         if (DatabaseDescriptor.getReplicationFactor(table) < 2)
             return new NoopValidator();
         CFPair cfpair = new CFPair(table, cf);
-        if (initiator == null && !shouldRunNaturally(cfpair))
+        if (initiator == null)
             return new NoopValidator();
         return new Validator(cfpair);
     }

Modified: cassandra/branches/cassandra-0.6/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java?rev=957993&r1=957992&r2=957993&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java
(original)
+++ cassandra/branches/cassandra-0.6/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java
Fri Jun 25 14:42:08 2010
@@ -87,14 +87,8 @@ public class AntiEntropyServiceTest exte
     @Test
     public void testGetValidator() throws Throwable
     {
-        aes.clearNaturalRepairs_TestsOnly();
-
         // not major
         assert aes.getValidator(tablename, cfname, null, false) instanceof NoopValidator;
-        // adds entry to naturalRepairs
-        assert aes.getValidator(tablename, cfname, null, true) instanceof Validator;
-        // blocked by entry in naturalRepairs
-        assert aes.getValidator(tablename, cfname, null, true) instanceof NoopValidator;
         // triggered manually
         assert aes.getValidator(tablename, cfname, REMOTE, true) instanceof Validator;
     }



Mime
View raw message