This is an automated email from the ASF dual-hosted git repository.

zghao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 380585e  HBASE-25098 ReplicationStatisticsChore runs in wrong time 
unit (#2460)
380585e is described below

commit 380585ef20d8139e9aadffa4adb8189fa3824554
Author: XinSun <ddu...@gmail.com>
AuthorDate: Sat Sep 26 19:49:02 2020 +0800

    HBASE-25098 ReplicationStatisticsChore runs in wrong time unit (#2460)
    
    Signed-off-by: Viraj Jasani <vjas...@apache.org>
    Signed-off-by: Guanghao Zhang <zg...@apache.org>
---
 .../hadoop/hbase/replication/ReplicationSinkServiceImpl.java     | 8 +++++---
 .../hadoop/hbase/replication/regionserver/Replication.java       | 9 ++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationSinkServiceImpl.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationSinkServiceImpl.java
index 9b0e3f7..91dd8d0 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationSinkServiceImpl.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationSinkServiceImpl.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.replication;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
@@ -51,7 +52,7 @@ public class ReplicationSinkServiceImpl implements 
ReplicationSinkService {
   // ReplicationLoad to access replication metrics
   private ReplicationLoad replicationLoad;
 
-  private int statsPeriod;
+  private int statsPeriodInSecond;
 
   @Override
   public void replicateLogEntries(List<AdminProtos.WALEntry> entries, 
CellScanner cells,
@@ -66,7 +67,7 @@ public class ReplicationSinkServiceImpl implements 
ReplicationSinkService {
     WALProvider walProvider) throws IOException {
     this.server = server;
     this.conf = server.getConfiguration();
-    this.statsPeriod =
+    this.statsPeriodInSecond =
       this.conf.getInt("replication.stats.thread.period.seconds", 5 * 60);
     this.replicationLoad = new ReplicationLoad();
   }
@@ -75,7 +76,8 @@ public class ReplicationSinkServiceImpl implements 
ReplicationSinkService {
   public void startReplicationService() throws IOException {
     this.replicationSink = new ReplicationSink(this.conf);
     this.server.getChoreService().scheduleChore(
-      new ReplicationStatisticsChore("ReplicationSinkStatistics", server, 
statsPeriod));
+        new ReplicationStatisticsChore("ReplicationSinkStatistics", server,
+            (int) TimeUnit.SECONDS.toMillis(statsPeriodInSecond)));
   }
 
   @Override
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/Replication.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/Replication.java
index 33975ed..9be7b9a 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/Replication.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/Replication.java
@@ -22,6 +22,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.OptionalLong;
 import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -64,7 +66,7 @@ public class Replication implements ReplicationSourceService {
   private SyncReplicationPeerInfoProvider syncReplicationPeerInfoProvider;
   // Hosting server
   private Server server;
-  private int statsPeriod;
+  private int statsPeriodInSecond;
   // ReplicationLoad to access replication metrics
   private ReplicationLoad replicationLoad;
   private MetricsReplicationGlobalSourceSource globalMetricsSource;
@@ -139,7 +141,7 @@ public class Replication implements 
ReplicationSourceService {
               p.getSyncReplicationState(), p.getNewSyncReplicationState(), 0));
       }
     }
-    this.statsPeriod =
+    this.statsPeriodInSecond =
         this.conf.getInt("replication.stats.thread.period.seconds", 5 * 60);
     this.replicationLoad = new ReplicationLoad();
 
@@ -169,7 +171,8 @@ public class Replication implements 
ReplicationSourceService {
   public void startReplicationService() throws IOException {
     this.replicationManager.init();
     this.server.getChoreService().scheduleChore(
-      new ReplicationStatisticsChore("ReplicationSourceStatistics", server, 
statsPeriod));
+      new ReplicationStatisticsChore("ReplicationSourceStatistics", server,
+          (int) TimeUnit.SECONDS.toMillis(statsPeriodInSecond)));
     LOG.info("{} started", this.server.toString());
   }
 

Reply via email to