[
https://issues.apache.org/jira/browse/HBASE-11617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14108098#comment-14108098
]
Hudson commented on HBASE-11617:
--------------------------------
SUCCESS: Integrated in HBase-0.98 #466 (See
[https://builds.apache.org/job/HBase-0.98/466/])
HBASE-11617 incorrect AgeOfLastAppliedOp and AgeOfLastShippedOp in replication
Metrics when no new replication OP (Demai Ni) (apurtell: rev
e390a2fc0a71442d7208f771b832a279cf6cee0f)
*
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
*
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
> incorrect AgeOfLastAppliedOp and AgeOfLastShippedOp in replication Metrics
> when no new replication 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
> Reporter: Demai Ni
> Assignee: Demai Ni
> Priority: Minor
> Fix For: 0.99.0, 2.0.0, 0.98.6
>
> Attachments: HBASE-11617-master-v1.patch
>
>
> 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}
> ---
> hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
> +++
> hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
> @@ -35,6 +35,7 @@ public class MetricsSink {
>
> private MetricsReplicationSource rms;
> private long lastTimestampForAge = System.currentTimeMillis();
> + private long age = 0;
>
> public MetricsSink() {
> rms =
> CompatibilitySingletonFactory.getInstance(MetricsReplicationSource.class);
> @@ -47,8 +48,12 @@ public class MetricsSink {
> * @return the age that was set
> */
> public long setAgeOfLastAppliedOp(long timestamp) {
> - lastTimestampForAge = timestamp;
> - long age = System.currentTimeMillis() - lastTimestampForAge;
> + if (lastTimestampForAge != timestamp) {
> + lastTimestampForAge = timestamp;
> + this.age = System.currentTimeMillis() - lastTimestampForAge;
> + } else {
> + this.age = 0;
> + }
> 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
> ]
--
This message was sent by Atlassian JIRA
(v6.2#6252)