Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1D1B7181EA for ; Fri, 18 Dec 2015 23:39:53 +0000 (UTC) Received: (qmail 3339 invoked by uid 500); 18 Dec 2015 23:39:52 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 3300 invoked by uid 500); 18 Dec 2015 23:39:52 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 3269 invoked by uid 99); 18 Dec 2015 23:39:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Dec 2015 23:39:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B8822E054A; Fri, 18 Dec 2015 23:39:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aleksey@apache.org To: commits@cassandra.apache.org Date: Fri, 18 Dec 2015 23:39:52 -0000 Message-Id: <3cc16e2c3cb542e1bd29267a870a87cb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/4] cassandra git commit: Fix bugs in commit log archiving startup behavior Repository: cassandra Updated Branches: refs/heads/trunk 01b3508e0 -> 7e4737716 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/trunk Commit: 3740f815c21254bd625ad1cbe8d47aa657727a83 Parents: 124f1bd Author: Ariel Weisberg Authored: Thu Dec 3 14:37:26 2015 -0500 Committer: Aleksey Yeschenko 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);