cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1068433 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/HintedHandOffManager.java
Date Tue, 08 Feb 2011 15:03:27 GMT
Author: jbellis
Date: Tue Feb  8 15:03:26 2011
New Revision: 1068433

URL: http://svn.apache.org/viewvc?rev=1068433&view=rev
Log:
add finally block for removing HH attempt from queuedDeliveries, in case we don't reach schema
agreement and give up
patch by jbellis

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/HintedHandOffManager.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/HintedHandOffManager.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/HintedHandOffManager.java?rev=1068433&r1=1068432&r2=1068433&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/HintedHandOffManager.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/HintedHandOffManager.java
Tue Feb  8 15:03:26 2011
@@ -261,23 +261,29 @@ public class HintedHandOffManager implem
             
     private void deliverHintsToEndpoint(InetAddress endpoint) throws IOException, DigestMismatchException,
InvalidRequestException, TimeoutException, InterruptedException
     {
-        logger_.info("Checking remote schema before delivering hints");
-        int waited = waitForSchemaAgreement(endpoint);
-        // sleep a random amount to stagger handoff delivery from different replicas.
-        // (if we had to wait, then gossiper randomness took care of that for us already.)
-        if (waited == 0) {
-            int sleep = new Random().nextInt(60000);
-            logger_.info("Sleeping {}ms to stagger hint delivery", sleep);
-            Thread.sleep(sleep);
+        try
+        {
+            logger_.info("Checking remote schema before delivering hints");
+            int waited = waitForSchemaAgreement(endpoint);
+            // sleep a random amount to stagger handoff delivery from different replicas.
+            // (if we had to wait, then gossiper randomness took care of that for us already.)
+            if (waited == 0) {
+                int sleep = new Random().nextInt(60000);
+                logger_.info("Sleeping {}ms to stagger hint delivery", sleep);
+                Thread.sleep(sleep);
+            }
+            if (!Gossiper.instance.getEndpointStateForEndpoint(endpoint).isAlive())
+            {
+                logger_.info("Endpoint {} died before hint delivery, aborting", endpoint);
+                return;
+            }
         }
-        if (!Gossiper.instance.getEndpointStateForEndpoint(endpoint).isAlive())
+        finally
         {
-            logger_.info("Endpoint {} died before hint delivery, aborting", endpoint);
-            return;
+            queuedDeliveries.remove(endpoint);
         }
-        logger_.info("Started hinted handoff for endpoint " + endpoint);
 
-        queuedDeliveries.remove(endpoint);
+        logger_.info("Started hinted handoff for endpoint " + endpoint);
 
         // 1. Get the key of the endpoint we need to handoff
         // 2. For each column read the list of rows: subcolumns are KS + SEPARATOR + CF



Mime
View raw message