hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r1099302 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
Date Wed, 04 May 2011 00:20:31 GMT
Author: jdcryans
Date: Wed May  4 00:20:31 2011
New Revision: 1099302

URL: http://svn.apache.org/viewvc?rev=1099302&view=rev
Log:
HBASE-3597  ageOfLastAppliedOp should update after cluster replication
            failures

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1099302&r1=1099301&r2=1099302&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed May  4 00:20:31 2011
@@ -271,6 +271,8 @@ Release 0.90.3 - Unreleased
    HBASE-3794  TestRpcMetrics fails on machine where region server is running
                (Alex Newman)
    HBASE-3741  Make HRegionServer aware of the regions it's opening/closing
+   HBASE-3597  ageOfLastAppliedOp should update after cluster replication
+               failures
 
   IMPROVEMENTS
    HBASE-3747  ReplicationSource should differanciate remote and local exceptions

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java?rev=1099302&r1=1099301&r2=1099302&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
Wed May  4 00:20:31 2011
@@ -578,6 +578,8 @@ public class ReplicationSource extends T
         break;
 
       } catch (IOException ioe) {
+        // Didn't ship anything, but must still age the last time we did
+        this.metrics.refreshAgeOfLastShippedOp();
         if (ioe instanceof RemoteException) {
           ioe = ((RemoteException) ioe).unwrapRemoteException();
           LOG.warn("Can't replicate because of an error on the remote cluster: ", ioe);

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java?rev=1099302&r1=1099301&r2=1099302&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
Wed May  4 00:20:31 2011
@@ -66,6 +66,11 @@ public class ReplicationSourceMetrics im
   public final MetricsIntValue sizeOfLogQueue =
       new MetricsIntValue("sizeOfLogQueue", registry);
 
+  // It's a little dirty to preset the age to now since if we fail
+  // to replicate the very first time then it will show that age instead
+  // of nothing (although that might not be good either).
+  private long lastTimestampForAge = System.currentTimeMillis();
+
   /**
    * Constructor used to register the metrics
    * @param id Name of the source this class is monitoring
@@ -90,7 +95,17 @@ public class ReplicationSourceMetrics im
    * @param timestamp write time of the edit
    */
   public void setAgeOfLastShippedOp(long timestamp) {
-    ageOfLastShippedOp.set(System.currentTimeMillis() - timestamp);
+    lastTimestampForAge = timestamp;
+    ageOfLastShippedOp.set(System.currentTimeMillis() - lastTimestampForAge);
+  }
+
+  /**
+   * Convenience method to use the last given timestamp to refresh the age
+   * of the last edit. Used when replication fails and need to keep that
+   * metric accurate.
+   */
+  public void refreshAgeOfLastShippedOp() {
+    setAgeOfLastShippedOp(lastTimestampForAge);
   }
 
   @Override



Mime
View raw message