You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/12/19 00:37:18 UTC

cassandra git commit: Fix bugs in commit log archiving startup behavior

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 124f1bd26 -> 3740f815c


Fix bugs in commit log archiving startup behavior

patch by Ariel Weisberg; reviewed by Branimir Lambov for CASSANDRA-10593


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

Branch: refs/heads/cassandra-2.1
Commit: 3740f815c21254bd625ad1cbe8d47aa657727a83
Parents: 124f1bd
Author: Ariel Weisberg <ar...@datastax.com>
Authored: Thu Dec 3 14:37:26 2015 -0500
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Dec 18 23:37:05 2015 +0000

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 .../cassandra/db/commitlog/CommitLogArchiver.java  | 17 ++++++++++-------
 .../db/commitlog/CommitLogSegmentManager.java      |  3 ++-
 3 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3740f815/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 90f1bca..581784e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.13
+ * Fix bugs in commit log archiving startup behavior (CASSANDRA-10593)
  * (cqlsh) further optimise COPY FROM (CASSANDRA-9302)
  * Allow CREATE TABLE WITH ID (CASSANDRA-9179)
  * Make Stress compiles within eclipse (CASSANDRA-10807)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3740f815/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
index 91f3179..8d9a6b3 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
@@ -1,5 +1,5 @@
 /*
- * 
+ *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -7,16 +7,16 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- * 
+ *
  */
 package org.apache.cassandra.db.commitlog;
 
@@ -173,10 +173,13 @@ public class CommitLogArchiver
         }
         catch (ExecutionException e)
         {
-            if (e.getCause() instanceof IOException)
+            if (e.getCause() instanceof RuntimeException)
             {
-                logger.error("Looks like the archiving of file {} failed earlier, cassandra is going to ignore this segment for now.", name);
-                return false;
+                if (e.getCause().getCause() instanceof IOException)
+                {
+                    logger.error("Looks like the archiving of file {} failed earlier, cassandra is going to ignore this segment for now.", name, e.getCause().getCause());
+                    return false;
+                }
             }
             throw new RuntimeException(e);
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3740f815/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
index 9310d67..0ea54ab 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
@@ -383,7 +383,8 @@ public class CommitLogSegmentManager
     void recycleSegment(final File file)
     {
         if (isCapExceeded()
-            || CommitLogDescriptor.fromFileName(file.getName()).getMessagingVersion() != MessagingService.current_version)
+            || CommitLogDescriptor.fromFileName(file.getName()).getMessagingVersion() != MessagingService.current_version
+            || !DatabaseDescriptor.getCommitLogSegmentRecyclingEnabled())
         {
             // (don't decrease managed size, since this was never a "live" segment)
             logger.debug("(Unopened) segment {} is no longer needed and will be deleted now", file);