cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [3/5] git commit: preserve commitlog size cap when recycling segments at startup patch by jbellis; reviewed by vijay for CASSANDRA-4201
Date Wed, 23 May 2012 21:34:05 GMT
preserve commitlog size cap when recycling segments at startup
patch by jbellis; reviewed by vijay for CASSANDRA-4201


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

Branch: refs/heads/trunk
Commit: 30e78d6dc98b7e425c121c9a40c4b803dd9a9e7b
Parents: 9345703
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Tue May 1 16:55:45 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed May 23 16:33:41 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 ++
 .../cassandra/db/commitlog/CommitLogAllocator.java |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/30e78d6d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index bc2bf66..c7e3207 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 1.1.1-dev
+ * preserve commitlog size cap when recycling segments at startup
+   (CASSANDRA-4201)
  * (Hadoop) fix split generation regression (CASSANDRA-4259)
  * ignore min/max compactions settings in LCS, while preserving
    behavior that min=max=0 disables autocompaction (CASSANDRA-4233)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/30e78d6d/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
index 153140b..5d8636d 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
@@ -180,8 +180,10 @@ public class CommitLogAllocator
         // check against SEGMENT_SIZE avoids recycling odd-sized or empty segments from old
C* versions and unit tests
         if (isCapExceeded() || file.length() != DatabaseDescriptor.getCommitLogSegmentSize())
         {
+            // (don't decrease managed size, since this was never a "live" segment)
             try
             {
+                logger.debug("(Unopened) segment {} is no longer needed and will be deleted
now", file);
                 FileUtils.deleteWithConfirm(file);
             }
             catch (IOException e)
@@ -191,6 +193,9 @@ public class CommitLogAllocator
             return;
         }
 
+        logger.debug("Recycling {}", file);
+        // this wasn't previously a live segment, so add it to the managed size when we make
it live
+        size.addAndGet(DatabaseDescriptor.getCommitLogSegmentSize());
         queue.add(new Runnable()
         {
             public void run()


Mime
View raw message