fix wrong patch commit
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/593bba94 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/593bba94 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/593bba94 Branch: refs/heads/cassandra-2.1 Commit: 593bba94f68ce6fe5220264d5323693ce80ef6fb Parents: 7065b1b Author: Brandon Williams <brandonwilli...@apache.org> Authored: Fri Jun 13 13:35:08 2014 -0500 Committer: Brandon Williams <brandonwilli...@apache.org> Committed: Fri Jun 13 13:35:08 2014 -0500 ---------------------------------------------------------------------- .../cassandra/metrics/KeyspaceMetrics.java | 42 +++----------------- 1 file changed, 6 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/593bba94/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java b/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java index 4a0980f..936187c 100644 --- a/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java +++ b/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java @@ -17,15 +17,12 @@ */ package org.apache.cassandra.metrics; -import java.util.ArrayList; -import java.util.List; import com.yammer.metrics.Metrics; import com.yammer.metrics.core.*; -import com.yammer.metrics.stats.Snapshot; import org.apache.cassandra.db.ColumnFamilyStore; -import org.apache.cassandra.db.Keyspace; +import org.apache.cassandra.db.Table; /** * Metrics for {@link ColumnFamilyStore}. @@ -34,16 +31,12 @@ public class KeyspaceMetrics { /** Total amount of data stored in the memtable, including column related overhead. */ public final Gauge<Long> memtableDataSize; - /** Total amount of data stored in the memtables (2i and pending flush memtables included). */ - public final Gauge<Long> allMemtablesDataSize; /** Total number of columns present in the memtable. */ public final Gauge<Long> memtableColumnsCount; /** Number of times flush has resulted in the memtable being switched out. */ public final Gauge<Long> memtableSwitchCount; /** 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; /** Disk space used by SSTables belonging to this CF */ public final Gauge<Long> liveDiskSpaceUsed; /** Total disk space used by SSTables belonging to this CF, including obsolete ones waiting to be GC'd */ @@ -58,7 +51,7 @@ public class KeyspaceMetrics * * @param ks Keyspace to measure metrics */ - public KeyspaceMetrics(final Keyspace ks) + public KeyspaceMetrics(final Table ks) { factory = new KeyspaceMetricNameFactory(ks); @@ -86,18 +79,6 @@ public class KeyspaceMetrics return total; } }); - allMemtablesDataSize = Metrics.newGauge(factory.createMetricName("AllMemtablesDataSize"), new Gauge<Long>() - { - public Long value() - { - long total = 0; - for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) - { - total += cf.metric.allMemtablesDataSize.value(); - } - return total; - } - }); memtableSwitchCount = Metrics.newGauge(factory.createMetricName("MemtableSwitchCount"), new Gauge<Long>() { public Long value() @@ -108,23 +89,11 @@ public class KeyspaceMetrics return sum; } }); - pendingCompactions = Metrics.newGauge(factory.createMetricName("PendingCompactions"), new Gauge<Integer>() - { - public Integer value() - { - int sum = 0; - for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) - { - sum += cf.metric.pendingCompactions.value(); - } - return sum; - } - }); pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Integer>() { public Integer value() { - return Keyspace.switchLock.getQueueLength(); + return Table.switchLock.getQueueLength(); } }); liveDiskSpaceUsed = Metrics.newGauge(factory.createMetricName("LiveDiskSpaceUsed"), new Gauge<Long>() @@ -169,6 +138,7 @@ public class KeyspaceMetrics public void release() { Metrics.defaultRegistry().removeMetric(factory.createMetricName("AllMemtablesDataSize")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableColumnsCount")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableDataSize")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableSwitchCount")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingTasks")); @@ -181,9 +151,9 @@ public class KeyspaceMetrics { private final String keyspaceName; - KeyspaceMetricNameFactory(Keyspace ks) + KeyspaceMetricNameFactory(Table ks) { - this.keyspaceName = ks.getName(); + this.keyspaceName = ks.name; } public MetricName createMetricName(String metricName)