cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/3] git commit: Cancel read meter task when closing SSTR patch by Tyler Hobbs; reviewed by jbellis for CASSANDRA-6358
Date Sat, 16 Nov 2013 16:34:32 GMT
Updated Branches:
  refs/heads/cassandra-2.0 67accea1a -> 08167d6ac
  refs/heads/trunk 48cfe0b10 -> 414ba406d


Cancel read meter task when closing SSTR
patch by Tyler Hobbs; reviewed by jbellis for CASSANDRA-6358


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

Branch: refs/heads/cassandra-2.0
Commit: 08167d6ac784274a48ff8428f3ef4f6e92cd8ab0
Parents: 67accea
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Sat Nov 16 10:34:22 2013 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Sat Nov 16 10:34:22 2013 -0600

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 .../apache/cassandra/io/sstable/SSTableReader.java   | 15 ++++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/08167d6a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a283387..cd6895f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.3
+ * Cancel read meter task when closing SSTR (CASSANDRA-6358)
  * free off-heap IndexSummary during bulk (CASSANDRA-6359)
  * Recover from IOException in accept() thread (CASSANDRA-6349)
  * Improve Gossip tolerance of abnormally slow tasks (CASSANDRA-6338)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/08167d6a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
index 41cd0ba..10ac36c 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
@@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
 import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -106,6 +107,7 @@ public class SSTableReader extends SSTable implements Closeable
 
     @VisibleForTesting
     public RestorableMeter readMeter;
+    private ScheduledFuture readMeterSyncFuture;
 
     public static long getApproximateKeyCount(Iterable<SSTableReader> sstables, CFMetaData
metadata)
     {
@@ -331,17 +333,21 @@ public class SSTableReader extends SSTable implements Closeable
         if (Keyspace.SYSTEM_KS.equals(desc.ksname) || Config.isClientMode())
         {
             readMeter = null;
+            readMeterSyncFuture = null;
             return;
         }
 
         readMeter = SystemKeyspace.getSSTableReadMeter(desc.ksname, desc.cfname, desc.generation);
         // sync the average read rate to system.sstable_activity every five minutes, starting
one minute from now
-        syncExecutor.scheduleAtFixedRate(new Runnable()
+        readMeterSyncFuture = syncExecutor.scheduleAtFixedRate(new Runnable()
         {
             public void run()
             {
-                meterSyncThrottle.acquire();
-                SystemKeyspace.persistSSTableReadMeter(desc.ksname, desc.cfname, desc.generation,
readMeter);
+                if (!isCompacted.get())
+                {
+                    meterSyncThrottle.acquire();
+                    SystemKeyspace.persistSSTableReadMeter(desc.ksname, desc.cfname, desc.generation,
readMeter);
+                }
             }
         }, 1, 5, TimeUnit.MINUTES);
     }
@@ -372,6 +378,9 @@ public class SSTableReader extends SSTable implements Closeable
      */
     public void close() throws IOException
     {
+        if (readMeterSyncFuture != null)
+            readMeterSyncFuture.cancel(false);
+
         // Force finalizing mmapping if necessary
         ifile.cleanup();
         dfile.cleanup();


Mime
View raw message