HBASE-3597 ageOfLastAppliedOp should update after cluster replication
failures git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1099302 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
17694cf3bc
commit
6aa6a4ad8f
|
@ -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
|
||||
|
|
|
@ -578,6 +578,8 @@ public class ReplicationSource extends Thread
|
|||
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);
|
||||
|
|
|
@ -66,6 +66,11 @@ public class ReplicationSourceMetrics implements Updater {
|
|||
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 implements Updater {
|
|||
* @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
|
||||
|
|
Loading…
Reference in New Issue