Increase compaction visibility

Patch by cnlwsu; reviewed by marcuse for CASSANDRA-7242.
This commit is contained in:
Marcus Eriksson 2014-05-19 14:29:15 +02:00
parent 86632a1339
commit e3a88b9f80
3 changed files with 13 additions and 3 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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()