cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cassandra git commit: Introduce error metrics for repair
Date Mon, 31 Jul 2017 07:58:02 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 9b8282752 -> 284271670


Introduce error metrics for repair

patch by Simon Zhou; reviewed by Stefan Podkowinski for CASSANDRA-13387


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

Branch: refs/heads/trunk
Commit: 284271670c389f2b9fd11271c33eca5bb2a228fd
Parents: 9b82827
Author: Simon Zhou <szhou@uber.com>
Authored: Thu Mar 30 20:45:03 2017 -0700
Committer: Stefan Podkowinski <stefan.podkowinski@1und1.de>
Committed: Mon Jul 31 09:54:05 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                               |  1 +
 src/java/org/apache/cassandra/metrics/StorageMetrics.java |  3 ++-
 src/java/org/apache/cassandra/repair/RepairRunnable.java  | 10 +++++++++-
 .../org/apache/cassandra/service/CassandraDaemon.java     |  2 +-
 src/java/org/apache/cassandra/tools/NodeProbe.java        |  2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/28427167/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d747d50..c0abed7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Introduce error metrics for repair (CASSANDRA-13387)
  * Refactoring to primitive functional interfaces in AuthCache (CASSANDRA-13732)
  * Update metrics to 3.1.5 (CASSANDRA-13648)
  * batch_size_warn_threshold_in_kb can now be set at runtime (CASSANDRA-13699)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/28427167/src/java/org/apache/cassandra/metrics/StorageMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/StorageMetrics.java b/src/java/org/apache/cassandra/metrics/StorageMetrics.java
index 12196f7..9399ba6 100644
--- a/src/java/org/apache/cassandra/metrics/StorageMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/StorageMetrics.java
@@ -29,7 +29,8 @@ public class StorageMetrics
     private static final MetricNameFactory factory = new DefaultNameFactory("Storage");
 
     public static final Counter load = Metrics.counter(factory.createMetricName("Load"));
-    public static final Counter exceptions = Metrics.counter(factory.createMetricName("Exceptions"));
+    public static final Counter uncaughtExceptions = Metrics.counter(factory.createMetricName("Exceptions"));
     public static final Counter totalHintsInProgress  = Metrics.counter(factory.createMetricName("TotalHintsInProgress"));
     public static final Counter totalHints = Metrics.counter(factory.createMetricName("TotalHints"));
+    public static final Counter repairExceptions = Metrics.counter(factory.createMetricName("RepairExceptions"));
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/28427167/src/java/org/apache/cassandra/repair/RepairRunnable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/repair/RepairRunnable.java b/src/java/org/apache/cassandra/repair/RepairRunnable.java
index 3f761ee..b581ebd 100644
--- a/src/java/org/apache/cassandra/repair/RepairRunnable.java
+++ b/src/java/org/apache/cassandra/repair/RepairRunnable.java
@@ -17,6 +17,7 @@
  */
 package org.apache.cassandra.repair;
 
+import java.io.IOException;
 import java.net.InetAddress;
 import java.nio.ByteBuffer;
 import java.util.*;
@@ -50,6 +51,7 @@ import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.repair.consistent.CoordinatorSession;
+import org.apache.cassandra.metrics.StorageMetrics;
 import org.apache.cassandra.repair.messages.RepairOption;
 import org.apache.cassandra.service.ActiveRepairService;
 import org.apache.cassandra.service.QueryState;
@@ -121,6 +123,7 @@ public class RepairRunnable extends WrappedRunnable implements ProgressEventNoti
 
     protected void fireErrorAndComplete(int progressCount, int totalProgress, String message)
     {
+        StorageMetrics.repairExceptions.inc();
         fireProgressEvent(new ProgressEvent(ProgressEventType.ERROR, progressCount, totalProgress,
message));
         String completionMessage = String.format("Repair command #%d finished with error",
cmd);
         fireProgressEvent(new ProgressEvent(ProgressEventType.COMPLETE, progressCount, totalProgress,
completionMessage));
@@ -144,7 +147,7 @@ public class RepairRunnable extends WrappedRunnable implements ProgressEventNoti
             validColumnFamilies = storageService.getValidColumnFamilies(false, false, keyspace,
columnFamilies);
             progress.incrementAndGet();
         }
-        catch (IllegalArgumentException e)
+        catch (IllegalArgumentException | IOException e)
         {
             logger.error("Repair failed:", e);
             fireErrorAndComplete(progress.get(), totalProgress, e.getMessage());
@@ -396,6 +399,7 @@ public class RepairRunnable extends WrappedRunnable implements ProgressEventNoti
 
             public void onFailure(Throwable t)
             {
+                StorageMetrics.repairExceptions.inc();
                 fireProgressEvent(new ProgressEvent(ProgressEventType.ERROR, progress.get(),
totalProgress, t.getMessage()));
                 logger.error("Error completing preview repair", t);
                 String completionMessage = complete();
@@ -476,6 +480,8 @@ public class RepairRunnable extends WrappedRunnable implements ProgressEventNoti
 
         public void onFailure(Throwable t)
         {
+            StorageMetrics.repairExceptions.inc();
+
             String message = String.format("Repair session %s for range %s failed with error
%s",
                                            session.getId(), session.getRanges().toString(),
t.getMessage());
             logger.error(message, t);
@@ -519,6 +525,7 @@ public class RepairRunnable extends WrappedRunnable implements ProgressEventNoti
             final String message;
             if (hasFailure.get())
             {
+                StorageMetrics.repairExceptions.inc();
                 message = "Some repair failed";
                 fireProgressEvent(new ProgressEvent(ProgressEventType.ERROR, progress.get(),
totalProgress,
                                                     message));
@@ -543,6 +550,7 @@ public class RepairRunnable extends WrappedRunnable implements ProgressEventNoti
 
         public void onFailure(Throwable t)
         {
+            StorageMetrics.repairExceptions.inc();
             fireProgressEvent(new ProgressEvent(ProgressEventType.ERROR, progress.get(),
totalProgress, t.getMessage()));
             if (!options.isPreview())
             {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/28427167/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 f412aab..88d812d 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -207,7 +207,7 @@ public class CassandraDaemon
         {
             public void uncaughtException(Thread t, Throwable e)
             {
-                StorageMetrics.exceptions.inc();
+                StorageMetrics.uncaughtExceptions.inc();
                 logger.error("Exception in thread " + t, e);
                 Tracing.trace("Exception in thread {}", t, e);
                 for (Throwable e2 = e; e2 != null; e2 = e2.getCause())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/28427167/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java
index 2615412..665ea6f 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -1100,7 +1100,7 @@ public class NodeProbe implements AutoCloseable
 
     public int getExceptionCount()
     {
-        return (int)StorageMetrics.exceptions.getCount();
+        return (int)StorageMetrics.uncaughtExceptions.getCount();
     }
 
     public Map<String, Integer> getDroppedMessages()


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


Mime
View raw message