cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject git commit: Increase compaction visibility
Date Mon, 19 May 2014 12:35:34 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 86632a133 -> e3a88b9f8


Increase compaction visibility

Patch by cnlwsu; reviewed by marcuse for CASSANDRA-7242.


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

Branch: refs/heads/cassandra-2.0
Commit: e3a88b9f80ea9ba59cf3da8f7b5cc81ccb32e24a
Parents: 86632a1
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Mon May 19 14:29:15 2014 +0200
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Mon May 19 14:30:35 2014 +0200

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 .../apache/cassandra/db/compaction/CompactionManager.java   | 6 +++---
 .../org/apache/cassandra/metrics/ColumnFamilyMetrics.java   | 9 +++++++++
 3 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e3a88b9f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5c9b436..ed818db 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -31,6 +31,7 @@
  * Fix duplicated error messages on directory creation error at startup (CASSANDRA-5818)
  * reduce garbage on codec flag deserialization (CASSANDRA-7244) 
  * Proper null handle for IF with map element access (CASSANDRA-7155)
+ * Improve compaction visibility (CASSANDRA-7242)
 Merged from 1.2:
  * Add Cloudstack snitch (CASSANDRA-7147)
  * Update system.peers correctly when relocating tokens (CASSANDRA-7126)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e3a88b9f/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 31b7d8e..2708e4c 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.cache.AutoSavingCache;
 import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor;
+import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor;
 import org.apache.cassandra.concurrent.NamedThreadFactory;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.DatabaseDescriptor;
@@ -927,12 +928,11 @@ public class CompactionManager implements CompactionManagerMBean
         return CompactionMetrics.getCompactions().size();
     }
 
-    private static class CompactionExecutor extends ThreadPoolExecutor
+    private static class CompactionExecutor extends JMXEnabledThreadPoolExecutor
     {
         protected CompactionExecutor(int minThreads, int maxThreads, String name, BlockingQueue<Runnable>
queue)
         {
-            super(minThreads, maxThreads, 60, TimeUnit.SECONDS, queue, new NamedThreadFactory(name,
Thread.MIN_PRIORITY));
-            allowCoreThreadTimeOut(true);
+            super(minThreads, maxThreads, 60, TimeUnit.SECONDS, queue, new NamedThreadFactory(name,
Thread.MIN_PRIORITY), "internal");
         }
 
         private CompactionExecutor(int threadCount, String name)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e3a88b9f/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java b/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
index bcff2d0..8880485 100644
--- a/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
@@ -56,6 +56,8 @@ public class ColumnFamilyMetrics
     public final LatencyMetrics writeLatency;
     /** Estimated number of tasks pending for this column family */
     public final Gauge<Integer> pendingTasks;
+    /** Estimate of number of pending compactios for this CF */
+    public final Gauge<Integer> pendingCompactions;
     /** Number of SSTables on disk for this CF */
     public final Gauge<Integer> liveSSTableCount;
     /** Disk space used by SSTables belonging to this CF */
@@ -175,6 +177,13 @@ public class ColumnFamilyMetrics
         });
         readLatency = new LatencyMetrics(factory, "Read");
         writeLatency = new LatencyMetrics(factory, "Write");
+        pendingCompactions = Metrics.newGauge(factory.createMetricName("PendingCompactions"),
new Gauge<Integer>()
+        {
+            public Integer value()
+            {
+                return cfs.getCompactionStrategy().getEstimatedRemainingTasks();
+            }
+        });
         pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Integer>()
         {
             public Integer value()


Mime
View raw message