cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r893613 - in /incubator/cassandra/branches/cassandra-0.5: CHANGES.txt src/java/org/apache/cassandra/db/HintedHandOffManager.java src/java/org/apache/cassandra/gms/Gossiper.java
Date Wed, 23 Dec 2009 19:43:42 GMT
Author: jbellis
Date: Wed Dec 23 19:43:42 2009
New Revision: 893613

URL: http://svn.apache.org/viewvc?rev=893613&view=rev
Log:
discard hints for nodes that are no longer part of the gossip network.  patch by jbellis;
reviewed by Jaakko Laine and goffinet for CASSANDRA-634

Modified:
    incubator/cassandra/branches/cassandra-0.5/CHANGES.txt
    incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/db/HintedHandOffManager.java
    incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/gms/Gossiper.java

Modified: incubator/cassandra/branches/cassandra-0.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/cassandra/branches/cassandra-0.5/CHANGES.txt?rev=893613&r1=893612&r2=893613&view=diff
==============================================================================
--- incubator/cassandra/branches/cassandra-0.5/CHANGES.txt (original)
+++ incubator/cassandra/branches/cassandra-0.5/CHANGES.txt Wed Dec 23 19:43:42 2009
@@ -10,7 +10,7 @@
  * Handle obsolete gossip related to node movement in the case where
    one or more nodes is down when the movement occurs (CASSANDRA-572)
  * Include dead nodes in gossip to avoid a variety of problems
-   (CASSANDRA-634)
+   and fix HH to removed nodes (CASSANDRA-634)
  * return an InvalidRequestException for mal-formed SlicePredicates
    (CASSANDRA-643)
  * fix bug determining closest neighbor for use in multiple datacenters

Modified: incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/db/HintedHandOffManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/db/HintedHandOffManager.java?rev=893613&r1=893612&r2=893613&view=diff
==============================================================================
--- incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/db/HintedHandOffManager.java
(original)
+++ incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/db/HintedHandOffManager.java
Wed Dec 23 19:43:42 2009
@@ -33,6 +33,8 @@
 import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.gms.FailureDetector;
+import org.apache.cassandra.gms.Gossiper;
+
 import java.net.InetAddress;
 import org.apache.cassandra.net.Message;
 import org.apache.cassandra.net.MessagingService;
@@ -77,7 +79,7 @@
     private static HintedHandOffManager instance_;
     private static Lock lock_ = new ReentrantLock();
     private static Logger logger_ = Logger.getLogger(HintedHandOffManager.class);
-    final static long INTERVAL_IN_MS = 3600 * 1000;
+    final static long INTERVAL_IN_MS = 3600 * 1000; // check for ability to deliver hints
this often
     private ExecutorService executor_ = new DebuggableThreadPoolExecutor("HINTED-HANDOFF-POOL");
     Timer timer = new Timer("HINTED-HANDOFF-TIMER");
     public static final String HINTS_CF = "HintsColumnFamily";
@@ -103,6 +105,11 @@
 
     private static boolean sendMessage(InetAddress endPoint, String tableName, String key)
throws IOException
     {
+        if (!Gossiper.instance().isKnownEndpoint(endPoint))
+        {
+            logger_.warn("Hints found for endpoint " + endPoint + " which is not part of
the gossip network.  discarding.");
+            return true;
+        }
         if (!FailureDetector.instance().isAlive(endPoint))
         {
             return false;
@@ -254,13 +261,14 @@
                 }
             }
         };
-        timer.schedule(new TimerTask()
+        TimerTask task = new TimerTask()
         {
             public void run()
             {
                 executor_.execute(r);
             }
-        }, INTERVAL_IN_MS, INTERVAL_IN_MS);
+        };
+        timer.schedule(task, INTERVAL_IN_MS, INTERVAL_IN_MS);
     }
 
     /*

Modified: incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/gms/Gossiper.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/gms/Gossiper.java?rev=893613&r1=893612&r2=893613&view=diff
==============================================================================
--- incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/gms/Gossiper.java
(original)
+++ incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/gms/Gossiper.java
Wed Dec 23 19:43:42 2009
@@ -269,6 +269,11 @@
             logger_.trace("Gossip Digests are : " + sb.toString());
     }
 
+    public boolean isKnownEndpoint(InetAddress endpoint)
+    {
+        return endPointStateMap_.containsKey(endpoint);
+    }
+
     public int getCurrentGenerationNumber(InetAddress endpoint)
     {
     	return endPointStateMap_.get(endpoint).getHeartBeatState().getGeneration();



Mime
View raw message