Handle all exceptions when opening sstables

Patch by marcuse; reviewed by Blake Eggleston for CASSANDRA-14202


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

Branch: refs/heads/cassandra-3.11
Commit: edcb90f0813b88bbd42e9ebc55507b0f03ccb7bc
Parents: 73ca0e1
Author: Marcus Eriksson <marc...@apache.org>
Authored: Mon Jan 29 15:30:17 2018 +0100
Committer: Marcus Eriksson <marc...@apache.org>
Committed: Tue Apr 10 15:24:04 2018 +0200

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../cassandra/io/sstable/CorruptSSTableException.java    |  4 ++--
 .../cassandra/io/sstable/format/SSTableReader.java       | 11 +++--------
 3 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/edcb90f0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1564fa3..94b2276 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.17
+ * Handle all exceptions when opening sstables (CASSANDRA-14202)
  * Handle incompletely written hint descriptors during startup 
(CASSANDRA-14080)
  * Handle repeat open bound from SRP in read repair (CASSANDRA-14330)
  * Use zero as default score in DynamicEndpointSnitch (CASSANDRA-14252)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/edcb90f0/src/java/org/apache/cassandra/io/sstable/CorruptSSTableException.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/io/sstable/CorruptSSTableException.java 
b/src/java/org/apache/cassandra/io/sstable/CorruptSSTableException.java
index 0fe316d..93be2ee 100644
--- a/src/java/org/apache/cassandra/io/sstable/CorruptSSTableException.java
+++ b/src/java/org/apache/cassandra/io/sstable/CorruptSSTableException.java
@@ -23,13 +23,13 @@ public class CorruptSSTableException extends 
RuntimeException
 {
     public final File path;
 
-    public CorruptSSTableException(Exception cause, File path)
+    public CorruptSSTableException(Throwable cause, File path)
     {
         super("Corrupted: " + path, cause);
         this.path = path;
     }
 
-    public CorruptSSTableException(Exception cause, String path)
+    public CorruptSSTableException(Throwable cause, String path)
     {
         this(cause, new File(path));
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/edcb90f0/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java 
b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
index c66fd8c..dc6940d 100644
--- a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
@@ -466,9 +466,9 @@ public abstract class SSTableReader extends SSTable 
implements SelfRefCounted<SS
         {
             sstableMetadata = 
descriptor.getMetadataSerializer().deserialize(descriptor, types);
         }
-        catch (IOException e)
+        catch (Throwable t)
         {
-            throw new CorruptSSTableException(e, 
descriptor.filenameFor(Component.STATS));
+            throw new CorruptSSTableException(t, 
descriptor.filenameFor(Component.STATS));
         }
         ValidationMetadata validationMetadata = (ValidationMetadata) 
sstableMetadata.get(MetadataType.VALIDATION);
         StatsMetadata statsMetadata = (StatsMetadata) 
sstableMetadata.get(MetadataType.STATS);
@@ -511,15 +511,10 @@ public abstract class SSTableReader extends SSTable 
implements SelfRefCounted<SS
 
             return sstable;
         }
-        catch (IOException e)
-        {
-            sstable.selfRef().release();
-            throw new CorruptSSTableException(e, sstable.getFilename());
-        }
         catch (Throwable t)
         {
             sstable.selfRef().release();
-            throw t;
+            throw new CorruptSSTableException(t, sstable.getFilename());
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to