cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [05/19] cassandra git commit: Fix CompressionInfo not being synced on close
Date Fri, 13 Nov 2015 14:59:00 GMT
Fix CompressionInfo not being synced on close

Patch by stefania; reviewed by aweisberg for CASSANDRA-10534


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

Branch: refs/heads/trunk
Commit: 7e056fa27047a868660ff796734dcbd485e1b29a
Parents: e291382
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Fri Nov 13 09:56:08 2015 -0500
Committer: Joshua McKenzie <jmckenzie@apache.org>
Committed: Fri Nov 13 09:56:08 2015 -0500

----------------------------------------------------------------------
 .../cassandra/io/compress/CompressionMetadata.java       | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7e056fa2/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 9ac2f89..1dc2df3 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
@@ -401,14 +401,19 @@ public class CompressionMetadata
 
         public void close(long dataLength, int chunks) throws IOException
         {
+            FileOutputStream fos = null;
             DataOutputStream out = null;
             try
             {
-            	out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(filePath)));
-	            assert chunks == count;
-	            writeHeader(out, dataLength, chunks);
+                fos = new FileOutputStream(filePath);
+                out = new DataOutputStream(new BufferedOutputStream(fos));
+                assert chunks == count;
+                writeHeader(out, dataLength, chunks);
                 for (int i = 0 ; i < count ; i++)
                     out.writeLong(offsets.getLong(i * 8L));
+
+                out.flush();
+                fos.getFD().sync();
             }
             finally
             {


Mime
View raw message