cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bened...@apache.org
Subject [1/3] cassandra git commit: Fix CommitLog.forceRecycleAllSegments() memory access error
Date Thu, 19 Feb 2015 12:11:16 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 5da4c4b16 -> 36dc512ad
  refs/heads/trunk 65617aa0a -> 555f89c5a


Fix CommitLog.forceRecycleAllSegments() memory access error

patch by benedict; reviewed by jmckenzie for CASSANDRA-8812


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

Branch: refs/heads/cassandra-2.1
Commit: 36dc512ad4771b8e85c1e095822455012f75e1ee
Parents: 5da4c4b
Author: Benedict Elliott Smith <benedict@apache.org>
Authored: Thu Feb 19 12:10:45 2015 +0000
Committer: Benedict Elliott Smith <benedict@apache.org>
Committed: Thu Feb 19 12:10:45 2015 +0000

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 .../apache/cassandra/db/commitlog/CommitLogSegment.java | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/36dc512a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7980855..9458627 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.4
+ * Fix CommitLog.forceRecycleAllSegments() memory access error (CASSANDRA-8812)
  * Improve assertions in Memory (CASSANDRA-8792)
  * Fix SSTableRewriter cleanup (CASSANDRA-8802)
  * Introduce SafeMemory for CompressionMetadata.Writer (CASSANDRA-8758)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/36dc512a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
index a70327b..2ea8701 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
@@ -322,7 +322,7 @@ public class CommitLogSegment
 
             CLibrary.trySkipCache(fd, offset, nextMarker);
             if (close)
-                close();
+                internalClose();
         }
         catch (Exception e) // MappedByteBuffer.force() does not declare IOException but
can actually throw it
         {
@@ -409,7 +409,15 @@ public class CommitLogSegment
     /**
      * Close the segment file.
      */
-    void close()
+    synchronized void close()
+    {
+        discardUnusedTail();
+        waitForModifications();
+        lastSyncedOffset = buffer.capacity();
+        internalClose();
+    }
+
+    void internalClose()
     {
         try
         {


Mime
View raw message