cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [1/2] cassandra git commit: Better detection/logging for corruption in compressed sstables
Date Wed, 07 Jan 2015 18:37:34 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 49dea4193 -> ac27409e1


Better detection/logging for corruption in compressed sstables

Patch by jmckenzie; reviewed by marcuse for CASSANDRA-8192


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

Branch: refs/heads/trunk
Commit: 905273e3e419ba12d8130f56943b8f4f6818d544
Parents: 2afe0e8
Author: Joshua McKenzie <jmckenzie@apache.org>
Authored: Wed Jan 7 12:35:11 2015 -0600
Committer: Joshua McKenzie <jmckenzie@apache.org>
Committed: Wed Jan 7 12:35:11 2015 -0600

----------------------------------------------------------------------
 CHANGES.txt                                                     | 1 +
 .../org/apache/cassandra/io/compress/CompressionMetadata.java   | 5 +++++
 2 files changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/905273e3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1f93bf5..e7a4ee5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.3
+ * Better detection/logging for corruption in compressed sstables (CASSANDRA-8192)
  * Use the correct repairedAt value when closing writer (CASSANDRA-8570)
  * (cqlsh) Handle a schema mismatch being detected on startup (CASSANDRA-8512)
  * Properly calculate expected write size during compaction (CASSANDRA-8532)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/905273e3/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
index f19d502..a40048a 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
@@ -178,6 +178,9 @@ public class CompressionMetadata
         try
         {
             int chunkCount = input.readInt();
+            if (chunkCount <= 0)
+                throw new IOException("Compressed file with 0 chunks encountered: " + input);
+
             Memory offsets = Memory.allocate(chunkCount * 8);
 
             for (int i = 0; i < chunkCount; i++)
@@ -398,6 +401,8 @@ public class CompressionMetadata
 
         public Chunk(long offset, int length)
         {
+            assert(length > 0);
+
             this.offset = offset;
             this.length = length;
         }


Mime
View raw message