cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1170608 - in /cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra: cache/AutoSavingCache.java db/ColumnFamilyStore.java db/HintedHandOffManager.java db/compaction/AbstractCompactionStrategy.java service/StorageService.java
Date Wed, 14 Sep 2011 13:31:48 GMT
Author: jbellis
Date: Wed Sep 14 13:31:47 2011
New Revision: 1170608

URL: http://svn.apache.org/viewvc?rev=1170608&view=rev
Log:
keep shutdown from waiting for the compaction kickoff
patch by jbellis; reviewed by slebresne for CASSANDRA-3181

Modified:
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/AutoSavingCache.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/HintedHandOffManager.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/service/StorageService.java

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/AutoSavingCache.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/AutoSavingCache.java?rev=1170608&r1=1170607&r2=1170608&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/AutoSavingCache.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/AutoSavingCache.java
Wed Sep 14 13:31:47 2011
@@ -22,23 +22,24 @@ import java.io.*;
 import java.nio.ByteBuffer;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.apache.cassandra.config.Schema;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.DecoratedKey;
 import org.apache.cassandra.db.compaction.CompactionInfo;
 import org.apache.cassandra.db.compaction.CompactionManager;
-import org.apache.cassandra.db.DecoratedKey;
 import org.apache.cassandra.db.compaction.OperationType;
-import org.apache.cassandra.io.util.*;
+import org.apache.cassandra.io.util.FileUtils;
+import org.apache.cassandra.io.util.SequentialWriter;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
@@ -99,10 +100,10 @@ public abstract class AutoSavingCache<K,
                     submitWrite(keysToSave);
                 }
             };
-            saveTask = StorageService.tasks.scheduleWithFixedDelay(runnable,
-                                                                   savePeriodInSeconds,
-                                                                   savePeriodInSeconds,
-                                                                   TimeUnit.SECONDS);
+            saveTask = StorageService.optionalTasks.scheduleWithFixedDelay(runnable,
+                                                                           savePeriodInSeconds,
+                                                                           savePeriodInSeconds,
+                                                                           TimeUnit.SECONDS);
         }
     }
 

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1170608&r1=1170607&r2=1170608&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Wed Sep 14 13:31:47 2011
@@ -90,7 +90,7 @@ public class ColumnFamilyStore implement
     static
     {
         // (can block if flush queue fills up, so don't put on scheduledTasks)
-        StorageService.tasks.scheduleWithFixedDelay(new MeteredFlusher(), 1000, 1000, TimeUnit.MILLISECONDS);
+        StorageService.optionalTasks.scheduleWithFixedDelay(new MeteredFlusher(), 1000, 1000,
TimeUnit.MILLISECONDS);
     }
 
     public final Table table;

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/HintedHandOffManager.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/HintedHandOffManager.java?rev=1170608&r1=1170607&r2=1170608&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/HintedHandOffManager.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/HintedHandOffManager.java
Wed Sep 14 13:31:47 2011
@@ -185,7 +185,7 @@ public class HintedHandOffManager implem
                 }
             }
         };
-        StorageService.tasks.execute(runnable);
+        StorageService.optionalTasks.execute(runnable);
     }
 
     private static boolean pagingFinished(ColumnFamily hintColumnFamily, ByteBuffer startColumn)

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java?rev=1170608&r1=1170607&r2=1170608&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
Wed Sep 14 13:31:47 2011
@@ -58,7 +58,7 @@ public abstract class AbstractCompaction
                 }
             }
         };
-        StorageService.tasks.schedule(runnable, 5 * 60, TimeUnit.SECONDS);
+        StorageService.optionalTasks.schedule(runnable, 5 * 60, TimeUnit.SECONDS);
     }
 
     /**

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/service/StorageService.java?rev=1170608&r1=1170607&r2=1170608&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/service/StorageService.java
Wed Sep 14 13:31:47 2011
@@ -158,6 +158,14 @@ public class StorageService implements I
      */
     public static final DebuggableScheduledThreadPoolExecutor tasks = new DebuggableScheduledThreadPoolExecutor("NonPeriodicTasks");
 
+    /**
+     * tasks that do not need to be waited for on shutdown/drain
+     */
+    public static final DebuggableScheduledThreadPoolExecutor optionalTasks = new DebuggableScheduledThreadPoolExecutor("OptionalTasks");
+    static
+    {
+        tasks.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+    }
 
     /* This abstraction maintains the token/endpoint metadata information */
     private TokenMetadata tokenMetadata_ = new TokenMetadata();
@@ -410,6 +418,7 @@ public class StorageService implements I
                 if (mutationStage.isShutdown())
                     return; // drained already
 
+                optionalTasks.shutdown();
                 Gossiper.instance.stop();
                 MessagingService.instance().shutdown();
 
@@ -2339,6 +2348,7 @@ public class StorageService implements I
             return;
         }
         setMode("Starting drain process", true);
+        optionalTasks.shutdown();
         Gossiper.instance.stop();
         setMode("Draining: shutting down MessageService", false);
         MessagingService.instance().shutdown();



Mime
View raw message