hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [3/3] git commit: HBASE-11617 incorrect AgeOfLastAppliedOp and AgeOfLastShippedOp in replication Metrics when no new replication OP (Demai Ni)
Date Sat, 23 Aug 2014 16:47:28 GMT
HBASE-11617 incorrect AgeOfLastAppliedOp and AgeOfLastShippedOp in replication Metrics when
no new replication OP (Demai Ni)


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

Branch: refs/heads/0.98
Commit: e390a2fc0a71442d7208f771b832a279cf6cee0f
Parents: b21dcbf
Author: Andrew Purtell <apurtell@apache.org>
Authored: Sat Aug 23 09:43:12 2014 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Sat Aug 23 09:43:27 2014 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/replication/regionserver/MetricsSink.java    | 7 +++++--
 .../hbase/replication/regionserver/ReplicationSource.java     | 3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e390a2fc/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
index 2a715c0..d649edf 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
@@ -47,8 +47,11 @@ public class MetricsSink {
    * @return the age that was set
    */
   public long setAgeOfLastAppliedOp(long timestamp) {
-    lastTimestampForAge = timestamp;
-    long age = System.currentTimeMillis() - lastTimestampForAge;
+    long age = 0;
+    if (lastTimestampForAge != timestamp) {
+      lastTimestampForAge = timestamp;
+      age = System.currentTimeMillis() - lastTimestampForAge;
+    } 
     rms.setGauge(SINK_AGE_OF_LAST_APPLIED_OP, age);
     return age;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e390a2fc/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
index f2107be..59c8b38 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
@@ -375,6 +375,9 @@ public class ReplicationSource extends Thread
         // Reset the sleep multiplier if nothing has actually gone wrong
         if (!gotIOE) {
           sleepMultiplier = 1;
+          // if there was nothing to ship and it's not an error
+          // set "ageOfLastShippedOp" to <now> to indicate that we're current
+          this.metrics.setAgeOfLastShippedOp(System.currentTimeMillis());
         }
         if (sleepForRetries("Nothing to replicate", sleepMultiplier)) {
           sleepMultiplier++;


Mime
View raw message