cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [1/4] git commit: CrcCheckChance should adjust based on live CFMetadata not sstable metadata
Date Tue, 23 Sep 2014 16:50:32 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 3f181f063 -> 1ecb70165


CrcCheckChance should adjust based on live CFMetadata not sstable metadata

patch by tjake; reviewed by Jason Brown for CASSANDRA-7978


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

Branch: refs/heads/trunk
Commit: 62db20a779fac3235c0e4dbade8c3d340d3c310b
Parents: d96485f
Author: Jake Luciani <jake@apache.org>
Authored: Tue Sep 23 12:30:25 2014 -0400
Committer: Jake Luciani <jake@apache.org>
Committed: Tue Sep 23 12:34:56 2014 -0400

----------------------------------------------------------------------
 CHANGES.txt                                            |  2 ++
 .../cassandra/io/compress/CompressionParameters.java   | 13 ++++++++++++-
 .../org/apache/cassandra/io/sstable/SSTableReader.java |  6 +++++-
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/62db20a7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index fd49b09..00603f3 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.0.11:
+ * CrcCheckChance should adjust based on live CFMetadata not 
+   sstable metadata (CASSANDRA-7978)
  * token() should only accept columns in the partitioning
    key order (CASSANDRA-6075)
  * Add method to invalidate permission cache via JMX (CASSANDRA-7977)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/62db20a7/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressionParameters.java b/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
index 7baaedd..2df64b4 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
@@ -30,6 +30,7 @@ import java.util.Set;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
+import org.apache.cassandra.config.CFMetaData;
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 
@@ -53,6 +54,7 @@ public class CompressionParameters
     private final Integer chunkLength;
     private volatile double crcCheckChance;
     public final Map<String, String> otherOptions; // Unrecognized options, can be
use by the compressor
+    private CFMetaData liveMetadata;
 
     public static CompressionParameters create(Map<? extends CharSequence, ? extends CharSequence>
opts) throws ConfigurationException
     {
@@ -101,15 +103,24 @@ public class CompressionParameters
         }
     }
 
+    public void setLiveMetadata(final CFMetaData liveMetadata)
+    {
+        assert this.liveMetadata == null || this.liveMetadata == liveMetadata;
+        this.liveMetadata = liveMetadata;
+    }
+
     public void setCrcCheckChance(double crcCheckChance) throws ConfigurationException
     {
         validateCrcCheckChance(crcCheckChance);
         this.crcCheckChance = crcCheckChance;
+
+        if (liveMetadata != null)
+            liveMetadata.compressionParameters.setCrcCheckChance(crcCheckChance);
     }
 
     public double getCrcCheckChance()
     {
-        return this.crcCheckChance;
+        return liveMetadata == null ? this.crcCheckChance : liveMetadata.compressionParameters.crcCheckChance;
     }
 
     private static double parseCrcCheckChance(String crcCheckChance) throws ConfigurationException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/62db20a7/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
index f632c87..92dee99 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
@@ -624,7 +624,11 @@ public class SSTableReader extends SSTable implements Closeable
         if (!compression)
             throw new IllegalStateException(this + " is not compressed");
 
-        return ((ICompressedFile) dfile).getMetadata();
+        CompressionMetadata cmd = ((ICompressedFile) dfile).getMetadata();
+
+        cmd.parameters.setLiveMetadata(Schema.instance.getCFMetaData(descriptor));
+
+        return cmd;
     }
 
     /**


Mime
View raw message