Demai Ni created HBASE-11617:
--------------------------------
Summary: AgeOfLastAppliedOp in MetricsSink got increased when no
new replication sink OP
Key: HBASE-11617
URL: https://issues.apache.org/jira/browse/HBASE-11617
Project: HBase
Issue Type: Bug
Components: Replication
Affects Versions: 0.98.2
Environment: AgeOfLastAppliedOp in MetricsSink.java is to indicate the
time an edit sat in the 'replication queue' before it got replicated(aka
applied)
{code}
/**
* Set the age of the last applied operation
*
* @param timestamp The timestamp of the last operation applied.
* @return the age that was set
*/
public long setAgeOfLastAppliedOp(long timestamp) {
lastTimestampForAge = timestamp;
long age = System.currentTimeMillis() - lastTimestampForAge;
rms.setGauge(SINK_AGE_OF_LAST_APPLIED_OP, age);
return age;
}
{code}
In the following scenario:
1) at 7:00am a sink op is applied, and the SINK_AGE_OF_LAST_APPLIED_OP is
set for example 100ms;
2) and then NO new Sink op occur.
3) when a refreshAgeOfLastAppliedOp() is invoked at 8:00am. Instead of
return the 100ms, the AgeOfLastAppliedOp become 1hour + 100ms,
It was because that refreshAgeOfLastAppliedOp() get invoked periodically by
getStats().
proposed fix:
{code}
....
// a new value
+ private long age;
....
public long setAgeOfLastAppliedOp(long timestamp) {
+ if (lastTimestampForAge != timestamp) {
lastTimestampForAge = timestamp;
- long age = System.currentTimeMillis() - lastTimestampForAge;
+ this.age = System.currentTimeMillis() - lastTimestampForAge;
rms.setGauge(SINK_AGE_OF_LAST_APPLIED_OP, age);
}
return age;
}
{code}
detail discussion in [dev@hbase |
http://mail-archives.apache.org/mod_mbox/hbase-dev/201407.mbox/%3CCAOEq2C5BKMXAM2Fv4LGVb_Ktek-Pm%3DhjOi33gSHX-2qHqAou6w%40mail.gmail.com%3E
]
Reporter: Demai Ni
Assignee: Demai Ni
Priority: Minor
Fix For: 0.99.0, 0.98.5, 2.0.0
--
This message was sent by Atlassian JIRA
(v6.2#6252)