cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcus Eriksson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-8750) Ensure SSTableReader.last corresponds exactly with the file end
Date Tue, 10 Feb 2015 14:23:12 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-8750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14314221#comment-14314221
] 

Marcus Eriksson commented on CASSANDRA-8750:
--------------------------------------------

+1

added 2 comments and an assert to make things a bit more clear;
{code}
diff --git a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
index ea0d785..ad53e83 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
@@ -150,6 +150,8 @@ public class CompressedSequentialWriter extends SequentialWriter
     {
         if (overrideLength <= 0)
             return metadataWriter.open(originalSize, chunkOffset, isFinal ? FINAL : SHARED_FINAL);
+        // we are early opening the file, make sure we open metadata with the correct size
+        assert !isFinal;
         return metadataWriter.open(overrideLength, chunkOffset, SHARED);
     }
 
diff --git a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
index ad087c7..fd8248e 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
@@ -351,6 +351,7 @@ public class CompressionMetadata
                         this.offsets.unreference();
                     }
                     // null out our reference to the original shared data to catch accidental
reuse
+                    // note that since noone is writing to this Writer while we open it,
null:ing out this.offsets is safe
                     this.offsets = null;
                     if (type == OpenType.SHARED_FINAL)
                     {
{code}

> Ensure SSTableReader.last corresponds exactly with the file end
> ---------------------------------------------------------------
>
>                 Key: CASSANDRA-8750
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8750
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Benedict
>            Assignee: Benedict
>            Priority: Minor
>             Fix For: 2.1.4
>
>
> Following on from CASSANDRA-8744, CASSANDRA-8749 and CASSANDRA-8747, this patch attempts
to make the whole opening early of compaction results more robust and with more clearly understood
behaviour. The improvements of CASSANDRA-8747 permit is to easily align the last key with
a summary boundary, and an index and data file end position. This patch modifies SegmentedFile
to permit the provision of an explicit length, which is then provided to any readers, which
enforce it, ensuring no code may accidentally see an end inconsistent with the one advertised.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message