Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

choose a constant for 'no compression ratio' that is outside the vali…

…d range of compression ratios

patch by dbrosius reviewed by slebresne for CASSANDRA-3977
  • Loading branch information...
commit 686a17cf444011bd9e95ce73b4ba875cacffe770 1 parent e6ee1fa
@mebigfatguy mebigfatguy authored
View
7 src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java
@@ -45,6 +45,7 @@
*/
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 @@ private SSTableMetadata()
defaultColumnCountHistogram(),
ReplayPosition.NONE,
Long.MIN_VALUE,
- Double.MIN_VALUE,
+ NO_COMPRESSION_RATIO,
null,
Collections.<Integer>emptySet(),
defaultTombstoneDropTimeHistogram());
@@ -129,7 +130,7 @@ public double getEstimatedDroppableTombstoneRatio(int gcBefore)
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 SSTableMetadata deserialize(DataInputStream dis, Descriptor desc) throws
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);
View
3  src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
@@ -25,6 +25,7 @@
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 Double value()
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++;
Please sign in to comment.
Something went wrong with that request. Please try again.