hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-18520 Add jmx value to determine true Master Start time
Date Sun, 06 Aug 2017 05:32:44 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 7da47509d -> 637f7abf0


HBASE-18520 Add jmx value to determine true Master Start time

This is to determine how long it took in total for the master to start and finish initializing.

Signed-off-by: tedyu <yuzhihong@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/637f7abf
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/637f7abf
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/637f7abf

Branch: refs/heads/master
Commit: 637f7abf0b3ab33b105346c6627dc9b2170eab53
Parents: 7da4750
Author: Zach York <zyork@amazon.com>
Authored: Thu Jun 15 17:10:07 2017 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Aug 5 22:32:33 2017 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/master/MetricsMasterSource.java  |  2 ++
 .../apache/hadoop/hbase/master/MetricsMasterWrapper.java |  5 +++++
 .../hadoop/hbase/master/MetricsMasterSourceImpl.java     |  2 ++
 .../java/org/apache/hadoop/hbase/master/HMaster.java     | 11 +++++++++++
 .../hadoop/hbase/master/MetricsMasterWrapperImpl.java    |  5 +++++
 .../apache/hadoop/hbase/regionserver/HRegionServer.java  |  2 +-
 6 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/637f7abf/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSource.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSource.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSource.java
index 9163511..d187bb1 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSource.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSource.java
@@ -49,6 +49,7 @@ public interface MetricsMasterSource extends BaseSource {
   // Strings used for exporting to metrics system.
   String MASTER_ACTIVE_TIME_NAME = "masterActiveTime";
   String MASTER_START_TIME_NAME = "masterStartTime";
+  String MASTER_FINISHED_INITIALIZATION_TIME_NAME = "masterFinishedInitializationTime";
   String AVERAGE_LOAD_NAME = "averageLoad";
   String LIVE_REGION_SERVERS_NAME = "liveRegionServers";
   String DEAD_REGION_SERVERS_NAME = "deadRegionServers";
@@ -64,6 +65,7 @@ public interface MetricsMasterSource extends BaseSource {
   String CLUSTER_REQUESTS_NAME = "clusterRequests";
   String MASTER_ACTIVE_TIME_DESC = "Master Active Time";
   String MASTER_START_TIME_DESC = "Master Start Time";
+  String MASTER_FINISHED_INITIALIZATION_TIME_DESC = "Timestamp when Master has finished initializing";
   String AVERAGE_LOAD_DESC = "AverageLoad";
   String LIVE_REGION_SERVERS_DESC = "Names of live RegionServers";
   String NUMBER_OF_REGION_SERVERS_DESC = "Number of RegionServers";

http://git-wip-us.apache.org/repos/asf/hbase/blob/637f7abf/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapper.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapper.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapper.java
index 4789283..80e0892 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapper.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapper.java
@@ -134,4 +134,9 @@ public interface MetricsMasterWrapper {
    * Gets the space usage and limit for each namespace.
    */
   Map<String,Entry<Long,Long>> getNamespaceSpaceUtilization();
+
+  /**
+   * Get the time in Millis when the master finished initializing/becoming the active master
+   */
+  long getMasterInitializationTime();
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/637f7abf/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceImpl.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceImpl.java
index f21e29e..51f8fad 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceImpl.java
@@ -92,6 +92,8 @@ public class MetricsMasterSourceImpl
               MASTER_ACTIVE_TIME_DESC), masterWrapper.getActiveTime())
           .addGauge(Interns.info(MASTER_START_TIME_NAME,
               MASTER_START_TIME_DESC), masterWrapper.getStartTime())
+          .addGauge(Interns.info(MASTER_FINISHED_INITIALIZATION_TIME_NAME, MASTER_FINISHED_INITIALIZATION_TIME_DESC),
+              masterWrapper.getMasterInitializationTime())
           .addGauge(Interns.info(AVERAGE_LOAD_NAME, AVERAGE_LOAD_DESC),
               masterWrapper.getAverageLoad())
           .tag(Interns.info(LIVE_REGION_SERVERS_NAME, LIVE_REGION_SERVERS_DESC),

http://git-wip-us.apache.org/repos/asf/hbase/blob/637f7abf/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index 5316b54..d6b149a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -371,6 +371,9 @@ public class HMaster extends HRegionServer implements MasterServices {
   // Time stamps for when a hmaster became active
   private long masterActiveTime;
 
+  // Time stamp for when HMaster finishes becoming Active Master
+  private long masterFinishedInitializationTime;
+
   //should we check the compression codec type at master side, default true, HBASE-6370
   private final boolean masterCheckCompression;
 
@@ -875,6 +878,7 @@ public class HMaster extends HRegionServer implements MasterServices {
     status.markComplete("Initialization successful");
     LOG.info(String.format("Master has completed initialization %.3fsec",
        (System.currentTimeMillis() - masterActiveTime) / 1000.0f));
+    this.masterFinishedInitializationTime = System.currentTimeMillis();
     configurationManager.registerObserver(this.balancer);
     configurationManager.registerObserver(this.hfileCleaner);
 
@@ -2513,6 +2517,13 @@ public class HMaster extends HRegionServer implements MasterServices
{
     return masterActiveTime;
   }
 
+  /**
+   * @return timestamp in millis when HMaster finished becoming the active master
+   */
+  public long getMasterFinishedInitializationTime() {
+    return masterFinishedInitializationTime;
+  }
+
   public int getNumWALFiles() {
     return procedureStore != null ? procedureStore.getActiveLogs().size() : 0;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/637f7abf/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapperImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapperImpl.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapperImpl.java
index ed37d19..518c7b4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapperImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapperImpl.java
@@ -59,6 +59,11 @@ public class MetricsMasterWrapperImpl implements MetricsMasterWrapper {
   }
 
   @Override
+  public long getMasterInitializationTime() {
+    return master.getMasterFinishedInitializationTime();
+  }
+
+  @Override
   public String getClusterId() {
     return master.getClusterId();
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/637f7abf/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 184f070..0774df1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -545,6 +545,7 @@ public class HRegionServer extends HasThread implements
    */
   public HRegionServer(Configuration conf, CoordinatedStateManager csm) throws IOException
{
     super("RegionServer");  // thread name
+    this.startcode = System.currentTimeMillis();
     this.fsOk = true;
     this.conf = conf;
     // initialize netty event loop group at the very beginning as we may use it to start
rpc server,
@@ -590,7 +591,6 @@ public class HRegionServer extends HasThread implements
     this.stopped = false;
 
     rpcServices = createRpcServices();
-    this.startcode = System.currentTimeMillis();
     if (this instanceof HMaster) {
       useThisHostnameInstead = conf.get(MASTER_HOSTNAME_KEY);
     } else {


Mime
View raw message