You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2018/11/30 12:13:44 UTC

[2/6] cassandra git commit: CommitLogReplayer.handleReplayError should print stack traces

CommitLogReplayer.handleReplayError should print stack traces

patch by Benedict; reviewed by Dinesh Joshi for CASSANDRA-14589


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

Branch: refs/heads/cassandra-3.11
Commit: 0c97908b2f185615c0134572c4f276cd2c5a3f55
Parents: e4d0ce6
Author: Benedict Elliott Smith <be...@apple.com>
Authored: Fri Jul 27 16:13:18 2018 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Fri Nov 30 12:12:13 2018 +0000

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../AbstractLocalAwareExecutorService.java      |  2 +-
 .../db/commitlog/CommitLogReplayer.java         | 34 ++++++++++----------
 3 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c97908b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d63016b..d3d7158 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.18
+ * CommitLogReplayer.handleReplayError should print stack traces (CASSANDRA-14589)
  * Netty epoll IOExceptions caused by unclean client disconnects being logged at INFO (CASSANDRA-14909)
  * Unfiltered.isEmpty conflicts with Row extends AbstractCollection.isEmpty (CASSANDRA-14588)
  * RangeTombstoneList doesn't properly clean up mergeable or superseded rts in some cases (CASSANDRA-14894)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c97908b/src/java/org/apache/cassandra/concurrent/AbstractLocalAwareExecutorService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/concurrent/AbstractLocalAwareExecutorService.java b/src/java/org/apache/cassandra/concurrent/AbstractLocalAwareExecutorService.java
index f47d8ac..6ef12d7 100644
--- a/src/java/org/apache/cassandra/concurrent/AbstractLocalAwareExecutorService.java
+++ b/src/java/org/apache/cassandra/concurrent/AbstractLocalAwareExecutorService.java
@@ -166,7 +166,7 @@ public abstract class AbstractLocalAwareExecutorService implements LocalAwareExe
             catch (Throwable t)
             {
                 JVMStabilityInspector.inspectThrowable(t);
-                logger.warn("Uncaught exception on thread {}: {}", Thread.currentThread(), t);
+                logger.warn("Uncaught exception on thread {}", Thread.currentThread(), t);
                 result = t;
                 failure = true;
             }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c97908b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
index 4fd263c..3ec4f15 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
@@ -271,7 +271,7 @@ public class CommitLogReplayer
         {
             if (end != 0 || filecrc != 0)
             {
-                handleReplayError(false,
+                handleReplayError(false, null,
                                   "Encountered bad header at position %d of commit log %s, with invalid CRC. " +
                                   "The end of segment marker should be zero.",
                                   offset, reader.getPath());
@@ -280,7 +280,8 @@ public class CommitLogReplayer
         }
         else if (end < offset || end > reader.length())
         {
-            handleReplayError(tolerateTruncation, "Encountered bad header at position %d of commit log %s, with bad position but valid CRC",
+            handleReplayError(tolerateTruncation, null,
+                            "Encountered bad header at position %d of commit log %s, with bad position but valid CRC",
                               offset, reader.getPath());
             return -1;
         }
@@ -402,12 +403,12 @@ public class CommitLogReplayer
             if (desc == null) {
                 // Presumably a failed CRC or other IO error occurred, which may be ok if it's the last segment
                 // where we tolerate (and expect) truncation
-                handleReplayError(tolerateTruncation, "Could not read commit log descriptor in file %s", file);
+                handleReplayError(tolerateTruncation, null, "Could not read commit log descriptor in file %s", file);
                 return;
             }
             if (segmentId != desc.id)
             {
-                handleReplayError(false, "Segment id mismatch (filename %d, descriptor %d) in file %s", segmentId, desc.id, file);
+                handleReplayError(false, null,"Segment id mismatch (filename %d, descriptor %d) in file %s", segmentId, desc.id, file);
                 // continue processing if ignored.
             }
 
@@ -423,7 +424,7 @@ public class CommitLogReplayer
                 }
                 catch (ConfigurationException e)
                 {
-                    handleReplayError(false, "Unknown compression: %s", e.getMessage());
+                    handleReplayError(false, null, "Unknown compression: %s", e.getMessage());
                     return;
                 }
             }
@@ -482,9 +483,9 @@ public class CommitLogReplayer
                     }
                     catch (IOException | ArrayIndexOutOfBoundsException e)
                     {
-                        handleReplayError(tolerateErrorsInSection,
-                                          "Unexpected exception decompressing section at %d: %s",
-                                          start, e);
+                        handleReplayError(tolerateErrorsInSection, e,
+                                          "Unexpected exception decompressing section at %d",
+                                          start);
                         continue;
                     }
                 }
@@ -555,7 +556,7 @@ public class CommitLogReplayer
                 // This prevents CRC by being fooled by special-case garbage in the file; see CASSANDRA-2128
                 if (serializedSize < 10)
                 {
-                    handleReplayError(tolerateErrors,
+                    handleReplayError(tolerateErrors, null,
                                       "Invalid mutation size %d at %d in %s",
                                       serializedSize, mutationStart, errorContext);
                     return false;
@@ -574,7 +575,7 @@ public class CommitLogReplayer
 
                 if (checksum.getValue() != claimedSizeChecksum)
                 {
-                    handleReplayError(tolerateErrors,
+                    handleReplayError(tolerateErrors, null,
                                       "Mutation size checksum failure at %d in %s",
                                       mutationStart, errorContext);
                     return false;
@@ -591,7 +592,7 @@ public class CommitLogReplayer
             }
             catch (EOFException eof)
             {
-                handleReplayError(tolerateErrors,
+                handleReplayError(tolerateErrors, eof,
                                   "Unexpected end of segment",
                                   mutationStart, errorContext);
                 return false; // last CL entry didn't get completely written. that's ok.
@@ -600,7 +601,7 @@ public class CommitLogReplayer
             checksum.update(buffer, 0, serializedSize);
             if (claimedCRC32 != checksum.getValue())
             {
-                handleReplayError(tolerateErrors,
+                handleReplayError(tolerateErrors, null,
                                   "Mutation checksum failure at %d in %s",
                                   mutationStart, errorContext);
                 continue;
@@ -652,10 +653,9 @@ public class CommitLogReplayer
             }
 
             // Checksum passed so this error can't be permissible.
-            handleReplayError(false,
+            handleReplayError(false, t,
                               "Unexpected error deserializing mutation; saved to %s.  " +
-                              "This may be caused by replaying a mutation against a table with the same name but incompatible schema.  " +
-                              "Exception follows: %s",
+                              "This may be caused by replaying a mutation against a table with the same name but incompatible schema.",
                               f.getAbsolutePath(),
                               t);
             return;
@@ -725,10 +725,10 @@ public class CommitLogReplayer
         return false;
     }
 
-    static void handleReplayError(boolean permissible, String message, Object... messageArgs) throws IOException
+    static void handleReplayError(boolean permissible, Throwable t, String message, Object... messageArgs) throws IOException
     {
         String msg = String.format(message, messageArgs);
-        IOException e = new CommitLogReplayException(msg);
+        IOException e = new CommitLogReplayException(msg, t);
         if (permissible)
             logger.error("Ignoring commit log replay error likely due to incomplete flush to disk", e);
         else if (Boolean.getBoolean(IGNORE_REPLAY_ERRORS_PROPERTY))


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