You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2014/03/03 15:06:11 UTC
[1/4] git commit: Fix resetAndTruncate:ing CompressionMetadata
Repository: cassandra
Updated Branches:
refs/heads/trunk 2c8100af2 -> db6b563f1
Fix resetAndTruncate:ing CompressionMetadata
Patch by kvaster, reviewed by marcuse for CASSANDRA-6791
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/64098f7d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/64098f7d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/64098f7d
Branch: refs/heads/trunk
Commit: 64098f7d6f0b122448693a3c6da16af54c99013b
Parents: f08ae39
Author: Marcus Eriksson <ma...@apache.org>
Authored: Mon Mar 3 15:03:34 2014 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Mon Mar 3 15:03:34 2014 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 +-
.../io/compress/CompressedSequentialWriter.java | 2 +-
.../CompressedRandomAccessReaderTest.java | 43 ++++++++++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/64098f7d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 780b528..b3c0a35 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -19,7 +19,7 @@
* Support negative timestamps for CQL3 dates in query string (CASSANDRA-6718)
* Avoid NPEs when receiving table changes for an unknown keyspace (CASSANDRA-5631)
* Fix bootstrapping when there is no schema (CASSANDRA-6685)
-
+ * Fix truncating compression metadata (CASSANDRA-6791)
1.2.15
* Move handling of migration event source to solve bootstrap race (CASSANDRA-6648)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/64098f7d/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
index 00eb5a7..da55e83 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
@@ -231,7 +231,7 @@ public class CompressedSequentialWriter extends SequentialWriter
// truncate data and index file
truncate(chunkOffset);
- metadataWriter.resetAndTruncate(realMark.nextChunkIndex);
+ metadataWriter.resetAndTruncate(realMark.nextChunkIndex - 1);
}
/**
http://git-wip-us.apache.org/repos/asf/cassandra/blob/64098f7d/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java b/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java
index 830c3e1..678a650 100644
--- a/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java
+++ b/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java
@@ -19,10 +19,12 @@
package org.apache.cassandra.io.compress;
import java.io.*;
+import java.util.Collections;
import java.util.Random;
import org.junit.Test;
+import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.io.sstable.CorruptSSTableException;
import org.apache.cassandra.io.sstable.SSTableMetadata;
import org.apache.cassandra.io.util.*;
@@ -95,6 +97,47 @@ public class CompressedRandomAccessReaderTest
}
@Test
+ public void test6791() throws IOException, ConfigurationException
+ {
+ File f = File.createTempFile("compressed6791_", "3");
+ String filename = f.getAbsolutePath();
+ try
+ {
+
+ SSTableMetadata.Collector sstableMetadataCollector = SSTableMetadata.createCollector().replayPosition(null);
+ CompressedSequentialWriter writer = new CompressedSequentialWriter(f, filename + ".metadata", false, new CompressionParameters(SnappyCompressor.instance, 32, Collections.<String, String>emptyMap()), sstableMetadataCollector);
+
+ for (int i = 0; i < 20; i++)
+ writer.write("x".getBytes());
+
+ FileMark mark = writer.mark();
+ // write enough garbage to create new chunks:
+ for (int i = 0; i < 40; i++)
+ writer.write("y".getBytes());
+
+ writer.resetAndTruncate(mark);
+
+ for (int i = 0; i < 20; i++)
+ writer.write("x".getBytes());
+ writer.close();
+
+ CompressedRandomAccessReader reader = CompressedRandomAccessReader.open(filename, new CompressionMetadata(filename + ".metadata", f.length()), false);
+ String res = reader.readLine();
+ assertEquals(res, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
+ assertEquals(40, res.length());
+ }
+ finally
+ {
+ // cleanup
+ if (f.exists())
+ f.delete();
+ File metadata = new File(filename + ".metadata");
+ if (metadata.exists())
+ metadata.delete();
+ }
+ }
+
+ @Test
public void testDataCorruptionDetection() throws IOException
{
String CONTENT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vitae.";
[3/4] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Posted by ma...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/56631e13
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/56631e13
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/56631e13
Branch: refs/heads/trunk
Commit: 56631e139092d81d55ea8c7c7ddccb3ff16eef62
Parents: 0439531 ef20671
Author: Marcus Eriksson <ma...@apache.org>
Authored: Mon Mar 3 15:04:10 2014 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Mon Mar 3 15:04:10 2014 +0100
----------------------------------------------------------------------
----------------------------------------------------------------------
[2/4] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0
Posted by ma...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ef20671c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ef20671c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ef20671c
Branch: refs/heads/trunk
Commit: ef20671c2c99ab40362785f4718c9e2c13edbda2
Parents: 41d8a5f 64098f7
Author: Marcus Eriksson <ma...@apache.org>
Authored: Mon Mar 3 15:04:00 2014 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Mon Mar 3 15:04:00 2014 +0100
----------------------------------------------------------------------
----------------------------------------------------------------------
[4/4] git commit: Merge branch 'cassandra-2.1' into trunk
Posted by ma...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/db6b563f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/db6b563f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/db6b563f
Branch: refs/heads/trunk
Commit: db6b563f143dc5f2037244854527cafc8594e730
Parents: 2c8100a 56631e1
Author: Marcus Eriksson <ma...@apache.org>
Authored: Mon Mar 3 15:04:17 2014 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Mon Mar 3 15:04:17 2014 +0100
----------------------------------------------------------------------
----------------------------------------------------------------------