You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sp...@apache.org on 2017/06/30 09:33:41 UTC

cassandra git commit: Add started & completed repair metrics

Repository: cassandra
Updated Branches:
  refs/heads/trunk fe3cfe3d7 -> 176f2a444


Add started & completed repair metrics

patch by Cameron Zemek; reviewed by Stefan Podkowinski for CASSANDRA-13598


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

Branch: refs/heads/trunk
Commit: 176f2a444cd2a6ed7c3be6ac126b6ca2c4f255cf
Parents: fe3cfe3
Author: Cameron Zemek <ca...@instaclustr.com>
Authored: Wed Jun 14 14:06:53 2017 +1000
Committer: Stefan Podkowinski <st...@1und1.de>
Committed: Fri Jun 30 11:28:13 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                       |  1 +
 .../apache/cassandra/metrics/KeyspaceMetrics.java | 18 ++++++++++++++++++
 .../apache/cassandra/metrics/TableMetrics.java    |  7 +++++++
 .../org/apache/cassandra/repair/RepairJob.java    |  6 ++++++
 4 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/176f2a44/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e56eb78..866c6fd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Added started & completed repair metrics (CASSANDRA-13598)
  * Improve secondary index (re)build failure and concurrency handling (CASSANDRA-10130)
  * Improve calculation of available disk space for compaction (CASSANDRA-13068)
  * Change the accessibility of RowCacheSerializer for third party row cache plugins (CASSANDRA-13579)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/176f2a44/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java b/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java
index affb372..9e8d542 100644
--- a/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/KeyspaceMetrics.java
@@ -102,6 +102,10 @@ public class KeyspaceMetrics
     public final Counter speculativeFailedRetries;
     /** Needed to speculate, but didn't have enough replicas **/
     public final Counter speculativeInsufficientReplicas;
+    /** Number of started repairs as coordinator on this keyspace */
+    public final Counter repairsStarted;
+    /** Number of completed repairs as coordinator on this keyspace */
+    public final Counter repairsCompleted;
     /** total time spent as a repair coordinator */
     public final Timer repairTime;
     /** total time spent preparing for repair */
@@ -285,6 +289,20 @@ public class KeyspaceMetrics
                 return metric.speculativeInsufficientReplicas.getCount();
             }
         });
+        repairsStarted = createKeyspaceCounter("RepairJobsStarted", new MetricValue()
+        {
+            public Long getValue(TableMetrics metric)
+            {
+                return metric.repairsStarted.getCount();
+            }
+        });
+        repairsCompleted = createKeyspaceCounter("RepairJobsCompleted", new MetricValue()
+        {
+            public Long getValue(TableMetrics metric)
+            {
+                return metric.repairsCompleted.getCount();
+            }
+        });
         repairTime = Metrics.timer(factory.createMetricName("RepairTime"));
         repairPrepareTime = Metrics.timer(factory.createMetricName("RepairPrepareTime"));
         anticompactionTime = Metrics.timer(factory.createMetricName("AntiCompactionTime"));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/176f2a44/src/java/org/apache/cassandra/metrics/TableMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/TableMetrics.java b/src/java/org/apache/cassandra/metrics/TableMetrics.java
index 40a927f..98fd1e9 100644
--- a/src/java/org/apache/cassandra/metrics/TableMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/TableMetrics.java
@@ -146,6 +146,10 @@ public class TableMetrics
     public final LatencyMetrics casCommit;
     /** percent of the data that is repaired */
     public final Gauge<Double> percentRepaired;
+    /** Number of started repairs as coordinator on this table */
+    public final Counter repairsStarted;
+    /** Number of completed repairs as coordinator on this table */
+    public final Counter repairsCompleted;
     /** time spent anticompacting data before participating in a consistent repair */
     public final TableTimer anticompactionTime;
     /** time spent creating merkle trees */
@@ -723,6 +727,9 @@ public class TableMetrics
         casPropose = new LatencyMetrics(factory, "CasPropose", cfs.keyspace.metric.casPropose);
         casCommit = new LatencyMetrics(factory, "CasCommit", cfs.keyspace.metric.casCommit);
 
+        repairsStarted = createTableCounter("RepairJobsStarted");
+        repairsCompleted = createTableCounter("RepairJobsCompleted");
+
         anticompactionTime = createTableTimer("AnticompactionTime", cfs.keyspace.metric.anticompactionTime);
         validationTime = createTableTimer("ValidationTime", cfs.keyspace.metric.validationTime);
         syncTime = createTableTimer("SyncTime", cfs.keyspace.metric.repairSyncTime);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/176f2a44/src/java/org/apache/cassandra/repair/RepairJob.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/repair/RepairJob.java b/src/java/org/apache/cassandra/repair/RepairJob.java
index d6c1176..58a369e 100644
--- a/src/java/org/apache/cassandra/repair/RepairJob.java
+++ b/src/java/org/apache/cassandra/repair/RepairJob.java
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Keyspace;
 import org.apache.cassandra.streaming.PreviewKind;
 import org.apache.cassandra.tracing.Tracing;
@@ -69,6 +70,9 @@ public class RepairJob extends AbstractFuture<RepairResult> implements Runnable
      */
     public void run()
     {
+        Keyspace ks = Keyspace.open(desc.keyspace);
+        ColumnFamilyStore cfs = ks.getColumnFamilyStore(desc.columnFamily);
+        cfs.metric.repairsStarted.inc();
         List<InetAddress> allEndpoints = new ArrayList<>(session.endpoints);
         allEndpoints.add(FBUtilities.getBroadcastAddress());
 
@@ -158,6 +162,7 @@ public class RepairJob extends AbstractFuture<RepairResult> implements Runnable
                     logger.info("{} {} is fully synced", previewKind.logPrefix(session.getId()), desc.columnFamily);
                     SystemDistributedKeyspace.successfulRepairJob(session.getId(), desc.keyspace, desc.columnFamily);
                 }
+                cfs.metric.repairsCompleted.inc();
                 set(new RepairResult(desc, stats));
             }
 
@@ -171,6 +176,7 @@ public class RepairJob extends AbstractFuture<RepairResult> implements Runnable
                     logger.warn("{} {} sync failed", previewKind.logPrefix(session.getId()), desc.columnFamily);
                     SystemDistributedKeyspace.failedRepairJob(session.getId(), desc.keyspace, desc.columnFamily, t);
                 }
+                cfs.metric.repairsCompleted.inc();
                 setException(t);
             }
         }, taskExecutor);


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