cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/3] git commit: Fix leaking validator FH in StreamWriter patch by Joshua McKenzie; reviewed by jbellis for CASSANDRA-6832
Date Thu, 13 Mar 2014 18:14:20 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 a3b314908 -> da2d97142
  refs/heads/cassandra-2.1 a2ceb22c5 -> 4c22b165c


Fix leaking validator FH in StreamWriter
patch by Joshua McKenzie; reviewed by jbellis for CASSANDRA-6832


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

Branch: refs/heads/cassandra-2.0
Commit: da2d97142b9c76e5fb81df5f94c3d52ef46bf244
Parents: a3b3149
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Mar 13 13:13:48 2014 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Mar 13 13:13:48 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                               | 1 +
 src/java/org/apache/cassandra/streaming/StreamWriter.java | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/da2d9714/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2413b51..e208e21 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.7
+ * Fix leaking validator FH in StreamWriter (CASSANDRA-6832)
  * Fix saving triggers to schema (CASSANDRA-6789)
  * Fix trigger mutations when base mutation list is immutable (CASSANDRA-6790)
  * Fix accounting in FileCacheService to allow re-using RAR (CASSANDRA-6838)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/da2d9714/src/java/org/apache/cassandra/streaming/StreamWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/streaming/StreamWriter.java b/src/java/org/apache/cassandra/streaming/StreamWriter.java
index 04301ba..dbc7390 100644
--- a/src/java/org/apache/cassandra/streaming/StreamWriter.java
+++ b/src/java/org/apache/cassandra/streaming/StreamWriter.java
@@ -71,10 +71,9 @@ public class StreamWriter
     {
         long totalSize = totalSize();
         RandomAccessReader file = sstable.openDataReader();
-        ChecksumValidator validator = null;
-        if (new File(sstable.descriptor.filenameFor(Component.CRC)).exists())
-            validator = DataIntegrityMetadata.checksumValidator(sstable.descriptor);
-
+        ChecksumValidator validator = new File(sstable.descriptor.filenameFor(Component.CRC)).exists()
+                                    ? DataIntegrityMetadata.checksumValidator(sstable.descriptor)
+                                    : null;
         transferBuffer = validator == null ? new byte[DEFAULT_CHUNK_SIZE] : new byte[validator.chunkSize];
 
         // setting up data compression stream
@@ -114,6 +113,7 @@ public class StreamWriter
         {
             // no matter what happens close file
             FileUtils.closeQuietly(file);
+            FileUtils.closeQuietly(validator);
         }
 
         // release reference only when completed successfully


Mime
View raw message