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 2013/05/13 20:45:11 UTC

[1/2] git commit: Ensure that submitBackground enqueues at least one task patch by Oleg Anastasyev; reviewed by jbellis for CASSANDRA-5554

Updated Branches:
  refs/heads/cassandra-1.2 56927973f -> 3b41d21d9
  refs/heads/trunk 31d991a25 -> 740e344c7


Ensure that submitBackground enqueues at least one task
patch by Oleg Anastasyev; reviewed by jbellis for CASSANDRA-5554


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

Branch: refs/heads/trunk
Commit: 740e344c7fc1ee0283744fefd659db999b48c71f
Parents: 31d991a
Author: Jonathan Ellis <jb...@apache.org>
Authored: Mon May 13 11:51:56 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Mon May 13 13:44:40 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 ++
 .../cassandra/db/compaction/CompactionManager.java |   15 ++++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/740e344c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index fb95e14..f67f0c2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -45,7 +45,9 @@
  * Add alias support to SELECT statement (CASSANDRA-5075)
  * Don't create empty RowMutations in CommitLogReplayer (CASSANDRA-5541)
 
+
 1.2.5
+ * Ensure that submitBackground enqueues at least one task (CASSANDRA-5554)
  * fix 2i updates with identical values and timestamps (CASSANDRA-5540)
  * fix compaction throttling bursty-ness (CASSANDRA-4316)
  * reduce memory consumption of IndexSummary (CASSANDRA-5506)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/740e344c/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 758068c..e0d186f 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -122,8 +122,8 @@ public class CompactionManager implements CompactionManagerMBean
 
     /**
      * Call this whenever a compaction might be needed on the given columnfamily.
-     * It's okay to over-call (within reason) since the compactions are single-threaded,
-     * and if a call is unnecessary, it will just be no-oped in the bucketing phase.
+     * It's okay to over-call (within reason) if a call is unnecessary, it will
+     * turn into a no-op in the bucketing/candidate-scan phase.
      */
     public List<Future<?>> submitBackground(final ColumnFamilyStore cfs)
     {
@@ -146,12 +146,14 @@ public class CompactionManager implements CompactionManagerMBean
                      cfs.name,
                      cfs.getCompactionStrategy().getClass().getSimpleName());
         List<Future<?>> futures = new ArrayList<Future<?>>();
-        // if we have room for more compactions, then fill up executor
-        while (executor.getActiveCount() + futures.size() < executor.getMaximumPoolSize())
-        {
+
+        // we must schedule it at least once, otherwise compaction will stop for a CF until next flush
+        do {
             futures.add(executor.submit(new BackgroundCompactionTask(cfs)));
             compactingCF.add(cfs);
-        }
+            // if we have room for more compactions, then fill up executor
+        } while (executor.getActiveCount() + futures.size() < executor.getMaximumPoolSize());
+
         return futures;
     }
 
@@ -490,7 +492,6 @@ public class CompactionManager implements CompactionManagerMBean
                 throw new IOException("disk full");
 
             SSTableScanner scanner = sstable.getScanner(getRateLimiter());
-            long rowsRead = 0;
             List<Column> indexedColumnsInRow = null;
 
             CleanupInfo ci = new CleanupInfo(sstable, scanner);


[2/2] git commit: Ensure that submitBackground enqueues at least one task patch by Oleg Anastasyev; reviewed by jbellis for CASSANDRA-5554

Posted by jb...@apache.org.
Ensure that submitBackground enqueues at least one task
patch by Oleg Anastasyev; reviewed by jbellis for CASSANDRA-5554


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

Branch: refs/heads/cassandra-1.2
Commit: 3b41d21d9b997530e48511e1d09ea904e8937bf0
Parents: 5692797
Author: Jonathan Ellis <jb...@apache.org>
Authored: Mon May 13 11:51:56 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Mon May 13 13:45:10 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../cassandra/db/compaction/CompactionManager.java |   23 ++++++++-------
 2 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b41d21d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 844fe3d..740d8e3 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2.5
+ * Ensure that submitBackground enqueues at least one task (CASSANDRA-5554)
  * fix 2i updates with identical values and timestamps (CASSANDRA-5540)
  * fix compaction throttling bursty-ness (CASSANDRA-4316)
  * reduce memory consumption of IndexSummary (CASSANDRA-5506)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b41d21d/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 96c3011..7ebbc7c 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -149,8 +149,8 @@ public class CompactionManager implements CompactionManagerMBean
 
     /**
      * Call this whenever a compaction might be needed on the given columnfamily.
-     * It's okay to over-call (within reason) since the compactions are single-threaded,
-     * and if a call is unnecessary, it will just be no-oped in the bucketing phase.
+     * It's okay to over-call (within reason) if a call is unnecessary, it will
+     * turn into a no-op in the bucketing/candidate-scan phase.
      */
     public List<Future<?>> submitBackground(final ColumnFamilyStore cfs)
     {
@@ -158,21 +158,23 @@ public class CompactionManager implements CompactionManagerMBean
         if (count > 0 && executor.getActiveCount() >= executor.getMaximumPoolSize())
         {
             logger.debug("Background compaction is still running for {}.{} ({} remaining). Skipping",
-                         new Object[] {cfs.table.name, cfs.columnFamily, count});
+                         cfs.table.name, cfs.columnFamily, count);
             return Collections.emptyList();
         }
 
         logger.debug("Scheduling a background task check for {}.{} with {}",
-                     new Object[] {cfs.table.name,
-                                   cfs.columnFamily,
-                                   cfs.getCompactionStrategy().getClass().getSimpleName()});
+                     cfs.table.name,
+                     cfs.columnFamily,
+                     cfs.getCompactionStrategy().getClass().getSimpleName());
         List<Future<?>> futures = new ArrayList<Future<?>>();
-        // if we have room for more compactions, then fill up executor
-        while (executor.getActiveCount() + futures.size() < executor.getMaximumPoolSize())
-        {
+
+        // we must schedule it at least once, otherwise compaction will stop for a CF until next flush
+        do {
             futures.add(executor.submit(new BackgroundCompactionTask(cfs)));
             compactingCF.add(cfs);
-        }
+            // if we have room for more compactions, then fill up executor
+        } while (executor.getActiveCount() + futures.size() < executor.getMaximumPoolSize());
+
         return futures;
     }
 
@@ -590,7 +592,6 @@ public class CompactionManager implements CompactionManagerMBean
                 throw new IOException("disk full");
 
             SSTableScanner scanner = sstable.getDirectScanner(getRateLimiter());
-            long rowsRead = 0;
             List<IColumn> indexedColumnsInRow = null;
 
             CleanupInfo ci = new CleanupInfo(sstable, scanner);