cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject git commit: Add paranoid disk failure option.
Date Tue, 18 Mar 2014 07:12:35 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 b4f2ff17a -> 850cd59ca


Add paranoid disk failure option.

Patch by marcuse, reviewed by kohlisankalp and jbellis for CASSANDRA-6646


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

Branch: refs/heads/cassandra-2.0
Commit: 850cd59ca4f409a9c9a2dc0edd7bf02f52308a35
Parents: b4f2ff1
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Tue Mar 18 07:52:12 2014 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Tue Mar 18 07:52:30 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                | 1 +
 conf/cassandra.yaml                                        | 1 +
 src/java/org/apache/cassandra/config/Config.java           | 1 +
 src/java/org/apache/cassandra/io/util/FileUtils.java       | 8 ++++++++
 src/java/org/apache/cassandra/service/CassandraDaemon.java | 9 +++++++++
 5 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/850cd59c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 040af7c..86d4e6f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -14,6 +14,7 @@
  * Correctly compare BooleanType values other than 0 and 1 (CASSANDRA-6779)
  * Read message id as string from earlier versions (CASSANDRA-6840)
  * Properly use the Paxos consistency for (non-protocol) batch (CASSANDRA-6837)
+ * Add paranoid disk failure option (CASSANDRA-6646)
 Merged from 1.2:
  * add extra SSL cipher suites (CASSANDRA-6613)
  * fix nodetool getsstables for blob PK (CASSANDRA-6803)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/850cd59c/conf/cassandra.yaml
----------------------------------------------------------------------
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index dc71c0f..d3c91ef 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -111,6 +111,7 @@ data_file_directories:
 commitlog_directory: /var/lib/cassandra/commitlog
 
 # policy for data disk failures:
+# stop_paranoid: shut down gossip and Thrift even for single-sstable errors.
 # stop: shut down gossip and Thrift, leaving the node effectively dead, but
 #       can still be inspected via JMX.
 # best_effort: stop using the failed disk and respond to requests based on

http://git-wip-us.apache.org/repos/asf/cassandra/blob/850cd59c/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index e8e43e2..5317fb8 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -275,6 +275,7 @@ public class Config
         best_effort,
         stop,
         ignore,
+        stop_paranoid,
     }
 
     public static enum CommitFailurePolicy

http://git-wip-us.apache.org/repos/asf/cassandra/blob/850cd59c/src/java/org/apache/cassandra/io/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/FileUtils.java b/src/java/org/apache/cassandra/io/util/FileUtils.java
index e091465..a12745c 100644
--- a/src/java/org/apache/cassandra/io/util/FileUtils.java
+++ b/src/java/org/apache/cassandra/io/util/FileUtils.java
@@ -38,6 +38,7 @@ import org.apache.cassandra.db.Keyspace;
 import org.apache.cassandra.io.FSError;
 import org.apache.cassandra.io.FSReadError;
 import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.io.sstable.CorruptSSTableException;
 import org.apache.cassandra.service.StorageService;
 
 public class FileUtils
@@ -407,11 +408,18 @@ public class FileUtils
             n += skipped;
         }
     }
+
+    public static void handleCorruptSSTable(CorruptSSTableException e)
+    {
+        if (DatabaseDescriptor.getDiskFailurePolicy() == Config.DiskFailurePolicy.stop_paranoid)
+            StorageService.instance.stopTransports();
+    }
     
     public static void handleFSError(FSError e)
     {
         switch (DatabaseDescriptor.getDiskFailurePolicy())
         {
+            case stop_paranoid:
             case stop:
                 StorageService.instance.stopTransports();
                 break;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/850cd59c/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index d8c56f1..0970776 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -36,6 +36,8 @@ import com.addthis.metrics.reporter.config.ReporterConfig;
 
 import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.Uninterruptibles;
+
+import org.apache.cassandra.io.sstable.CorruptSSTableException;
 import org.apache.log4j.PropertyConfigurator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -207,6 +209,13 @@ public class CassandraDaemon
                             logger.error("Exception in thread " + t, e2);
                         FileUtils.handleFSError((FSError) e2);
                     }
+
+                    if (e2 instanceof CorruptSSTableException)
+                    {
+                        if (e2 != e)
+                            logger.error("Exception in thread " + t, e2);
+                        FileUtils.handleCorruptSSTable((CorruptSSTableException) e2);
+                    }
                 }
             }
         });


Mime
View raw message