cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jji...@apache.org
Subject cassandra git commit: Supplemental update to CASSANDRA-13234 - more accurately calculate hint delay
Date Wed, 29 Mar 2017 00:38:11 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 4069807da -> ea708c47e


Supplemental update to CASSANDRA-13234 - more accurately calculate hint delay

Patch by Jeff Jirsa; Reviewed by Ariel Weisberg for CASSANDRA-13234


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

Branch: refs/heads/trunk
Commit: ea708c47e927ad082b553713738dbc7de48edf41
Parents: 4069807
Author: Jeff Jirsa <jeff@jeffjirsa.net>
Authored: Tue Mar 28 17:37:05 2017 -0700
Committer: Jeff Jirsa <jeff@jeffjirsa.net>
Committed: Tue Mar 28 17:37:05 2017 -0700

----------------------------------------------------------------------
 .../org/apache/cassandra/hints/HintsDispatcher.java    | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ea708c47/src/java/org/apache/cassandra/hints/HintsDispatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDispatcher.java b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
index 6fc55df..4a08540 100644
--- a/src/java/org/apache/cassandra/hints/HintsDispatcher.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
@@ -174,9 +174,8 @@ final class HintsDispatcher implements AutoCloseable
 
     private Callback sendHint(Hint hint)
     {
-        Callback callback = new Callback();
+        Callback callback = new Callback(hint.creationTime);
         HintMessage message = new HintMessage(hostId, hint);
-        HintsServiceMetrics.updateDelayMetrics(address , ApproximateTime.currentTimeMillis()
- hint.creationTime);
         MessagingService.instance().sendRRWithFailure(message.createMessageOut(), address,
callback);
         return callback;
     }
@@ -187,9 +186,8 @@ final class HintsDispatcher implements AutoCloseable
 
     private Callback sendEncodedHint(ByteBuffer hint)
     {
-        Callback callback = new Callback();
         EncodedHintMessage message = new EncodedHintMessage(hostId, hint, messagingVersion);
-        HintsServiceMetrics.updateDelayMetrics(address, ApproximateTime.currentTimeMillis()
- message.getHintCreationTime());
+        Callback callback = new Callback(message.getHintCreationTime());
         MessagingService.instance().sendRRWithFailure(message.createMessageOut(), address,
callback);
         return callback;
     }
@@ -201,6 +199,12 @@ final class HintsDispatcher implements AutoCloseable
         private final long start = System.nanoTime();
         private final SimpleCondition condition = new SimpleCondition();
         private volatile Outcome outcome;
+        private final long hintCreationTime;
+
+        private Callback(long hintCreationTime)
+        {
+            this.hintCreationTime = hintCreationTime;
+        }
 
         Outcome await()
         {
@@ -227,6 +231,7 @@ final class HintsDispatcher implements AutoCloseable
 
         public void response(MessageIn msg)
         {
+            HintsServiceMetrics.updateDelayMetrics(msg.from, ApproximateTime.currentTimeMillis()
- this.hintCreationTime);
             outcome = Outcome.SUCCESS;
             condition.signalAll();
         }


Mime
View raw message