fix merge
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9baae7b8 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9baae7b8 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9baae7b8 Branch: refs/heads/cassandra-2.1 Commit: 9baae7b80767b077403a75cd1c1e2589ae38b0ba Parents: 12025b7 Author: Brandon Williams <brandonwilli...@apache.org> Authored: Fri Jun 13 11:35:07 2014 -0500 Committer: Brandon Williams <brandonwilli...@apache.org> Committed: Fri Jun 13 11:35:07 2014 -0500 ---------------------------------------------------------------------- src/java/org/apache/cassandra/db/Keyspace.java | 2 - .../cassandra/metrics/KeyspaceMetrics.java | 94 +++++++++++++++++--- 2 files changed, 80 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/9baae7b8/src/java/org/apache/cassandra/db/Keyspace.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/Keyspace.java b/src/java/org/apache/cassandra/db/Keyspace.java index 8762643..54054c5 100644 --- a/src/java/org/apache/cassandra/db/Keyspace.java +++ b/src/java/org/apache/cassandra/db/Keyspace.java @@ -64,8 +64,6 @@ public class Keyspace public final KeyspaceMetrics metric; - public final KeyspaceMetrics metric; - // It is possible to call Keyspace.open without a running daemon, so it makes sense to ensure // proper directories here as well as in CassandraDaemon. static http://git-wip-us.apache.org/repos/asf/cassandra/blob/9baae7b8/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..7ef8a75 100644 --- a/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java +++ b/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java @@ -32,16 +32,24 @@ import org.apache.cassandra.db.Keyspace; */ 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 amount of live data stored in the memtable, excluding any data structure overhead */ + public final Gauge<Long> memtableLiveDataSize; + /** Total amount of data stored in the memtable that resides on-heap, including column related overhead and overwritten rows. */ + public final Gauge<Long> memtableOnHeapDataSize; + /** Total amount of data stored in the memtable that resides off-heap, including column related overhead and overwritten rows. */ + public final Gauge<Long> memtableOffHeapDataSize; + /** Total amount of live data stored in the memtables (2i and pending flush memtables included) that resides off-heap, excluding any data structure overhead */ + public final Gauge<Long> allMemtablesLiveDataSize; + /** Total amount of data stored in the memtables (2i and pending flush memtables included) that resides on-heap. */ + public final Gauge<Long> allMemtablesOnHeapDataSize; + /** Total amount of data stored in the memtables (2i and pending flush memtables included) that resides off-heap. */ + public final Gauge<Long> allMemtablesOffHeapDataSize; /** 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; + public final Gauge<Integer> pendingFlushes; /** Estimate of number of pending compactios for this CF */ public final Gauge<Integer> pendingCompactions; /** Disk space used by SSTables belonging to this CF */ @@ -74,26 +82,74 @@ public class KeyspaceMetrics return total; } }); - memtableDataSize = Metrics.newGauge(factory.createMetricName("MemtableDataSize"), new Gauge<Long>() + memtableLiveDataSize = Metrics.newGauge(factory.createMetricName("MemtableLiveDataSize"), new Gauge<Long>() { public Long value() { long total = 0; for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) { - total += cf.metric.memtableDataSize.value(); + total += cf.metric.memtableLiveDataSize.value(); } return total; } }); - allMemtablesDataSize = Metrics.newGauge(factory.createMetricName("AllMemtablesDataSize"), new Gauge<Long>() + memtableOnHeapDataSize = Metrics.newGauge(factory.createMetricName("MemtableOnHeapDataSize"), new Gauge<Long>() { public Long value() { long total = 0; for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) { - total += cf.metric.allMemtablesDataSize.value(); + total += cf.metric.memtableOnHeapSize.value(); + } + return total; + } + }); + memtableOffHeapDataSize = Metrics.newGauge(factory.createMetricName("MemtableiOffHeapDataSize"), new Gauge<Long>() + { + public Long value() + { + long total = 0; + for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) + { + total += cf.metric.memtableOffHeapSize.value(); + } + return total; + } + }); + allMemtablesLiveDataSize = Metrics.newGauge(factory.createMetricName("AllMemtablesLiveDataSize"), new Gauge<Long>() + { + public Long value() + { + long total = 0; + for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) + { + total += cf.metric.allMemtablesLiveDataSize.value(); + } + return total; + } + }); + allMemtablesOnHeapDataSize = Metrics.newGauge(factory.createMetricName("AllMemtablesOnHeapDataSize"), new Gauge<Long>() + { + public Long value() + { + long total = 0; + for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) + { + total += cf.metric.allMemtablesOnHeapSize.value(); + } + return total; + } + }); + allMemtablesOffHeapDataSize = Metrics.newGauge(factory.createMetricName("AllMemtablesOffHeapDataSize"), new Gauge<Long>() + { + public Long value() + { + long total = 0; + for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) + { + total += cf.metric.allMemtablesOffHeapSize.value(); } return total; } @@ -120,11 +176,16 @@ public class KeyspaceMetrics return sum; } }); - pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Integer>() + pendingFlushes = Metrics.newGauge(factory.createMetricName("PendingFlushes"), new Gauge<Integer>() { public Integer value() { - return Keyspace.switchLock.getQueueLength(); + int sum = 0; + for (ColumnFamilyStore cf : ks.getColumnFamilyStores()) + { + sum += cf.metric.pendingFlushes.count(); + } + return sum; } }); liveDiskSpaceUsed = Metrics.newGauge(factory.createMetricName("LiveDiskSpaceUsed"), new Gauge<Long>() @@ -168,10 +229,15 @@ public class KeyspaceMetrics */ public void release() { - Metrics.defaultRegistry().removeMetric(factory.createMetricName("AllMemtablesDataSize")); - Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableDataSize")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("AllMemtablesLiveDateSize")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("AllMemtablesOnHeapDataSize")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("AllMemtablesOffHeapDataSize")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableLiveDataSize")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableOnHeapDataSize")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableOffHeapDataSize")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableSwitchCount")); - Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingTasks")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingFlushes")); + Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingCompactions")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("LiveDiskSpaceUsed")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("TotalDiskSpaceUsed")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("BloomFilterDiskSpaceUsed"));