cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/6] git commit: Fix mean cells and mean row size per sstable calculations patch by Paulo Gaspar, jbellis, and Marcus Eriksson for CASSANDRA-6667
Date Fri, 07 Feb 2014 16:19:00 GMT
Fix mean cells and mean row size per sstable calculations
patch by Paulo Gaspar, jbellis, and Marcus Eriksson for CASSANDRA-6667


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

Branch: refs/heads/cassandra-2.0
Commit: beefd0b8cc91054a559cdecfe5d972dffb20e0e7
Parents: 31414fb
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Fri Feb 7 10:17:04 2014 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Fri Feb 7 10:18:21 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                                   | 1 +
 src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java  | 2 +-
 src/java/org/apache/cassandra/db/DataTracker.java             | 7 ++++---
 .../org/apache/cassandra/metrics/ColumnFamilyMetrics.java     | 5 +++--
 4 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/beefd0b8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4be97f1..5511e01 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,7 @@
 1.2.16
  * Fix upgradesstables NPE for non-CF-based indexes (CASSANDRA-6645)
  * Fix partition and range deletes not triggering flush (CASSANDRA-6655)
+ * Fix mean cells and mean row size per sstable calculations (CASSANDRA-6667)
 
 
 1.2.15

http://git-wip-us.apache.org/repos/asf/cassandra/blob/beefd0b8/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java b/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
index 9ee7568..86bd860 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
@@ -194,7 +194,7 @@ public interface ColumnFamilyStoreMBean
 
     /**
      * @see org.apache.cassandra.metrics.ColumnFamilyMetrics#meanRowSize
-     * @return the size of the smallest compacted row
+     * @return the average row size across all the sstables
      */
     @Deprecated
     public long getMeanRowSize();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/beefd0b8/src/java/org/apache/cassandra/db/DataTracker.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DataTracker.java b/src/java/org/apache/cassandra/db/DataTracker.java
index b128abb..3e271d3 100644
--- a/src/java/org/apache/cassandra/db/DataTracker.java
+++ b/src/java/org/apache/cassandra/db/DataTracker.java
@@ -389,11 +389,12 @@ public class DataTracker
     public int getMeanColumns()
     {
         long sum = 0;
-        int count = 0;
+        long count = 0;
         for (SSTableReader sstable : getSSTables())
         {
-            sum += sstable.getEstimatedColumnCount().mean();
-            count++;
+            long n = sstable.getEstimatedColumnCount().count();
+            sum += sstable.getEstimatedColumnCount().mean() * n;
+            count += n;
         }
         return count > 0 ? (int) (sum / count) : 0;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/beefd0b8/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 cb13c22..a665365 100644
--- a/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
@@ -213,8 +213,9 @@ public class ColumnFamilyMetrics
                 long count = 0;
                 for (SSTableReader sstable : cfs.getSSTables())
                 {
-                    sum += sstable.getEstimatedRowSize().mean();
-                    count++;
+                    long n = sstable.getEstimatedRowSize().count();
+                    sum += sstable.getEstimatedRowSize().mean() * n;
+                    count += n;
                 }
                 return count > 0 ? sum / count : 0;
             }


Mime
View raw message