cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject cassandra git commit: Release references to sstables on failed SSTableWriter.openEarly
Date Fri, 12 Dec 2014 17:50:01 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 24e895c4c -> c3ac6baac


Release references to sstables on failed SSTableWriter.openEarly

Patch by jmckenzie; reviewed by benedict for CASSANDRA-8248


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

Branch: refs/heads/cassandra-2.1
Commit: c3ac6baac7bfea790a74fe7bc0a62a65202cb67e
Parents: 24e895c
Author: Joshua McKenzie <jmckenzie@apache.org>
Authored: Fri Dec 12 11:48:37 2014 -0600
Committer: Joshua McKenzie <jmckenzie@apache.org>
Committed: Fri Dec 12 11:48:37 2014 -0600

----------------------------------------------------------------------
 src/java/org/apache/cassandra/io/sstable/SSTableWriter.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c3ac6baa/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
index 53176e3..ec64561 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
@@ -413,7 +413,11 @@ public class SSTableWriter extends SSTable
         sstable.last = getMinimalKey(exclusiveUpperBoundOfReadableIndex);
         DecoratedKey inclusiveUpperBoundOfReadableData = iwriter.getMaxReadableKey(1);
         if (inclusiveUpperBoundOfReadableData == null)
+        {
+            // Prevent leaving tmplink files on disk
+            sstable.releaseReference();
             return null;
+        }
         int offset = 2;
         while (true)
         {
@@ -422,7 +426,10 @@ public class SSTableWriter extends SSTable
                 break;
             inclusiveUpperBoundOfReadableData = iwriter.getMaxReadableKey(offset++);
             if (inclusiveUpperBoundOfReadableData == null)
+            {
+                sstable.releaseReference();
                 return null;
+            }
         }
         sstable.last = getMinimalKey(inclusiveUpperBoundOfReadableData);
         return sstable;


Mime
View raw message