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 2012/01/04 04:15:30 UTC

[10/11] git commit: don't clear queuedDeliveries entry until actually done

don't clear queuedDeliveries entry until actually done


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

Branch: refs/heads/3624
Commit: aca3d26c667676c2ac2cc871f3436b11356bf181
Parents: 8e528c8
Author: Jonathan Ellis <jb...@apache.org>
Authored: Wed Dec 28 21:05:15 2011 -0600
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Wed Dec 28 21:05:15 2011 -0600

----------------------------------------------------------------------
 .../apache/cassandra/db/HintedHandOffManager.java  |   41 +++++++--------
 1 files changed, 19 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/aca3d26c/src/java/org/apache/cassandra/db/HintedHandOffManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/HintedHandOffManager.java b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
index 0ac93d8..e4a3afd 100644
--- a/src/java/org/apache/cassandra/db/HintedHandOffManager.java
+++ b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
@@ -229,31 +229,28 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
     private void deliverHintsToEndpoint(InetAddress endpoint) throws IOException, DigestMismatchException, InvalidRequestException, TimeoutException, InterruptedException
     {
         ColumnFamilyStore hintStore = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HINTS_CF);
-        try
+        if (hintStore.isEmpty())
         {
-            if (hintStore.isEmpty())
-                return; // nothing to do, don't confuse users by logging a no-op handoff
-
-            logger_.debug("Checking remote({}) schema before delivering hints", endpoint);
-            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) {
-                // use a 'rounded' sleep interval because of a strange bug with windows: CASSANDRA-3375
-                int sleep = FBUtilities.threadLocalRandom().nextInt(2000) * 30;
-                logger_.debug("Sleeping {}ms to stagger hint delivery", sleep);
-                Thread.sleep(sleep);
-            }
+            queuedDeliveries.remove(endpoint);
+            return; // nothing to do, don't confuse users by logging a no-op handoff
+        }
 
-            if (!FailureDetector.instance.isAlive(endpoint))
-            {
-                logger_.info("Endpoint {} died before hint delivery, aborting", endpoint);
-                return;
-            }
+        logger_.debug("Checking remote({}) schema before delivering hints", endpoint);
+        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) {
+            // use a 'rounded' sleep interval because of a strange bug with windows: CASSANDRA-3375
+            int sleep = FBUtilities.threadLocalRandom().nextInt(2000) * 30;
+            logger_.debug("Sleeping {}ms to stagger hint delivery", sleep);
+            Thread.sleep(sleep);
         }
-        finally
+
+        if (!FailureDetector.instance.isAlive(endpoint))
         {
+            logger_.info("Endpoint {} died before hint delivery, aborting", endpoint);
             queuedDeliveries.remove(endpoint);
+            return;
         }
 
         // 1. Get the key of the endpoint we need to handoff
@@ -341,8 +338,8 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
             }
         }
 
-        logger_.info(String.format("Finished hinted handoff of %s rows to endpoint %s",
-                                   rowsReplayed, endpoint));
+        logger_.info(String.format("Finished hinted handoff of %s rows to endpoint %s", rowsReplayed, endpoint));
+        queuedDeliveries.remove(endpoint);
     }
 
     /**