virajjasani commented on a change in pull request #1761:
URL: https://github.com/apache/hbase/pull/1761#discussion_r429206815



##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java
##########
@@ -120,6 +124,28 @@ public void testReplicationStatus() throws Exception {
     assertEquals(PEER_ID2, rLoadSourceList.get(0).getPeerID());
   }
 
+  @Test
+  public void testReplicationStatusSink() throws Exception {
+    try (Admin hbaseAdmin = UTIL2.getConnection().getAdmin()) {
+      ServerName server = 
UTIL2.getHBaseCluster().getRegionServer(0).getServerName();
+      ReplicationLoadSink loadSink = getLatestSinkMetric(hbaseAdmin, server);
+      //First checks if status of timestamp of last applied op is same as RS 
start, since no edits
+      //were replicated yet
+      assertEquals(loadSink.getTimestampStarted(), 
loadSink.getTimestampsOfLastAppliedOp());
+      //now insert some rows on source, so that it gets delivered to target
+      insertRowsOnSource();
+      Thread.sleep(10000);

Review comment:
       Although 10s seems more than enough time, we can use `Waiter.wait()` / 
`HBASE_TESTING_UTILITY.waitFor()` with predicate to check if 
`loadSink.getTimestampsOfLastAppliedOp()>loadSink.getTimestampStarted()`.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsSink.java
##########
@@ -98,4 +99,21 @@ public long getAgeOfLastAppliedOp() {
   public long getTimestampOfLastAppliedOp() {
     return this.lastTimestampForAge;
   }
+
+  /**
+   * Gets the time stamp from when the Sink was initialized.
+   * @return startTimestamp
+   */
+  public long getStartTimestamp() {
+    return startTimestamp;
+  }
+
+  /**
+   * Gets the total number of OPs delivered to target by this sink.

Review comment:
       nit: `Gets the total number of OPs delivered to this sink` would be 
better?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to