cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1065659 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/db/HintedHandOffManager.java
Date Mon, 31 Jan 2011 15:58:13 GMT
Author: jbellis
Date: Mon Jan 31 15:58:13 2011
New Revision: 1065659

URL: http://svn.apache.org/viewvc?rev=1065659&view=rev
Log:
avoid blocking gossip while deletinghandoffhints
patch by jbellis; reviewed by gdusbabek for CASSANDRA-2073

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

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1065659&r1=1065658&r2=1065659&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Mon Jan 31 15:58:13 2011
@@ -48,6 +48,7 @@
    (CASSANDRA-2058)
  * fix math in RandomPartitioner.describeOwnership (CASSANDRA-2071)
  * fix deletion of sstable non-data components (CASSANDRA-2059)
+ * avoid blocking gossip while deleting handoff hints (CASSANDRA-2073)
 
 
 0.7.0-final

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=1065659&r1=1065658&r2=1065659&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
Mon Jan 31 15:58:13 2011
@@ -144,21 +144,31 @@ public class HintedHandOffManager
         rm.apply();
     }                                                         
 
-    public static void deleteHintsForEndPoint(InetAddress endpoint)
+    public static void deleteHintsForEndPoint(final InetAddress endpoint)
     {
-        ColumnFamilyStore hintStore = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HINTS_CF);
-        RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, ByteBuffer.wrap(endpoint.getAddress()));
+        final ColumnFamilyStore hintStore = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HINTS_CF);
+        final RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, ByteBuffer.wrap(endpoint.getAddress()));
         rm.delete(new QueryPath(HINTS_CF), System.currentTimeMillis());
-        try {
-            logger_.info("Deleting any stored hints for " + endpoint);
-            rm.apply();
-            hintStore.forceFlush();
-            CompactionManager.instance.submitMajor(hintStore, 0, Integer.MAX_VALUE).get();
-        }
-        catch (Exception e)
+
+        // execute asynchronously to avoid blocking caller (which may be processing gossip)
+        Runnable runnable = new Runnable()
         {
-            logger_.warn("Could not delete hints for " + endpoint + ": " + e);
-        }
+            public void run()
+            {
+                try
+                {
+                    logger_.info("Deleting any stored hints for " + endpoint);
+                    rm.apply();
+                    hintStore.forceFlush();
+                    CompactionManager.instance.submitMajor(hintStore, 0, Integer.MAX_VALUE);
+                }
+                catch (Exception e)
+                {
+                    logger_.warn("Could not delete hints for " + endpoint + ": " + e);
+                }
+            }
+        };
+        StorageService.scheduledTasks.execute(runnable);
     }
 
     private static boolean pagingFinished(ColumnFamily hintColumnFamily, ByteBuffer startColumn)



Mime
View raw message