cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: Expose a total memtable size metric for a CF
Date Fri, 29 Nov 2013 02:25:39 GMT
Updated Branches:
  refs/heads/cassandra-2.0 43e61e8af -> d41a746a6


Expose a total memtable size metric for a CF

patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-6391


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

Branch: refs/heads/cassandra-2.0
Commit: d41a746a699fcbb2591c27cfebe344a5310831a6
Parents: 43e61e8
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Fri Nov 29 05:24:56 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Fri Nov 29 05:24:56 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 src/java/org/apache/cassandra/db/ColumnFamilyStore.java | 12 ++++++++++++
 .../apache/cassandra/metrics/ColumnFamilyMetrics.java   |  9 +++++++++
 3 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d41a746a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index bd8dd1c..644c6b3 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,7 @@
  * Fix divide-by-zero in PCI (CASSANDRA-6403)
  * Fix setting last compacted key in the wrong level for LCS (CASSANDRA-6284)
  * Add sub-ms precision formats to the timestamp parser (CASSANDRA-6395)
+ * Expose a total memtable size metric for a CF (CASSANDRA-6391)
 Merged from 1.2:
  * Fix thundering herd on endpoint cache invalidation (CASSANDRA-6345)
  * cqlsh: quote single quotes in strings inside collections (CASSANDRA-6172)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d41a746a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 137d597..eb715ac 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -1114,6 +1114,18 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         return size;
     }
 
+    /**
+     * @return the size of all the memtables, including the pending flush ones and 2i memtables,
if any.
+     */
+    public long getTotalAllMemtablesLiveSize()
+    {
+        long size = getAllMemtablesLiveSize();
+        if (indexManager.hasIndexes())
+            for (ColumnFamilyStore index : indexManager.getIndexesBackedByCfs())
+                size += index.getAllMemtablesLiveSize();
+        return size;
+    }
+
     public int getMemtableSwitchCount()
     {
         return (int) metric.memtableSwitchCount.count();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d41a746a/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 aabf373..30f01de 100644
--- a/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
@@ -36,6 +36,8 @@ public class ColumnFamilyMetrics
 {
     /** 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. */
@@ -117,6 +119,13 @@ public class ColumnFamilyMetrics
                 return cfs.getDataTracker().getMemtable().getLiveSize();
             }
         });
+        allMemtablesDataSize = Metrics.newGauge(factory.createMetricName("AllMemtablesDataSize"),
new Gauge<Long>()
+        {
+            public Long value()
+            {
+                return cfs.getTotalAllMemtablesLiveSize();
+            }
+        });
         memtableSwitchCount = Metrics.newCounter(factory.createMetricName("MemtableSwitchCount"));
         estimatedRowSizeHistogram = Metrics.newGauge(factory.createMetricName("EstimatedRowSizeHistogram"),
new Gauge<long[]>()
         {


Mime
View raw message