You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2016/08/23 14:50:30 UTC

[3/5] cassandra git commit: Disk failure policy should not be invoked on out of space

Disk failure policy should not be invoked on out of space

patch by Sankalp Kohli; reviewed by marcuse for CASSANDRA-12385


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

Branch: refs/heads/trunk
Commit: 8bd629942ca7014ff5b6e001db10290691f6cc08
Parents: 6808e75
Author: sankalp kohli <sa...@apple.com>
Authored: Fri Aug 19 09:44:48 2016 +0200
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Tue Aug 23 16:32:11 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/db/Directories.java    |  3 +-
 .../db/compaction/AbstractCompactionTask.java   |  7 +++++
 .../cassandra/io/FSDiskFullWriteError.java      | 33 ++++++++++++++++++++
 4 files changed, 43 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bd62994/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0d461f3..bd1fc5d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.9
+ * Disk failure policy should not be invoked on out of space (CASSANDRA-12385)
  * Calculate last compacted key on startup (CASSANDRA-6216)
  * Add schema to snapshot manifest, add USING TIMESTAMP clause to ALTER TABLE statements (CASSANDRA-7190)
  * Fix clean interval not sent to commit log for empty memtable flush (CASSANDRA-12436)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bd62994/src/java/org/apache/cassandra/db/Directories.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Directories.java b/src/java/org/apache/cassandra/db/Directories.java
index 30fe56d..68aa6be 100644
--- a/src/java/org/apache/cassandra/db/Directories.java
+++ b/src/java/org/apache/cassandra/db/Directories.java
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.*;
 import org.apache.cassandra.db.lifecycle.LifecycleTransaction;
+import org.apache.cassandra.io.FSDiskFullWriteError;
 import org.apache.cassandra.io.FSError;
 import org.apache.cassandra.io.FSWriteError;
 import org.apache.cassandra.io.util.FileUtils;
@@ -385,7 +386,7 @@ public class Directories
 
         if (candidates.isEmpty())
             if (tooBig)
-                throw new FSWriteError(new IOException("Insufficient disk space to write " + writeSize + " bytes"), "");
+                throw new FSDiskFullWriteError(new IOException("Insufficient disk space to write " + writeSize + " bytes"), "");
             else
                 throw new FSWriteError(new IOException("All configured data directories have been blacklisted as unwritable for erroring out"), "");
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bd62994/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
index 155bf2f..430c916 100644
--- a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
+++ b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
@@ -23,6 +23,7 @@ import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Directories;
 import org.apache.cassandra.db.compaction.CompactionManager.CompactionExecutorStatsCollector;
 import org.apache.cassandra.db.compaction.writers.CompactionAwareWriter;
+import org.apache.cassandra.io.FSDiskFullWriteError;
 import org.apache.cassandra.io.sstable.format.SSTableReader;
 import org.apache.cassandra.utils.WrappedRunnable;
 import org.apache.cassandra.db.lifecycle.LifecycleTransaction;
@@ -59,6 +60,12 @@ public abstract class AbstractCompactionTask extends WrappedRunnable
         {
             return executeInternal(collector);
         }
+        catch(FSDiskFullWriteError e)
+        {
+            RuntimeException cause = new RuntimeException("Converted from FSDiskFullWriteError: " + e.getMessage());
+            cause.setStackTrace(e.getStackTrace());
+            throw new RuntimeException("Throwing new Runtime to bypass exception handler when disk is full", cause);
+        }
         finally
         {
             transaction.close();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bd62994/src/java/org/apache/cassandra/io/FSDiskFullWriteError.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/FSDiskFullWriteError.java b/src/java/org/apache/cassandra/io/FSDiskFullWriteError.java
new file mode 100644
index 0000000..ca5d8da
--- /dev/null
+++ b/src/java/org/apache/cassandra/io/FSDiskFullWriteError.java
@@ -0,0 +1,33 @@
+/*
+ * 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
+ * regarding copyright ownership.  The ASF licenses this file
+ * 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.io;
+
+public class FSDiskFullWriteError extends FSWriteError
+{
+    public FSDiskFullWriteError(Throwable cause, String path)
+    {
+        super(cause, path);
+    }
+
+    @Override
+    public String toString()
+    {
+        return "FSDiskFullWriteError in " + path;
+    }
+}