cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject git commit: choose a constant for 'no compression ratio' that is outside the valid range of compression ratios patch by dbrosius reviewed by slebresne for CASSANDRA-3977
Date Fri, 09 Nov 2012 03:41:58 GMT
Updated Branches:
  refs/heads/trunk e6ee1faff -> 686a17cf4


choose a constant for 'no compression ratio' that is outside the valid range of compression
ratios
patch by dbrosius reviewed by slebresne for CASSANDRA-3977


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

Branch: refs/heads/trunk
Commit: 686a17cf444011bd9e95ce73b4ba875cacffe770
Parents: e6ee1fa
Author: Dave Brosius <dbrosius@apache.org>
Authored: Thu Nov 8 22:40:04 2012 -0500
Committer: Dave Brosius <dbrosius@apache.org>
Committed: Thu Nov 8 22:40:04 2012 -0500

----------------------------------------------------------------------
 .../cassandra/io/sstable/SSTableMetadata.java      |    7 ++++---
 .../cassandra/metrics/ColumnFamilyMetrics.java     |    3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/686a17cf/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java b/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java
index fafccab..7932c88 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java
@@ -45,6 +45,7 @@ import org.apache.cassandra.utils.EstimatedHistogram;
  */
 public class SSTableMetadata
 {
+    public static final double NO_COMPRESSION_RATIO = -1.0;
     public static final SSTableMetadataSerializer serializer = new SSTableMetadataSerializer();
 
     public final EstimatedHistogram estimatedRowSize;
@@ -62,7 +63,7 @@ public class SSTableMetadata
              defaultColumnCountHistogram(),
              ReplayPosition.NONE,
              Long.MIN_VALUE,
-             Double.MIN_VALUE,
+             NO_COMPRESSION_RATIO,
              null,
              Collections.<Integer>emptySet(),
              defaultTombstoneDropTimeHistogram());
@@ -129,7 +130,7 @@ public class SSTableMetadata
         protected EstimatedHistogram estimatedColumnCount = defaultColumnCountHistogram();
         protected ReplayPosition replayPosition = ReplayPosition.NONE;
         protected long maxTimestamp = Long.MIN_VALUE;
-        protected double compressionRatio = Double.MIN_VALUE;
+        protected double compressionRatio = NO_COMPRESSION_RATIO;
         protected Set<Integer> ancestors = new HashSet<Integer>();
         protected StreamingHistogram estimatedTombstoneDropTime = defaultTombstoneDropTimeHistogram();
 
@@ -273,7 +274,7 @@ public class SSTableMetadata
                 maxTimestamp = Long.MIN_VALUE;
             double compressionRatio = desc.version.hasCompressionRatio
                                     ? dis.readDouble()
-                                    : Double.MIN_VALUE;
+                                    : NO_COMPRESSION_RATIO;
             String partitioner = desc.version.hasPartitioner ? dis.readUTF() : null;
             int nbAncestors = desc.version.hasAncestors ? dis.readInt() : 0;
             Set<Integer> ancestors = new HashSet<Integer>(nbAncestors);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/686a17cf/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 e206daf..d7ae745 100644
--- a/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
@@ -25,6 +25,7 @@ import com.yammer.metrics.core.MetricName;
 
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Table;
+import org.apache.cassandra.io.sstable.SSTableMetadata;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.utils.EstimatedHistogram;
 
@@ -143,7 +144,7 @@ public class ColumnFamilyMetrics
                 int total = 0;
                 for (SSTableReader sstable : cfs.getSSTables())
                 {
-                    if (sstable.getCompressionRatio() != Double.MIN_VALUE)
+                    if (sstable.getCompressionRatio() != SSTableMetadata.NO_COMPRESSION_RATIO)
                     {
                         sum += sstable.getCompressionRatio();
                         total++;


Mime
View raw message