cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdeggles...@apache.org
Subject cassandra git commit: Log time elapsed for each incremental repair phase
Date Wed, 10 May 2017 21:12:56 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 69aa1737d -> 41388a4b3


Log time elapsed for each incremental repair phase

Patch by Blake Eggleston; Reviewed by Marcus Eriksson for CASSANDRA-13498


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

Branch: refs/heads/trunk
Commit: 41388a4b3c0a8f22f1d83fb4f3a5ae42c255ca94
Parents: 69aa173
Author: Blake Eggleston <bdeggleston@gmail.com>
Authored: Fri May 5 14:12:41 2017 -0700
Committer: Blake Eggleston <bdeggleston@gmail.com>
Committed: Wed May 10 14:10:18 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../repair/consistent/CoordinatorSession.java   | 38 ++++++++++++++++++++
 2 files changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/41388a4b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 230ccb3..ae8de54 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Log time elapsed for each incremental repair phase (CASSANDRA-13498)
  * Add multiple table operation support to cassandra-stress (CASSANDRA-8780)
  * Fix incorrect cqlsh results when selecting same columns multiple times (CASSANDRA-13262)
  * Fix WriteResponseHandlerTest is sensitive to test execution order (CASSANDRA-13421)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/41388a4b/src/java/org/apache/cassandra/repair/consistent/CoordinatorSession.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/repair/consistent/CoordinatorSession.java b/src/java/org/apache/cassandra/repair/consistent/CoordinatorSession.java
index cd4844b..bac749e 100644
--- a/src/java/org/apache/cassandra/repair/consistent/CoordinatorSession.java
+++ b/src/java/org/apache/cassandra/repair/consistent/CoordinatorSession.java
@@ -36,6 +36,7 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
+import org.apache.commons.lang3.time.DurationFormatUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -62,6 +63,9 @@ public class CoordinatorSession extends ConsistentSession
     private final SettableFuture<Boolean> prepareFuture = SettableFuture.create();
     private final SettableFuture<Boolean> finalizeProposeFuture = SettableFuture.create();
 
+    private volatile long sessionStart = Long.MIN_VALUE;
+    private volatile long repairStart = Long.MIN_VALUE;
+    private volatile long finalizeStart = Long.MIN_VALUE;
 
     public CoordinatorSession(Builder builder)
     {
@@ -245,6 +249,16 @@ public class CoordinatorSession extends ConsistentSession
         setAll(State.FAILED);
     }
 
+    private static String formatDuration(long then, long now)
+    {
+        if (then == Long.MIN_VALUE || now == Long.MIN_VALUE)
+        {
+            // if neither of the times were initially set, don't return a non-sensical answer
+            return "n/a";
+        }
+        return DurationFormatUtils.formatDurationWords(now - then, true, true);
+    }
+
     /**
      * Runs the asynchronous consistent repair session. Actual repair sessions are scheduled
via a submitter to make unit testing easier
      */
@@ -252,6 +266,7 @@ public class CoordinatorSession extends ConsistentSession
     {
         logger.info("Beginning coordination of incremental repair session {}", sessionID);
 
+        sessionStart = System.currentTimeMillis();
         ListenableFuture<Boolean> prepareResult = prepare(executor);
 
         // run repair sessions normally
@@ -261,6 +276,11 @@ public class CoordinatorSession extends ConsistentSession
             {
                 if (success)
                 {
+                    repairStart = System.currentTimeMillis();
+                    if (logger.isDebugEnabled())
+                    {
+                        logger.debug("Incremental repair {} prepare phase completed in {}",
sessionID, formatDuration(sessionStart, repairStart));
+                    }
                     setRepairing();
                     return sessionSubmitter.get();
                 }
@@ -279,6 +299,12 @@ public class CoordinatorSession extends ConsistentSession
             {
                 if (results == null || results.isEmpty() || Iterables.any(results, r ->
r == null))
                 {
+                    finalizeStart = System.currentTimeMillis();
+                    if (logger.isDebugEnabled())
+                    {
+                        logger.debug("Incremental repair {} validation/stream phase completed
in {}", sessionID, formatDuration(repairStart, finalizeStart));
+
+                    }
                     return Futures.immediateFailedFuture(new RuntimeException());
                 }
                 else
@@ -295,7 +321,15 @@ public class CoordinatorSession extends ConsistentSession
             {
                 if (result != null && result)
                 {
+                    if (logger.isDebugEnabled())
+                    {
+                        logger.debug("Incremental repair {} finalization phase completed
in {}", sessionID, formatDuration(finalizeStart, System.currentTimeMillis()));
+                    }
                     finalizeCommit(executor);
+                    if (logger.isDebugEnabled())
+                    {
+                        logger.debug("Incremental repair {} phase completed in {}", sessionID,
formatDuration(sessionStart, System.currentTimeMillis()));
+                    }
                 }
                 else
                 {
@@ -306,6 +340,10 @@ public class CoordinatorSession extends ConsistentSession
 
             public void onFailure(Throwable t)
             {
+                if (logger.isDebugEnabled())
+                {
+                    logger.debug("Incremental repair {} phase failed in {}", sessionID, formatDuration(sessionStart,
System.currentTimeMillis()));
+                }
                 hasFailure.set(true);
                 fail(executor);
             }


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


Mime
View raw message