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 9b0e3f79fe0..91dd8d08e67 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 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 33975edb590..9be7b9a1e4c 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()); }