You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jd...@apache.org on 2011/05/04 02:20:19 UTC

svn commit: r1099301 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java

Author: jdcryans
Date: Wed May  4 00:20:19 2011
New Revision: 1099301

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

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

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1099301&r1=1099300&r2=1099301&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Wed May  4 00:20:19 2011
@@ -36,6 +36,8 @@ Release 0.90.3 - Unreleased
    HBASE-3749  Master can't exit when open port failed (gaojinchao)
    HBASE-3794  TestRpcMetrics fails on machine where region server is running
    HBASE-3741  Make HRegionServer aware of the regions it's opening/closing
+   HBASE-3597  ageOfLastAppliedOp should update after cluster replication
+               failures
 
   IMPROVEMENT
    HBASE-3717  deprecate HTable isTableEnabled() methods in favor of HBaseAdmin

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java?rev=1099301&r1=1099300&r2=1099301&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java Wed May  4 00:20:19 2011
@@ -569,6 +569,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/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java?rev=1099301&r1=1099300&r2=1099301&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java Wed May  4 00:20:19 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