You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2014/12/19 19:43:01 UTC

[1/2] cassandra git commit: Move MeteredFlusher to its own thread

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 6fe6d65d5 -> d9f5702d8


Move MeteredFlusher to its own thread

patch by Aleksey Yeschenko; reviewed by Sam Tunnicliffe for
CASSANDRA-8485


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

Branch: refs/heads/cassandra-2.1
Commit: 5f54285e9e39833b6bc01317fd74b8bd9b408842
Parents: 2acbab6
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Dec 19 21:40:25 2014 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Dec 19 21:40:25 2014 +0300

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/db/MeteredFlusher.java | 31 +++++++++++++++-----
 .../cassandra/service/CassandraDaemon.java      |  2 +-
 3 files changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f54285e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index bd128f5..57ab5b4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.12:
+ * Move MeteredFlusher to its own thread (CASSANDRA-8485)
  * Fix non-distinct results in DISTNCT queries on static columns when
    paging is enabled (CASSANDRA-8087)
  * Move all hints related tasks to hints internal executor (CASSANDRA-8285)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f54285e/src/java/org/apache/cassandra/db/MeteredFlusher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/MeteredFlusher.java b/src/java/org/apache/cassandra/db/MeteredFlusher.java
index 4f06bc6..30dbb23 100644
--- a/src/java/org/apache/cassandra/db/MeteredFlusher.java
+++ b/src/java/org/apache/cassandra/db/MeteredFlusher.java
@@ -21,16 +21,33 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.cassandra.concurrent.DebuggableScheduledThreadPoolExecutor;
 import org.apache.cassandra.config.DatabaseDescriptor;
 
 public class MeteredFlusher implements Runnable
 {
     private static final Logger logger = LoggerFactory.getLogger(MeteredFlusher.class);
 
+    public static final MeteredFlusher instance = new MeteredFlusher();
+
+    private final ScheduledExecutorService executor;
+
+    private MeteredFlusher()
+    {
+        executor = new DebuggableScheduledThreadPoolExecutor("MeteredFlusher");
+    }
+
+    public void start()
+    {
+        executor.scheduleWithFixedDelay(this, 1, 1, TimeUnit.SECONDS);
+    }
+
     public void run()
     {
         long allowedSize = calculateAllowedSize();
@@ -55,7 +72,7 @@ public class MeteredFlusher implements Runnable
             long size = cfs.getTotalMemtableLiveSize();
             if (allowedSize > flushingSize && size > (allowedSize - flushingSize) / maxInFlight)
             {
-                logger.info("flushing high-traffic column family {} (estimated {} bytes)", cfs, size);
+                logger.info("Flushing high-traffic column family {} (estimated {} bytes)", cfs, size);
                 cfs.forceFlush();
             }
             else
@@ -66,7 +83,7 @@ public class MeteredFlusher implements Runnable
 
         if (liveSize + flushingSize <= allowedSize)
             return;
-        logger.info("estimated {} live and {} flushing bytes used by all memtables", liveSize, flushingSize);
+        logger.info("Estimated {} live and {} flushing bytes used by all memtables", liveSize, flushingSize);
 
         Collections.sort(affectedCFs, new Comparator<ColumnFamilyStore>()
         {
@@ -89,16 +106,16 @@ public class MeteredFlusher implements Runnable
             long size = cfs.getTotalMemtableLiveSize();
             if (size > 0)
             {
-                logger.info("flushing {} to free up {} bytes", cfs, size);
+                logger.info("Flushing {} to free up {} bytes", cfs, size);
                 liveSize -= size;
                 cfs.forceFlush();
             }
         }
 
-        logger.trace("memtable memory usage is {} bytes with {} live", liveSize + flushingSize, liveSize);
+        logger.trace("Memtable memory usage is {} bytes with {} live", liveSize + flushingSize, liveSize);
     }
 
-    private static List<ColumnFamilyStore> affectedColumnFamilies()
+    private List<ColumnFamilyStore> affectedColumnFamilies()
     {
         List<ColumnFamilyStore> affected = new ArrayList<>();
         // filter out column families that aren't affected by MeteredFlusher
@@ -108,7 +125,7 @@ public class MeteredFlusher implements Runnable
         return affected;
     }
 
-    private static long calculateAllowedSize()
+    private long calculateAllowedSize()
     {
         long allowed = DatabaseDescriptor.getTotalMemtableSpaceInMB() * 1048576L;
         // deduct the combined memory limit of the tables unaffected by the metered flusher (we don't flush them, we
@@ -119,7 +136,7 @@ public class MeteredFlusher implements Runnable
         return allowed;
     }
 
-    private static long calculateFlushingSize()
+    private long calculateFlushingSize()
     {
         ColumnFamilyStore measuredCFS = Memtable.activelyMeasuring;
         long flushing = measuredCFS != null && measuredCFS.getCompactionStrategy().isAffectedByMeteredFlusher()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f54285e/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index 89d2bb0..cad1658 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -328,7 +328,7 @@ public class CassandraDaemon
 
         // MeteredFlusher can block if flush queue fills up, so don't put on scheduledTasks
         // Start it before commit log, so memtables can flush during commit log replay
-        StorageService.optionalTasks.scheduleWithFixedDelay(new MeteredFlusher(), 1000, 1000, TimeUnit.MILLISECONDS);
+        MeteredFlusher.instance.start();
 
         // replay the log if necessary
         try


[2/2] cassandra git commit: Merge branch 'cassandra-2.0' into cassandra-2.1

Posted by al...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt
	src/java/org/apache/cassandra/db/MeteredFlusher.java
	src/java/org/apache/cassandra/service/CassandraDaemon.java


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

Branch: refs/heads/cassandra-2.1
Commit: d9f5702d81cb4dd3bd9b51ef6711a4e2e9114df7
Parents: 6fe6d65 5f54285
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Dec 19 21:42:52 2014 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Dec 19 21:42:52 2014 +0300

----------------------------------------------------------------------
 CHANGES.txt | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9f5702d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 84becc0,57ab5b4..f7b47e8
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,46 -1,5 +1,47 @@@
 -2.0.12:
 +2.1.3
 + * Fix regression in SSTableRewriter causing some rows to become unreadable 
 +   during compaction (CASSANDRA-8429)
 + * Run major compactions for repaired/unrepaired in parallel (CASSANDRA-8510)
 + * (cqlsh) Fix compression options in DESCRIBE TABLE output when compression
 +   is disabled (CASSANDRA-8288)
 + * (cqlsh) Fix DESCRIBE output after keyspaces are altered (CASSANDRA-7623)
 + * Make sure we set lastCompactedKey correctly (CASSANDRA-8463)
 + * (cqlsh) Fix output of CONSISTENCY command (CASSANDRA-8507)
 + * (cqlsh) Fixed the handling of LIST statements (CASSANDRA-8370)
 + * Make sstablescrub check leveled manifest again (CASSANDRA-8432)
 + * Check first/last keys in sstable when giving out positions (CASSANDRA-8458)
 + * Disable mmap on Windows (CASSANDRA-6993)
 + * Add missing ConsistencyLevels to cassandra-stress (CASSANDRA-8253)
 + * Add auth support to cassandra-stress (CASSANDRA-7985)
 + * Fix ArrayIndexOutOfBoundsException when generating error message
 +   for some CQL syntax errors (CASSANDRA-8455)
 + * Scale memtable slab allocation logarithmically (CASSANDRA-7882)
 + * cassandra-stress simultaneous inserts over same seed (CASSANDRA-7964)
 + * Reduce cassandra-stress sampling memory requirements (CASSANDRA-7926)
 + * Ensure memtable flush cannot expire commit log entries from its future (CASSANDRA-8383)
 + * Make read "defrag" async to reclaim memtables (CASSANDRA-8459)
 + * Remove tmplink files for offline compactions (CASSANDRA-8321)
 + * Reduce maxHintsInProgress (CASSANDRA-8415)
 + * BTree updates may call provided update function twice (CASSANDRA-8018)
 + * Release sstable references after anticompaction (CASSANDRA-8386)
 + * Handle abort() in SSTableRewriter properly (CASSANDRA-8320)
 + * Fix high size calculations for prepared statements (CASSANDRA-8231)
 + * Centralize shared executors (CASSANDRA-8055)
 + * Fix filtering for CONTAINS (KEY) relations on frozen collection
 +   clustering columns when the query is restricted to a single
 +   partition (CASSANDRA-8203)
 + * Do more aggressive entire-sstable TTL expiry checks (CASSANDRA-8243)
 + * Add more log info if readMeter is null (CASSANDRA-8238)
 + * add check of the system wall clock time at startup (CASSANDRA-8305)
 + * Support for frozen collections (CASSANDRA-7859)
 + * Fix overflow on histogram computation (CASSANDRA-8028)
 + * Have paxos reuse the timestamp generation of normal queries (CASSANDRA-7801)
 + * Fix incremental repair not remove parent session on remote (CASSANDRA-8291)
 + * Improve JBOD disk utilization (CASSANDRA-7386)
 + * Log failed host when preparing incremental repair (CASSANDRA-8228)
 + * Force config client mode in CQLSSTableWriter (CASSANDRA-8281)
 +Merged from 2.0:
+  * Move MeteredFlusher to its own thread (CASSANDRA-8485)
   * Fix non-distinct results in DISTNCT queries on static columns when
     paging is enabled (CASSANDRA-8087)
   * Move all hints related tasks to hints internal executor (CASSANDRA-8285)